summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_labelpool.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c
index 03987b6bbf..46443d9d18 100644
--- a/bgpd/bgp_labelpool.c
+++ b/bgpd/bgp_labelpool.c
@@ -494,8 +494,18 @@ void bgp_lp_release(
bf_release_index(chunk->allocated_map, index);
chunk->nfree += 1;
deallocated = true;
+ break;
}
assert(deallocated);
+ if (deallocated &&
+ chunk->nfree == chunk->last - chunk->first + 1 &&
+ lp_fifo_count(&lp->requests) == 0) {
+ bgp_zebra_release_label_range(chunk->first,
+ chunk->last);
+ list_delete_node(lp->chunks, node);
+ lp_chunk_free(chunk);
+ lp->next_chunksize = LP_CHUNK_SIZE_MIN;
+ }
}
}
}