zebra: Fix show vrf and show run to use the zvrf_list

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>
This commit is contained in:
Donald Sharp 2016-05-04 01:04:00 +00:00
parent 871d39b325
commit c1c747a897
3 changed files with 14 additions and 19 deletions

View 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);
}
}

View 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);

View 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;