]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: do allocate vrf label only when necessary
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 9 Apr 2024 15:09:39 +0000 (17:09 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 18 Apr 2024 12:55:25 +0000 (14:55 +0200)
commit8b27521cfa0c93dc326698d9f729a0486fc43ead
tree7c242ccf96c89bc114a8184226ba2f408f8942aa
parent8e7fb950c13779d700fa79f82423bfcb64974b39
bgpd: do allocate vrf label only when necessary

Today, with the following bgp instance configured, the
local VRF label is allocated even if it is not used.

> router bgp 65500 vrf vrf1
>  address-family ipv4 unicast
>   label vpn export allocation-mode per-nexthop
>   label vpn export auto
>   rd vpn export 444:1
>   rt vpn both 52:100
>   export vpn
>   import vpn

The 'show mpls table' indicates that the 16 label value
is allocated, but never used in the exported prefixes.

> r1# show mpls table
>  Inbound Label  Type  Nexthop         Outbound Label
>  -----------------------------------------------------
>  16             BGP   vrf1            -
>  17             BGP   192.168.255.13  -
>  18             BGP   192.0.2.12      -
>  19             BGP   192.0.2.11      -

Fix this by only allocating new label values when really
used. Consequently, only 3 labels will be allocated instead
of previously 4.

> r1# show mpls table
>  Inbound Label  Type  Nexthop         Outbound Label
>  -----------------------------------------------------
>  16             BGP   192.168.255.13  -
>  17             BGP   192.0.2.11      -
>  18             BGP   192.0.2.12      -

Fixes: 577be36a41be ("bgpd: add support for l3vpn per-nexthop label")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_mplsvpn.c
bgpd/bgp_mplsvpn.h
bgpd/bgp_vty.c