diff options
| -rw-r--r-- | isisd/isis_sr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index f7cef43d0d..54e31f0040 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -550,13 +550,13 @@ static void sr_local_block_delete(struct isis_area *area) */ static mpls_label_t sr_local_block_request_label(struct sr_local_block *srlb) { - mpls_label_t label; uint32_t index; uint32_t pos; + uint32_t size = srlb->end - srlb->start + 1; /* Check if we ran out of available labels */ - if (srlb->current >= srlb->end) + if (srlb->current >= size) return MPLS_INVALID_LABEL; /* Get first available label and mark it used */ @@ -568,7 +568,7 @@ static mpls_label_t sr_local_block_request_label(struct sr_local_block *srlb) /* Jump to the next free position */ srlb->current++; pos = srlb->current % SRLB_BLOCK_SIZE; - while (srlb->current < srlb->end) { + while (srlb->current < size) { if (pos == 0) index++; if (!((1ULL << pos) & srlb->used_mark[index])) @@ -579,6 +579,10 @@ static mpls_label_t sr_local_block_request_label(struct sr_local_block *srlb) } } + if (srlb->current == size) + zlog_warn( + "SR: Warning, SRLB is depleted and next label request will fail"); + return label; } |
