summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index d9f99bc089..ec526a3129 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -4336,6 +4336,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
struct bgp *bgp_vrf = NULL; /* bgp vrf instance */
struct bgp *bgp_def = NULL; /* default bgp instance */
struct listnode *node = NULL;
+ struct listnode *next = NULL;
struct bgpevpn *vpn = NULL;
bgp_vrf = bgp_lookup_by_vrf_id(vrf_id);
@@ -4386,6 +4387,10 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
}
}
+ /* If any L2VNIs point to this instance, unlink them. */
+ for (ALL_LIST_ELEMENTS(bgp_vrf->l2vnis, node, next, vpn))
+ bgpevpn_unlink_from_l3vni(vpn);
+
/* Delete the instance if it was autocreated */
if (CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_AUTO))
bgp_delete(bgp_vrf);