Commit 964c862bd6 for frr
commit 964c862bd6871a0e6280194b2692fa470ea962c5
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date: Tue Nov 3 10:05:36 2026 +0100
bgpd: keep the SRv6 unicast SIDs when deleting a BGP VRF instance
When a BGP VRF instance is deleted, the SRv6 unicast SIDs of the default
instance ('sid export' in its unicast address-families) are released,
and part of their configuration is lost. With the following
configuration of the default instance:
> router bgp 65001
> [..]
> address-family ipv4 unicast
> [..]
> sid export explicit 2001:db8:1:1:a1::
> exit-address-family
> !
> address-family ipv6 unicast
> [..]
> sid export 55
> exit-address-family
> r1# show bgp segment-routing srv6
> [..]
> functions:
> - sid: 2001:db8:1:1:a1::
> locator: default
> - sid: 2001:db8:1:1:37::
> locator: default
> bgps:
> - name: default
> [..]
> srv6_unicast[AFI_IP].sid: 2001:db8:1:1:a1::
> srv6_unicast[AFI_IP6].sid: 2001:db8:1:1:37::
Once 'router bgp 65001 vrf vrf10' then 'no router bgp 65001 vrf vrf10'
are entered, the default instance has no more unicast SID:
> r1# show bgp segment-routing srv6
> [..]
> functions:
> bgps:
> - name: default
> [..]
> srv6_unicast[AFI_IP].sid: (null)
> srv6_unicast[AFI_IP6].sid: (null)
and 'sid export explicit 2001:db8:1:1:a1::' is no longer in the running
configuration, while 'sid export 55' is still there, without SID.
bgp_delete() calls bgp_srv6_unicast_delete() with the default instance,
whatever the instance being deleted. bgp_srv6_unicast_delete() then
releases the unicast SIDs of the default instance, and frees their
explicit SID configuration. The SID index configuration is kept, but
nothing requests the SID again.
Fix this by calling bgp_srv6_unicast_delete() with the instance being
deleted: it does nothing for a VRF instance, and releases the unicast
SIDs of the default instance only when the default instance itself is
deleted.
Fixes: ec6231e3d206 ("bgpd: add sid allocation for unicast in the default vrf")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index c5f9d53238..b8b09ea034 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -4723,7 +4723,7 @@ int bgp_delete(struct bgp *bgp)
vpn_leak_zebra_vrf_sid_withdraw(bgp, afi);
/* SRv6 unicast */
- bgp_srv6_unicast_delete(bgp_default, afi);
+ bgp_srv6_unicast_delete(bgp, afi);
}
/* release auto vpn labels */