]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix show ip route vrf to use zvrf_list
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 4 May 2016 13:44:43 +0000 (13:44 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 6 May 2016 14:41:32 +0000 (10:41 -0400)
Iterate over the zvrf_list to allow 'show ip route vrf...'
to show vrfs that are inactive -vs- not even configured

Ticket: CM-10139
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
zebra/zebra_vty.c

index d0f2700b8b77b08ba634caad280a24d60cd65b1d..6da085b28fb66c156af2dff0d44de7d25a030c48 100644 (file)
@@ -2055,9 +2055,24 @@ DEFUN (show_ip_route,
   struct rib *rib;
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
+  struct zebra_vrf *zvrf = NULL;
 
   if (argc)
-    VRF_GET_ID (vrf_id, argv[0]);
+    {
+     if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0])))
+        {
+          vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE);
+          return CMD_SUCCESS;
+        }
+
+      if (zvrf->vrf_id == VRF_UNKNOWN)
+        {
+          vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE);
+          return CMD_SUCCESS;
+        }
+      else
+        vrf_id = zvrf->vrf_id;
+    }
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)
@@ -4677,9 +4692,24 @@ DEFUN (show_ipv6_route,
   struct rib *rib;
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
+  struct zebra_vrf *zvrf = NULL;
 
   if (argc > 0)
-    VRF_GET_ID (vrf_id, argv[0]);
+    {
+     if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0])))
+        {
+          vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE);
+          return CMD_SUCCESS;
+        }
+
+      if (zvrf->vrf_id == VRF_UNKNOWN)
+        {
+          vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE);
+          return CMD_SUCCESS;
+        }
+      else
+        vrf_id = zvrf->vrf_id;
+    }
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)