]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: map vxlan interface to bridge interface with correct ns id
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 1 Oct 2019 09:07:13 +0000 (11:07 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 21 Sep 2020 07:17:10 +0000 (09:17 +0200)
an incoming bridge index has been found, that is linked with vxlan
interface, and the search for that bridge interface is done. In
vrf-lite, the search is done across the same default namespace, because
bridge and vxlan may not be in the same vrf. But this behaviour is wrong
when using vrf netns backend, as the bridge and the vxlan have to be in
the same vrf ( hence in the same network namespace). To comply with
that, use the netnamespace of the vxlan interface. Like that, the
appropriate nsid is passed as parameter, and consequently, the search is
correct, and the mac address passed to BGP will be ok too.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/zebra_l2.c
zebra/zebra_l2.h

index 1758c8f96a3e3aa8b03981916df09f28157fa1f2..d8674beb415fa3e469f13a306acf595fc4f1a6a4 100644 (file)
@@ -84,12 +84,14 @@ static void map_slaves_to_bridge(struct interface *br_if, int link)
 }
 
 /* Public functions */
-void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave)
+void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave,
+                                 struct zebra_ns *zns)
 {
        struct interface *br_if;
 
        /* TODO: Handle change of master */
-       br_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
+       assert(zns);
+       br_if = if_lookup_by_index_per_ns(zebra_ns_lookup(zns->ns_id),
                                          br_slave->bridge_ifindex);
        if (br_if)
                br_slave->br_if = br_if;
@@ -252,19 +254,23 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
 {
        struct zebra_if *zif;
        ifindex_t old_bridge_ifindex;
+       struct zebra_vrf *zvrf;
 
        zif = ifp->info;
        assert(zif);
 
+       zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+       if (!zvrf)
+               return;
+
        old_bridge_ifindex = zif->brslave_info.bridge_ifindex;
        if (old_bridge_ifindex == bridge_ifindex)
                return;
 
        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);
+               zebra_l2_map_slave_to_bridge(&zif->brslave_info, zvrf->zns);
                /* 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);
index 2735d915ecfdd0212cb0a8ac2995720eab6d0a85..79d2e4feca3b082c36212373bfa48a1f30b07168 100644 (file)
@@ -81,7 +81,8 @@ union zebra_l2if_info {
 
 #define IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif) ((zif)->l2info.br.vlan_aware == 1)
 
-extern void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave);
+extern void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave,
+                                        struct zebra_ns *zns);
 extern void
 zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave);
 extern void