]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Cleanup linkage between L2 VNIs and L3 VNI
authorvivek <vivek@cumulusnetworks.com>
Fri, 30 Mar 2018 00:13:58 +0000 (00:13 +0000)
committervivek <vivek@cumulusnetworks.com>
Fri, 30 Mar 2018 00:13:58 +0000 (00:13 +0000)
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>
bgpd/bgp_evpn.c

index d9f99bc089b818e9c7db66a10df7d19273f2bab8..ec526a3129c2189e6b12f597dd9993609f9c567a 100644 (file)
@@ -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);