]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Fix VxLAN interface add-del to bridge
authorvivek <vivek@cumulusnetworks.com>
Thu, 20 Jul 2017 16:54:46 +0000 (09:54 -0700)
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Thu, 17 Aug 2017 09:48:41 +0000 (02:48 -0700)
Ensure that removal and addition of VxLAN interface from/to bridge is
handled correctly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
zebra/zebra_l2.c
zebra/zebra_vxlan.c

index 5d059a4502e691596232a77f9fe14c0464860e8a..452bab003a1416bd552ac4aa19b47d0d6e965c1b 100644 (file)
@@ -224,12 +224,18 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
        zif->brslave_info.bridge_ifindex = bridge_ifindex;
 
        /* Set up or remove link with master */
-       if (bridge_ifindex != IFINDEX_INTERNAL)
-               zebra_l2_map_slave_to_bridge(&zif->brslave_info);
-       else if (old_bridge_ifindex != IFINDEX_INTERNAL)
-               zebra_l2_unmap_slave_from_bridge(&zif->brslave_info);
-
-       /* In the case of VxLAN, invoke the handler for EVPN. */
-       if (zif->zif_type == ZEBRA_IF_VXLAN)
-               zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
+       if (bridge_ifindex != IFINDEX_INTERNAL) {
+               zebra_l2_map_slave_to_bridge (&zif->brslave_info);
+               /* In the case of VxLAN, invoke the handler for EVPN. */
+               if (zif->zif_type == ZEBRA_IF_VXLAN)
+                       zebra_vxlan_if_update (ifp, ZEBRA_VXLIF_MASTER_CHANGE);
+       } else if (old_bridge_ifindex != IFINDEX_INTERNAL) {
+               /* In the case of VxLAN, invoke the handler for EVPN. Note that
+                * this should be done *prior* to unmapping the interface from the
+                * bridge.
+                */
+               if (zif->zif_type == ZEBRA_IF_VXLAN)
+                       zebra_vxlan_if_update (ifp, ZEBRA_VXLIF_MASTER_CHANGE);
+               zebra_l2_unmap_slave_from_bridge (&zif->brslave_info);
+       }
 }
index 7e456cc7c1ffa07546fe3283147f61d4e7bcccff..5e7ffb108eed63e15c7602a7398678085266a76c 100644 (file)
@@ -3084,7 +3084,7 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, int sock, u_short length,
                        continue;
                }
                ifp = zvni->vxlan_if;
-               if (!ifp)
+               if (!ifp) {
                        zlog_err(
                                "VNI %u hash %p doesn't have intf upon remote MACIP DEL",
                                vni, zvni);
@@ -4174,7 +4174,7 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
                        vxl->access_vlan, inet_ntoa(vxl->vtep_ip),
                        zif->brslave_info.bridge_ifindex, chgflags);
 
-       /* Removed from bridge? */
+       /* Removed from bridge? Cleanup and return */
        if ((chgflags & ZEBRA_VXLIF_MASTER_CHANGE)
            && (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
                /* Delete from client, remove all remote VTEPs */
@@ -4183,7 +4183,11 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
                zvni_neigh_del_all(zvrf, zvni, 1, 0, DEL_ALL_NEIGH);
                zvni_mac_del_all(zvrf, zvni, 1, 0, DEL_ALL_MAC);
                zvni_vtep_del_all(zvni, 1);
-       } else if (chgflags & ZEBRA_VXLIF_VLAN_CHANGE) {
+               return 0;
+       }
+
+       /* Handle other changes. */
+       if (chgflags & ZEBRA_VXLIF_VLAN_CHANGE) {
                /* Remove all existing local neighbors and MACs for this VNI
                 * (including from BGP)
                 */