]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: when veth link is used across vrf, the link may not be good
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 27 Aug 2018 15:00:18 +0000 (17:00 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 27 Aug 2018 15:03:22 +0000 (17:03 +0200)
This function is changed so that the interface index is searched across
the correct namespace.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/if_netlink.c
zebra/interface.c
zebra/interface.h

index a15d914243df9b27ca522edccaf77dc6dfe22c89..2b9e8a589c884d8c2951407ed3819e4422ba1159 100644 (file)
@@ -675,7 +675,7 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
 
        /* Update link. */
-       zebra_if_update_link(ifp, link_ifindex);
+       zebra_if_update_link(ifp, link_ifindex, ns_id);
 
        /* Hardware type and address. */
        ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type);
@@ -1262,7 +1262,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                                         ZEBRA_INTERFACE_VRF_LOOPBACK);
 
                        /* Update link. */
-                       zebra_if_update_link(ifp, link_ifindex);
+                       zebra_if_update_link(ifp, link_ifindex, ns_id);
 
                        netlink_interface_update_hw_addr(tb, ifp);
 
index 763931d3503c4f9bb501df6eedd66ad2f78eb066..8558a8bd59b7e19b8ef96c5b310c5baadb8caa4d 100644 (file)
@@ -1002,13 +1002,14 @@ void if_refresh(struct interface *ifp)
        if_get_flags(ifp);
 }
 
-void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex)
+void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex,
+                         ns_id_t ns_id)
 {
        struct zebra_if *zif;
 
        zif = (struct zebra_if *)ifp->info;
        zif->link_ifindex = link_ifindex;
-       zif->link = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
+       zif->link = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id),
                                              link_ifindex);
 }
 
index 9634bfdb3fb841688bfc346357088fa2fc83fab3..bb39ac5e67af3fe77ccaf75ced25a277acf920eb 100644 (file)
@@ -344,7 +344,8 @@ extern int if_subnet_add(struct interface *, struct connected *);
 extern int if_subnet_delete(struct interface *, struct connected *);
 extern int ipv6_address_configured(struct interface *ifp);
 extern void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id);
-extern void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex);
+extern void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex,
+                                ns_id_t ns_id);
 
 extern void vrf_add_update(struct vrf *vrfp);