diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2023-09-18 17:47:17 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-10-04 13:12:05 +0200 |
commit | fcf22586200000f0d19ffed339524d2530ed0d6f (patch) | |
tree | 431d85a8ca7cb256c2b7b928dc60b170516f48f5 /nest/mpls.c | |
parent | 8e9e013b0ddec438151c9d12fd4bac079c350310 (diff) |
MPLS: Improve label range reconfiguration
Allow to shorten label range over unused area.
Diffstat (limited to 'nest/mpls.c')
-rw-r--r-- | nest/mpls.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nest/mpls.c b/nest/mpls.c index 788de7c1..bab6d128 100644 --- a/nest/mpls.c +++ b/nest/mpls.c @@ -77,8 +77,7 @@ * * TODO: * - label range non-intersection check - * - better range reconfigurations (allow reduce ranges over unused labels) - * - protocols should do route refresh instead of resetart when reconfiguration + * - protocols should do route refresh instead of restart when reconfiguration * requires changing labels (e.g. different label range) * - registering static allocations * - checking range in static allocations @@ -349,9 +348,12 @@ mpls_find_range_(list *l, const char *name) } static int -mpls_reconfigure_range(struct mpls_domain *m UNUSED, struct mpls_range *r, struct mpls_range_config *cf) +mpls_reconfigure_range(struct mpls_domain *m, struct mpls_range *r, struct mpls_range_config *cf) { - if ((cf->start > r->lo) || (cf->start + cf->length < r->hi)) + uint last = lmap_last_one_in_range(&m->labels, r->lo, r->hi); + if (last == r->hi) last = 0; + + if ((cf->start > r->lo) || (cf->start + cf->length <= last)) return 0; cf->range = r; |