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"
|
#include "zebra/zebra_mpls.h"
|
||||||
|
|
||||||
extern struct zebra_t zebrad;
|
extern struct zebra_t zebrad;
|
||||||
struct list *zvrf_list;
|
|
||||||
|
|
||||||
/* VRF information update. */
|
/* VRF information update. */
|
||||||
static void
|
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 */
|
zvrf->zns = zebra_ns_lookup (NS_DEFAULT); /* Point to the global (single) NS */
|
||||||
*info = (void *)zvrf;
|
*info = (void *)zvrf;
|
||||||
router_id_init (zvrf);
|
router_id_init (zvrf);
|
||||||
listnode_add_sort (zvrf_list, zvrf);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -346,21 +344,19 @@ zebra_vrf_lookup (vrf_id_t vrf_id)
|
|||||||
return vrf_info_lookup (vrf_id);
|
return vrf_info_lookup (vrf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the zvrf in the zvrf_list. */
|
/* Lookup VRF by name. */
|
||||||
struct zebra_vrf *
|
struct zebra_vrf *
|
||||||
zebra_vrf_list_lookup_by_name (const char *name)
|
zebra_vrf_list_lookup_by_name (const char *name)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct vrf *vrf;
|
||||||
struct zebra_vrf *zvrf;
|
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
name = VRF_DEFAULT_NAME;
|
name = VRF_DEFAULT_NAME;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO (zvrf_list, node, zvrf))
|
vrf = vrf_list_lookup_by_name (name);
|
||||||
{
|
if (vrf)
|
||||||
if (strcmp(name, zvrf->name) == 0)
|
return ((struct zebra_vrf *) vrf->info);
|
||||||
return zvrf;
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,11 +448,13 @@ static int
|
|||||||
vrf_config_write (struct vty *vty)
|
vrf_config_write (struct vty *vty)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
struct vrf *vrf;
|
||||||
struct zebra_vrf *zvrf;
|
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, "vrf %s%s", zvrf->name, VTY_NEWLINE);
|
||||||
vty_out (vty, "!%s", 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_DISABLE_HOOK, zebra_vrf_disable);
|
||||||
vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete);
|
vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete);
|
||||||
|
|
||||||
zvrf_list = list_new ();
|
|
||||||
|
|
||||||
vrf_init ();
|
vrf_init ();
|
||||||
|
|
||||||
install_node (&vrf_node, vrf_config_write);
|
install_node (&vrf_node, vrf_config_write);
|
||||||
|
@ -86,8 +86,6 @@ struct zebra_vrf
|
|||||||
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
|
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct list *zvrf_list;
|
|
||||||
|
|
||||||
struct route_table *
|
struct route_table *
|
||||||
zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
|
zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
|
||||||
vrf_id_t vrf_id, u_int32_t table_id);
|
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 route_node *rn;
|
||||||
struct static_route *si;
|
struct static_route *si;
|
||||||
struct route_table *stable;
|
struct route_table *stable;
|
||||||
|
struct vrf *vrf;
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int write =0;
|
int write =0;
|
||||||
struct listnode *node;
|
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)
|
if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -5782,11 +5787,16 @@ static_config_ipv6 (struct vty *vty)
|
|||||||
int write = 0;
|
int write = 0;
|
||||||
char buf[PREFIX_STRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
struct route_table *stable;
|
struct route_table *stable;
|
||||||
|
struct vrf *vrf;
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
struct listnode *node;
|
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)
|
if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -5874,13 +5884,15 @@ DEFUN (show_vrf,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
"VRF\n")
|
"VRF\n")
|
||||||
{
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
struct listnode *node;
|
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;
|
||||||
continue;
|
if (! zvrf || ! zvrf->vrf_id)
|
||||||
|
continue;
|
||||||
|
|
||||||
vty_out (vty, "vrf %s ", zvrf->name);
|
vty_out (vty, "vrf %s ", zvrf->name);
|
||||||
if (zvrf->vrf_id == VRF_UNKNOWN)
|
if (zvrf->vrf_id == VRF_UNKNOWN)
|
||||||
|
Loading…
Reference in New Issue
Block a user