]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: upon RTM_NEWROUTE/DELROUTE, find appropriate interface
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 2 Jul 2018 08:33:00 +0000 (10:33 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 10 Jul 2018 15:32:23 +0000 (17:32 +0200)
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>
zebra/rt_netlink.c

index 90334915491e1c9f69c51314602c78fbf4386b3d..79922eb17eba9ec16f1826fa50aed6fcc13302c0 100644 (file)
@@ -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 {