summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorFredi Raspall <fredi@voltanet.io>2021-05-30 17:13:54 +0200
committerEmanuele Di Pascale <emanuele@voltanet.io>2021-09-28 10:40:32 +0200
commite90c0383244bd9dfe6748c8921320f676697bfdc (patch)
tree059439c3a4702ec4313383e03dc3cd9566569fa3 /isisd
parentospfd: fix condition to get label from SRLB (diff)
downloadfrr-e90c0383244bd9dfe6748c8921320f676697bfdc.tar.xz
frr-e90c0383244bd9dfe6748c8921320f676697bfdc.zip
isisd: fix condition to get label from SRLB
The fix is the same as for OSPF SR. Signed-off-by: Fredi Raspall <fredi@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_sr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c
index f7cef43d0..54e31f004 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;
}