]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: don't use if_lookup_by_name_all_vrf
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 14 Oct 2021 18:06:38 +0000 (21:06 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 15 Oct 2021 00:42:52 +0000 (03:42 +0300)
if_lookup_by_name_all_vrf doesn't work correctly with netns VRF backend
as the same index may be used in multiple netns simultaneously.

Use the appropriate VRF when looking for the interface.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bgpd/bgp_routemap.c
bgpd/bgp_zebra.c

index 2f37367a8fba110e67ae4dfe479ebaf15354c22f..12a5e1d696b1e98fc73633383b9c19b8709478df 100644 (file)
@@ -1688,10 +1688,10 @@ route_match_interface(void *rule, const struct prefix *prefix, void *object)
 
        path = object;
 
-       if (!path)
+       if (!path || !path->peer || !path->peer->bgp)
                return RMAP_NOMATCH;
 
-       ifp = if_lookup_by_name_all_vrf((char *)rule);
+       ifp = if_lookup_by_name((char *)rule, path->peer->bgp->vrf_id);
 
        if (ifp == NULL || ifp->ifindex != path->attr->nh_ifindex)
                return RMAP_NOMATCH;
index 0249d53f02184c45dc690c535d2f2ecdb130a4a5..0546c638695e12a0aac09f529cfd8f65da53c598 100644 (file)
@@ -3506,7 +3506,7 @@ void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh,
                /* create default route with interface <VRF>
                 * with nexthop-vrf <VRF>
                 */
-               ifp = if_lookup_by_name_all_vrf(vrf->name);
+               ifp = if_lookup_by_name_vrf(vrf->name, vrf);
                if (!ifp)
                        return;
                api_nh->vrf_id = nh->vrf_id;