]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Zebra: Zebra: Display interface info for NHT in a VRF
authorvivek <vivek@cumulusnetworks.com>
Tue, 23 Feb 2016 04:17:09 +0000 (04:17 +0000)
committervivek <vivek@cumulusnetworks.com>
Tue, 23 Feb 2016 04:17:09 +0000 (04:17 +0000)
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-9458
Reviewed By: CCR-4150
Testing Done: Manual

zebra/interface.c
zebra/interface.h
zebra/zebra_rnh.c

index 8b25c33f171a2f8239d7615af50db8edfc6907c0..7b19379910f87b7ef296e507d57c60a06723cfe8 100644 (file)
@@ -183,6 +183,14 @@ if_lookup_by_index_per_ns (struct zebra_ns *ns, u_int32_t ifindex)
   return ifp;
 }
 
+const char *
+ifindex2ifname_per_ns (struct zebra_ns *zns, unsigned int ifindex)
+{
+  struct interface *ifp;
+
+  return ((ifp = if_lookup_by_index_per_ns (zns, ifindex)) != NULL) ?
+        ifp->name : "unknown";
+}
 
 /* Tie an interface address to its derived subnet list of addresses. */
 int
index ab018596c06968b0d8b26f7a62e0061bc9e0fe82..3d8a82d454fbabf23c4377e75d2f005854239a33 100644 (file)
@@ -210,6 +210,8 @@ struct zebra_if
 
 extern struct interface *if_lookup_by_index_per_ns (struct zebra_ns *, u_int32_t);
 extern struct interface *if_link_per_ns (struct zebra_ns *, struct interface *);
+extern const char *ifindex2ifname_per_ns (struct zebra_ns *, unsigned int);
+
 extern void if_unlink_per_ns (struct interface *);
 extern void if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
                                                   struct in6_addr *address, int add);
index 897067fd4b5224bc99946a1138ae9fed7d96d3c5..74e63d94671332113a6f03731b53386c308a59e1 100644 (file)
@@ -44,6 +44,7 @@
 #include "zebra/redistribute.h"
 #include "zebra/debug.h"
 #include "zebra/zebra_rnh.h"
+#include "zebra/interface.h"
 
 /* Default rtm_table for all clients */
 extern struct zebra_t zebrad;
@@ -946,18 +947,18 @@ print_nh (struct nexthop *nexthop, struct vty *vty)
     case NEXTHOP_TYPE_IPV4_IFINDEX:
       vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
       if (nexthop->ifindex)
-       vty_out (vty, ", %s", ifindex2ifname (nexthop->ifindex));
+       vty_out (vty, ", %s", ifindex2ifname_per_ns (dzns, nexthop->ifindex));
       break;
     case NEXTHOP_TYPE_IPV6:
     case NEXTHOP_TYPE_IPV6_IFINDEX:
       vty_out (vty, " %s",
               inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
       if (nexthop->ifindex)
-       vty_out (vty, ", via %s", ifindex2ifname (nexthop->ifindex));
+       vty_out (vty, ", via %s", ifindex2ifname_per_ns (dzns, nexthop->ifindex));
       break;
     case NEXTHOP_TYPE_IFINDEX:
       vty_out (vty, " is directly connected, %s",
-              ifindex2ifname (nexthop->ifindex));
+              ifindex2ifname_per_ns (dzns, nexthop->ifindex));
       break;
     case NEXTHOP_TYPE_BLACKHOLE:
       vty_out (vty, " is directly connected, Null0");