From a2df495fdf21a08c8ab430303bd3c4e2e8c7f7a9 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 14 Oct 2021 19:11:15 +0300 Subject: [PATCH] zebra: don't use if_lookup_by_index_all_vrf if_lookup_by_index_all_vrf doesn't work correctly with netns VRF backend as the same index may be used in multiple netns simultaneously. In both case where it's used, we know the VRF in which we need to lookup for the interface. Signed-off-by: Igor Ryzhov --- zebra/zebra_l2.c | 2 +- zebra/zebra_vxlan.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c index 5a02149611..36ec656662 100644 --- a/zebra/zebra_l2.c +++ b/zebra/zebra_l2.c @@ -162,7 +162,7 @@ void zebra_l2_map_slave_to_bond(struct zebra_if *zif, vrf_id_t vrf_id) struct zebra_if *bond_zif; struct zebra_l2info_bondslave *bond_slave = &zif->bondslave_info; - bond_if = if_lookup_by_index_all_vrf(bond_slave->bond_ifindex); + bond_if = if_lookup_by_index(bond_slave->bond_ifindex, vrf_id); if (bond_if == bond_slave->bond_if) return; diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index c13c867d2a..bb46a1e62e 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -4736,13 +4736,11 @@ void zebra_vxlan_macvlan_down(struct interface *ifp) assert(zif); link_ifp = zif->link; if (!link_ifp) { - if (IS_ZEBRA_DEBUG_VXLAN) { - struct interface *ifp; - - ifp = if_lookup_by_index_all_vrf(zif->link_ifindex); - zlog_debug("macvlan parent link is not found. Parent index %d ifp %s", - zif->link_ifindex, ifp ? ifp->name : " "); - } + if (IS_ZEBRA_DEBUG_VXLAN) + zlog_debug( + "macvlan parent link is not found. Parent index %d ifp %s", + zif->link_ifindex, + ifindex2ifname(zif->link_ifindex, ifp->vrf_id)); return; } link_zif = link_ifp->info; -- 2.39.5