summaryrefslogtreecommitdiffstats
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-07-02 10:33:00 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-07-10 17:32:23 +0200
commitfac4d51eea6cad22d5224ff5a0c538ce2ccdeada (patch)
tree79396f7fd549bf053f3b9e03080e56ef24fc124b /zebra/rt_netlink.c
parentMerge pull request #2643 from qlyoung/doc-workflow-reviews (diff)
downloadfrr-fac4d51eea6cad22d5224ff5a0c538ce2ccdeada.tar.xz
frr-fac4d51eea6cad22d5224ff5a0c538ce2ccdeada.zip
zebra: upon RTM_NEWROUTE/DELROUTE, find appropriate interface
The interface lookup algorithm is different according to if we are on netns vrf or not. If we are on the former case, then we only have to parse the interfaces of the netns, while if we are on the other case, we have to parse all the interfaces of all the vrfs ( since index is not overlapping in the latter case). Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to '')
-rw-r--r--zebra/rt_netlink.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 903349154..79922eb17 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -483,7 +483,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
memcpy(&nh.gate, gate, sz);
if (index) {
- ifp = if_lookup_by_index(index, VRF_UNKNOWN);
+ ifp = if_lookup_by_index_per_ns(
+ zebra_ns_lookup(ns_id),
+ index);
if (ifp)
nh_vrf_id = ifp->vrf_id;
}
@@ -526,8 +528,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
* using the last one looked
* up right now
*/
- ifp = if_lookup_by_index(index,
- VRF_UNKNOWN);
+ ifp = if_lookup_by_index_per_ns(
+ zebra_ns_lookup(ns_id),
+ index);
if (ifp)
nh_vrf_id = ifp->vrf_id;
else {