]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Fix show vrf and show run to use the zvrf_list
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 4 May 2016 01:04:00 +0000 (01:04 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 6 May 2016 14:41:30 +0000 (10:41 -0400)
The show vrf and show run commands were iterating
over the vrf_list.  Use the zvrf_list instead
so that we can understand the differences
between something configed -vs- created

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/interface.c
zebra/zebra_vrf.h
zebra/zebra_vty.c

index ff7cf21512d3ef6fca4c14ffa0fbf76554233577..7d3d0851a7e875c6fbe2065b8e1cad3028dea251 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "zebra/rtadv.h"
 #include "zebra_ns.h"
+#include "zebra_vrf.h"
 #include "zebra/interface.h"
 #include "zebra/rib.h"
 #include "zebra/zserv.h"
@@ -2140,13 +2141,13 @@ static int
 vrf_config_write (struct vty *vty)
 {
   struct listnode *node;
-  struct vrf *vrf;
+  struct zebra_vrf *zvrf;
 
-  for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrf))
+  for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
     {
-      if (strcmp(vrf->name, VRF_DEFAULT_NAME))
+      if (strcmp(zvrf->name, VRF_DEFAULT_NAME))
         {
-          vty_out (vty, "vrf %s%s", vrf->name, VTY_NEWLINE);
+          vty_out (vty, "vrf %s%s", zvrf->name, VTY_NEWLINE);
           vty_out (vty, "!%s", VTY_NEWLINE);
         }
     }
index e9653410c6971bcbe57480bb3d45aa05a99c2c8b..456c6fdad868c50217a759649369f1c9830ae73e 100644 (file)
@@ -76,6 +76,8 @@ struct zebra_vrf
   struct zebra_ns *zns;
 };
 
+extern struct list *zvrf_list;
+
 struct route_table *
 zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
                                vrf_id_t vrf_id, u_int32_t table_id);
index 6b2f65d700204f7a122f9877cd8fad52015a8237..d0f2700b8b77b08ba634caad280a24d60cd65b1d 100644 (file)
@@ -3223,12 +3223,10 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
   struct zebra_vrf *zvrf;
   int write =0;
   struct listnode *node;
-  struct vrf *vrfp;
 
-  for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrfp))
+  for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
     {
-      if ((zvrf = vrfp->info)  == NULL ||
-          (stable = zvrf->stable[AFI_IP][safi]) == NULL)
+      if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
         continue;
 
       for (rn = route_top (stable); rn; rn = route_next (rn))
@@ -3267,7 +3265,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
               vty_out (vty, " %d", si->distance);
 
             if (si->vrf_id != VRF_DEFAULT)
-                vty_out (vty, " vrf %s", vrfp ? vrfp->name : "");
+                vty_out (vty, " vrf %s", zvrf ? zvrf->name : "");
 
             vty_out (vty, "%s", VTY_NEWLINE);
 
@@ -5490,12 +5488,10 @@ static_config_ipv6 (struct vty *vty)
   struct route_table *stable;
   struct zebra_vrf *zvrf;
   struct listnode *node;
-  struct vrf *vrfp;
 
-  for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrfp))
+  for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
     {
-      if ((zvrf = vrfp->info)  == NULL ||
-          (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
+      if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
         continue;
 
       for (rn = route_top (stable); rn; rn = route_next (rn))
@@ -5532,8 +5528,7 @@ static_config_ipv6 (struct vty *vty)
 
             if (si->vrf_id != VRF_DEFAULT)
               {
-                zvrf = vrf_info_lookup (si->vrf_id);
-                vty_out (vty, " vrf %s", vrfp->name);
+                vty_out (vty, " vrf %s", zvrf->name);
               }
 
             vty_out (vty, "%s", VTY_NEWLINE);
@@ -5574,12 +5569,9 @@ DEFUN (show_vrf,
 {
   struct zebra_vrf *zvrf;
   struct listnode *node;
-  struct vrf *vrfp;
 
-  for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrfp))
+  for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
     {
-      if ((zvrf = vrfp->info)  == NULL)
-        continue;
       if (!zvrf->vrf_id)
         continue;