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>
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;
/* 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;