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 <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2021-10-14 18:58:49 +03:00
parent eb4135bad2
commit 0b52b75a14

View File

@ -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);
}