]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: don't use if_lookup_by_index_all_vrf
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 14 Oct 2021 15:58:49 +0000 (18:58 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 28 Oct 2021 15:54:46 +0000 (18:54 +0300)
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>
bgpd/bgp_nht.c

index 061fa6f0879f285e8fc4b3005b44cb4ec837cd9a..28dd19d842c7587b06f7555033f615f03a9ac275 100644 (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);
 }