summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_l2.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-10-01 11:07:13 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2020-05-18 14:11:03 +0200
commit7c990878f20efff335c1211deda3ec50071ae2b5 (patch)
tree8da0ef256485f287f197b2170e8c7afa58091f40 /zebra/zebra_l2.c
parentzebra: display interface slave type (diff)
downloadfrr-7c990878f20efff335c1211deda3ec50071ae2b5.tar.xz
frr-7c990878f20efff335c1211deda3ec50071ae2b5.zip
zebra: map vxlan interface to bridge interface with correct ns id
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>
Diffstat (limited to 'zebra/zebra_l2.c')
-rw-r--r--zebra/zebra_l2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index e549d80a5..d12fb3e30 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -83,12 +83,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;
@@ -241,19 +243,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);