]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: mpls entry interface lookup adaptation for vrf backend
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 5 Jul 2018 08:04:48 +0000 (10:04 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 10 Jul 2018 15:32:36 +0000 (17:32 +0200)
The search algorithm for interface based on ifindex only is adapted to
vrf netns based too. Only the default netns will be used to search the
interface index.

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

index fe0837a63a75b6767de74b34bd086b6990fa5a17..cfe208d35b0b9960b544ebc59f673cb58b4c1b81 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "zebra/rib.h"
 #include "zebra/rt.h"
+#include "zebra/interface.h"
 #include "zebra/zserv.h"
 #include "zebra/redistribute.h"
 #include "zebra/debug.h"
@@ -704,6 +705,7 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
 {
        struct nexthop *nexthop;
        struct interface *ifp;
+       struct zebra_ns *zns;
 
        nexthop = nhlfe->nexthop;
        if (!nexthop) // unexpected
@@ -721,7 +723,8 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
                 * which will not be in the default
                 * VRF.  So let's look in all of them
                 */
-               ifp = if_lookup_by_index(nexthop->ifindex, VRF_UNKNOWN);
+               zns = zebra_ns_lookup(NS_DEFAULT);
+               ifp = if_lookup_by_index_per_ns(zns, nexthop->ifindex);
                if (ifp && if_is_operative(ifp))
                        SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
                else
@@ -2752,10 +2755,13 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf,
 
                                switch (nexthop->type) {
                                case NEXTHOP_TYPE_IFINDEX: {
+                                       struct zebra_ns *zns;
                                        struct interface *ifp;
 
-                                       ifp = if_lookup_by_index(
-                                               nexthop->ifindex, VRF_UNKNOWN);
+                                       zns = zebra_ns_lookup(NS_DEFAULT);
+                                       ifp = if_lookup_by_index_per_ns(
+                                                       zns,
+                                                       nexthop->ifindex);
                                        vty_out(vty, "%15s", ifp->name);
                                        break;
                                }