diff options
| author | vivek <vivek@cumulusnetworks.com> | 2018-03-30 00:13:58 +0000 |
|---|---|---|
| committer | vivek <vivek@cumulusnetworks.com> | 2018-03-30 00:13:58 +0000 |
| commit | 18abc1ebfd83718a867206154b414edaa14583e4 (patch) | |
| tree | ae82e339e9b7072714ffd6df31061b0bef9a7a2e | |
| parent | 46f1e1ee964e6408fbae477b824e8ed18cb357d6 (diff) | |
bgpd: Cleanup linkage between L2 VNIs and L3 VNI
When an L3 VNI is deleted, cleanup linkage to it from associated
L2 VNIs.
Updates: bgpd: keep a backpointer to vrf instance in struct bgpevpn
[Mitesh Kanjariya]
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
| -rw-r--r-- | bgpd/bgp_evpn.c | 5 |
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); |
