From 0b52b75a140e2c09ea7814f66cc1ab6458086c26 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 14 Oct 2021 18:58:49 +0300 Subject: [PATCH] bgpd: 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. We always know the BGP instance we work with, so use its VRF id for the interface lookup. Signed-off-by: Igor Ryzhov --- bgpd/bgp_nht.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 061fa6f087..28dd19d842 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -611,7 +611,8 @@ void bgp_nht_ifp_down(struct interface *ifp) static int bgp_nht_ifp_initial(struct thread *thread) { ifindex_t ifindex = THREAD_VAL(thread); - struct interface *ifp = if_lookup_by_index_all_vrf(ifindex); + struct bgp *bgp = THREAD_ARG(thread); + struct interface *ifp = if_lookup_by_index(ifindex, bgp->vrf_id); if (!ifp) return 0; @@ -657,7 +658,7 @@ void bgp_nht_interface_events(struct peer *peer) return; if (bnc->ifindex) - thread_add_event(bm->master, bgp_nht_ifp_initial, NULL, + thread_add_event(bm->master, bgp_nht_ifp_initial, bnc->bgp, bnc->ifindex, NULL); } -- 2.39.5