summaryrefslogtreecommitdiff
path: root/zebra/zebra_vrf.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vrf.c')
-rw-r--r--zebra/zebra_vrf.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index b1c5e4dd35..929743859e 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -26,6 +26,7 @@
#include "command.h"
#include "memory.h"
+#include "vty.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
#include "zebra/rib.h"
@@ -270,11 +271,14 @@ zebra_vrf_delete (struct vrf *vrf)
/* release allocated memory */
for (afi = AFI_IP; afi <= AFI_IP6; afi++)
{
+ void *table_info;
+
for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++)
{
table = zvrf->table[afi][safi];
- XFREE (MTYPE_RIB_TABLE_INFO, table->info);
+ table_info = table->info;
route_table_finish (table);
+ XFREE (MTYPE_RIB_TABLE_INFO, table_info);
table = zvrf->stable[afi][safi];
route_table_finish (table);
@@ -284,8 +288,9 @@ zebra_vrf_delete (struct vrf *vrf)
if (zvrf->other_table[afi][table_id])
{
table = zvrf->other_table[afi][table_id];
- XFREE (MTYPE_RIB_TABLE_INFO, table->info);
+ table_info = table->info;
route_table_finish (table);
+ XFREE (MTYPE_RIB_TABLE_INFO, table_info);
}
route_table_finish (zvrf->rnh_table[afi]);
@@ -519,26 +524,6 @@ zebra_vrf_other_route_table (afi_t afi, u_int32_t table_id, vrf_id_t vrf_id)
return zvrf->table[afi][SAFI_UNICAST];
}
-/* Wrapper hook point for zebra daemon so that ifindex can be set
- * DEFUN macro not used as extract.pl HAS to ignore this
- * See also interface_cmd in lib/if.c
- */
-DEFUN_NOSH (zebra_vrf,
- zebra_vrf_cmd,
- "vrf NAME",
- "Select a VRF to configure\n"
- "VRF's name\n")
-{
- // VTY_DECLVAR_CONTEXT (vrf, vrfp);
- int ret;
-
- /* Call lib vrf() */
- if ((ret = vrf_cmd.func (self, vty, argc, argv)) != CMD_SUCCESS)
- return ret;
-
- return ret;
-}
-
static int
vrf_config_write (struct vty *vty)
{
@@ -557,13 +542,6 @@ vrf_config_write (struct vty *vty)
return 0;
}
-struct cmd_node vrf_node =
-{
- VRF_NODE,
- "%s(config-vrf)# ",
- 1
-};
-
/* Zebra VRF initialization. */
void
zebra_vrf_init (void)
@@ -574,9 +552,5 @@ zebra_vrf_init (void)
vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete);
vrf_init ();
-
- install_node (&vrf_node, vrf_config_write);
- install_default (VRF_NODE);
- install_element (CONFIG_NODE, &zebra_vrf_cmd);
- install_element (CONFIG_NODE, &no_vrf_cmd);
+ vrf_cmd_init (vrf_config_write);
}