zebra: Allow the zvrf to know it's vrf when allocing

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-04-26 09:47:39 -04:00
parent 6038682d46
commit ec64a634c2
2 changed files with 6 additions and 5 deletions

View File

@ -103,9 +103,7 @@ static int zebra_vrf_new(struct vrf *vrf)
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("VRF %s created, id %u", vrf->name, vrf->vrf_id);
zvrf = zebra_vrf_alloc();
vrf->info = zvrf;
zvrf->vrf = vrf;
zvrf = zebra_vrf_alloc(vrf);
if (!vrf_is_backend_netns())
zvrf->zns = zebra_ns_lookup(NS_DEFAULT);
@ -427,12 +425,15 @@ static void zebra_vrf_table_create(struct zebra_vrf *zvrf, afi_t afi,
}
/* Allocate new zebra VRF. */
struct zebra_vrf *zebra_vrf_alloc(void)
struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf)
{
struct zebra_vrf *zvrf;
zvrf = XCALLOC(MTYPE_ZEBRA_VRF, sizeof(struct zebra_vrf));
zvrf->vrf = vrf;
vrf->info = zvrf;
zebra_vxlan_init_tables(zvrf);
zebra_mpls_init_tables(zvrf);
zebra_pw_init(zvrf);

View File

@ -251,7 +251,7 @@ extern struct route_table *zebra_vrf_get_table_with_table_id(afi_t afi,
extern void zebra_vrf_update_all(struct zserv *client);
extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id);
extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *);
extern struct zebra_vrf *zebra_vrf_alloc(void);
extern struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf);
extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
extern void zebra_vrf_init(void);