mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
zebra: nuke zvrf_list and always use vrf_list instead
zvrf_list doesn't need to exist, it's basically a duplicate version of vrf_list. Also, zebra_vrf_delete() wasn't removing zvrf from zvrf_list, which was a bug. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
60f1637a8b
commit
51bdc5f85c
@ -36,7 +36,6 @@
|
||||
#include "zebra/zebra_mpls.h"
|
||||
|
||||
extern struct zebra_t zebrad;
|
||||
struct list *zvrf_list;
|
||||
|
||||
/* VRF information update. */
|
||||
static void
|
||||
@ -96,7 +95,6 @@ zebra_vrf_new (vrf_id_t vrf_id, const char *name, void **info)
|
||||
zvrf->zns = zebra_ns_lookup (NS_DEFAULT); /* Point to the global (single) NS */
|
||||
*info = (void *)zvrf;
|
||||
router_id_init (zvrf);
|
||||
listnode_add_sort (zvrf_list, zvrf);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -346,21 +344,19 @@ zebra_vrf_lookup (vrf_id_t vrf_id)
|
||||
return vrf_info_lookup (vrf_id);
|
||||
}
|
||||
|
||||
/* Lookup the zvrf in the zvrf_list. */
|
||||
/* Lookup VRF by name. */
|
||||
struct zebra_vrf *
|
||||
zebra_vrf_list_lookup_by_name (const char *name)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct zebra_vrf *zvrf;
|
||||
struct vrf *vrf;
|
||||
|
||||
if (!name)
|
||||
name = VRF_DEFAULT_NAME;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
||||
{
|
||||
if (strcmp(name, zvrf->name) == 0)
|
||||
return zvrf;
|
||||
}
|
||||
vrf = vrf_list_lookup_by_name (name);
|
||||
if (vrf)
|
||||
return ((struct zebra_vrf *) vrf->info);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -452,11 +448,13 @@ static int
|
||||
vrf_config_write (struct vty *vty)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
||||
for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrf))
|
||||
{
|
||||
if (strcmp(zvrf->name, VRF_DEFAULT_NAME))
|
||||
zvrf = vrf->info;
|
||||
if (! zvrf || strcmp (zvrf->name, VRF_DEFAULT_NAME))
|
||||
{
|
||||
vty_out (vty, "vrf %s%s", zvrf->name, VTY_NEWLINE);
|
||||
vty_out (vty, "!%s", VTY_NEWLINE);
|
||||
@ -481,8 +479,6 @@ zebra_vrf_init (void)
|
||||
vrf_add_hook (VRF_DISABLE_HOOK, zebra_vrf_disable);
|
||||
vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete);
|
||||
|
||||
zvrf_list = list_new ();
|
||||
|
||||
vrf_init ();
|
||||
|
||||
install_node (&vrf_node, vrf_config_write);
|
||||
|
@ -86,8 +86,6 @@ struct zebra_vrf
|
||||
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
|
||||
};
|
||||
|
||||
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);
|
||||
|
@ -3673,13 +3673,18 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
||||
struct route_node *rn;
|
||||
struct static_route *si;
|
||||
struct route_table *stable;
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
char buf[BUFSIZ];
|
||||
int write =0;
|
||||
struct listnode *node;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
||||
for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrf))
|
||||
{
|
||||
zvrf = vrf->info;
|
||||
if (! zvrf)
|
||||
continue;
|
||||
|
||||
if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
|
||||
continue;
|
||||
|
||||
@ -5782,11 +5787,16 @@ static_config_ipv6 (struct vty *vty)
|
||||
int write = 0;
|
||||
char buf[PREFIX_STRLEN];
|
||||
struct route_table *stable;
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
struct listnode *node;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
||||
for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrf))
|
||||
{
|
||||
zvrf = vrf->info;
|
||||
if (! zvrf)
|
||||
continue;
|
||||
|
||||
if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
|
||||
continue;
|
||||
|
||||
@ -5874,12 +5884,14 @@ DEFUN (show_vrf,
|
||||
SHOW_STR
|
||||
"VRF\n")
|
||||
{
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
struct listnode *node;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
||||
for (ALL_LIST_ELEMENTS_RO (vrf_list, node, vrf))
|
||||
{
|
||||
if (!zvrf->vrf_id)
|
||||
zvrf = vrf->info;
|
||||
if (! zvrf || ! zvrf->vrf_id)
|
||||
continue;
|
||||
|
||||
vty_out (vty, "vrf %s ", zvrf->name);
|
||||
|
Loading…
Reference in New Issue
Block a user