diff options
| author | Louis Scalbert <louis.scalbert@6wind.com> | 2025-02-12 13:49:50 +0100 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2025-02-13 19:09:40 +0000 |
| commit | 2fd8d31f045205140f3ed54c299657e6937345de (patch) | |
| tree | ea14e011a2fd36aa8eb3581164d932560008a4aa | |
| parent | b54519d027a0535bbe0d3fd0a8bf27873e866009 (diff) | |
bgpd: release manual vpn label on instance deletion
When a BGP instance with a manually assigned VPN label is deleted, the
label is not released from the Zebra label registry. As a result,
reapplying a configuration with the same manual label leads to VPN
prefix export failures.
For example, with the following configuration:
> router bgp 65000 vrf BLUE
> address-family ipv4 unicast
> label vpn export <int>
Release zebra label registry on unconfiguration.
Fixes: d162d5f6f5 ("bgpd: fix hardset l3vpn label available in mpls pool")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit d6363625c35a99933bf60c9cf0b79627b468c9f7)
# Conflicts:
# bgpd/bgpd.c
| -rw-r--r-- | bgpd/bgpd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a984c5af87..e8440ec9c0 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3959,6 +3959,37 @@ int bgp_delete(struct bgp *bgp) bgp_vpn_leak_unimport(bgp); +<<<<<<< HEAD +======= + /* + * Release SRv6 SIDs, like it's done in `vpn_leak_postchange()` + * and bgp_sid_vpn_export_cmd/af_sid_vpn_export_cmd commands. + */ + bgp->tovpn_sid_index = 0; + UNSET_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO); + delete_vrf_tovpn_sid_per_vrf(bgp_default, bgp); + for (afi = AFI_IP; afi < AFI_MAX; afi++) { + bgp->vpn_policy[afi].tovpn_sid_index = 0; + UNSET_FLAG(bgp->vpn_policy[afi].flags, BGP_VPN_POLICY_TOVPN_SID_AUTO); + delete_vrf_tovpn_sid_per_af(bgp_default, bgp, afi); + + vpn_leak_zebra_vrf_sid_withdraw(bgp, afi); + } + + /* release auto vpn labels */ + bgp_vpn_release_label(bgp, AFI_IP, true); + bgp_vpn_release_label(bgp, AFI_IP6, true); + + /* release manual vpn labels */ + for (afi = AFI_IP; afi < AFI_MAX; afi++) { + if (!CHECK_FLAG(bgp->vpn_policy[afi].flags, BGP_VPN_POLICY_TOVPN_LABEL_MANUAL_REG)) + continue; + bgp_zebra_release_label_range(bgp->vpn_policy[afi].tovpn_label, + bgp->vpn_policy[afi].tovpn_label); + UNSET_FLAG(bgp->vpn_policy[afi].flags, BGP_VPN_POLICY_TOVPN_LABEL_MANUAL_REG); + } + +>>>>>>> d6363625c (bgpd: release manual vpn label on instance deletion) hook_call(bgp_inst_delete, bgp); FOREACH_AFI_SAFI (afi, safi) |
