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
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2020-08-18 18:25:06 +0200
commit9771da714e63ba050f13a3f1fa2cdee464e97da1 (patch)
treeffe061c0b75d37a4ecba34f7825406fe88b01dc2 /zebra/zebra_l2.c
parentzebra: display interface slave type (diff)
downloadfrr-9771da714e63ba050f13a3f1fa2cdee464e97da1.tar.xz
frr-9771da714e63ba050f13a3f1fa2cdee464e97da1.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 1758c8f96..d8674beb4 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -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);