From: Donald Sharp Date: Wed, 4 May 2016 01:04:00 +0000 (+0000) Subject: zebra: Fix show vrf and show run to use the zvrf_list X-Git-Tag: frr-2.0-rc1~936 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c1c747a897ebc7cfa5a6a46580cd8b046e426907;p=matthieu%2Ffrr.git 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 Reviewed-by: Vivek Venkatraman Reviewed-by: Don Slice --- diff --git a/zebra/interface.c b/zebra/interface.c index ff7cf21512..7d3d0851a7 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -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); } } diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index e9653410c6..456c6fdad8 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -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); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 6b2f65d700..d0f2700b8b 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -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;