summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2025-02-18 10:27:56 -0500
committerGitHub <noreply@github.com>2025-02-18 10:27:56 -0500
commit31802c5965cfd1b6ac76cf2ff5c41cdc78e186b0 (patch)
tree512a249bad1b0a3ea85aa557d4623a4287181e16
parente3bd25eb53332b0d05c29208ade16c6a94db6790 (diff)
parent2fd8d31f045205140f3ed54c299657e6937345de (diff)
Merge pull request #18156 from FRRouting/mergify/bp/stable/10.1/pr-18121
bgpd: release manual vpn label on instance deletion (backport #18121)
-rw-r--r--bgpd/bgpd.c31
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)