summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_l2.c
diff options
context:
space:
mode:
authorDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-13 18:29:40 +0200
committerDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-13 18:29:40 +0200
commitea7ec26162b248600626b81f8eddb74e6d059e36 (patch)
treec2b874936d13d6c1123804f5345cc4fdaf43e0cd /zebra/zebra_l2.c
parent zebra: Display master interface names, not ifindices (diff)
downloadfrr-ea7ec26162b248600626b81f8eddb74e6d059e36.tar.xz
frr-ea7ec26162b248600626b81f8eddb74e6d059e36.zip
zebra: Ensure master's ifname is known, even if slave comes up first
In if_netlink.c, when an interface structure, ifp, is first created, its possible for the master to come up after the slave interface does. This means, the slave interface has no way to display the master's ifname in show outputs. To fix this, we need to allow creation by ifindex instead of by ifname so that this issue is handled. Signed-off-by: Dinesh G Dutt<5016467+ddutt@users.noreply.github.com>
Diffstat (limited to 'zebra/zebra_l2.c')
-rw-r--r--zebra/zebra_l2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index ca37dd748..e549d80a5 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -99,15 +99,18 @@ void zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave)
br_slave->br_if = NULL;
}
-void zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave)
+void zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave,
+ vrf_id_t vrf_id)
{
struct interface *bond_if;
/* TODO: Handle change of master */
- bond_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
- bond_slave->bond_ifindex);
+ bond_if = if_lookup_by_index_all_vrf(bond_slave->bond_ifindex);
if (bond_if)
bond_slave->bond_if = bond_if;
+ else
+ bond_slave->bond_if = if_create_ifindex(bond_slave->bond_ifindex,
+ vrf_id);
}
void zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave)
@@ -282,7 +285,7 @@ void zebra_l2if_update_bond_slave(struct interface *ifp, ifindex_t bond_ifindex)
/* Set up or remove link with master */
if (bond_ifindex != IFINDEX_INTERNAL)
- zebra_l2_map_slave_to_bond(&zif->bondslave_info);
+ zebra_l2_map_slave_to_bond(&zif->bondslave_info, ifp->vrf_id);
else if (old_bond_ifindex != IFINDEX_INTERNAL)
zebra_l2_unmap_slave_from_bond(&zif->bondslave_info);
}