zebra: Cleanup svd_nh_table on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-11-20 13:57:59 -05:00
parent 30c0efd68c
commit a7628b1b2d
3 changed files with 19 additions and 5 deletions

View File

@ -246,6 +246,7 @@ void zebra_router_terminate(void)
zebra_script_destroy();
#endif
zebra_vxlan_terminate();
/* OS-specific deinit */
kernel_router_terminate();
}

View File

@ -82,7 +82,7 @@ static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni,
struct zebra_neigh *n);
static struct zebra_neigh *svd_nh_add(const struct ipaddr *vtep_ip,
const struct ethaddr *rmac);
static int svd_nh_del(struct zebra_neigh *n);
static void svd_nh_del(struct zebra_neigh *n);
static int svd_nh_install(struct zebra_l3vni *zl3vni, struct zebra_neigh *n);
static int svd_nh_uninstall(struct zebra_l3vni *zl3vni, struct zebra_neigh *n);
@ -1590,17 +1590,24 @@ static struct zebra_neigh *svd_nh_add(const struct ipaddr *ip,
/*
* Del Single VXlan Device neighbor entry.
*/
static int svd_nh_del(struct zebra_neigh *n)
static void svd_nh_del(struct zebra_neigh *n)
{
if (n->refcnt > 0)
return -1;
return;
hash_release(svd_nh_table, n);
XFREE(MTYPE_L3NEIGH, n);
return 0;
}
static void svd_nh_del_terminate(void *ptr)
{
struct zebra_neigh *n = ptr;
n->refcnt = 0;
svd_nh_del(n);
}
/*
* Common code to install remote nh as neigh into the kernel.
*/
@ -5813,6 +5820,11 @@ void zebra_vxlan_init(void)
zebra_evpn_mh_init();
}
void zebra_vxlan_terminate(void)
{
hash_clean_and_free(&svd_nh_table, svd_nh_del_terminate);
}
/* free l3vni table */
void zebra_vxlan_disable(void)
{

View File

@ -185,6 +185,7 @@ extern void zebra_vxlan_init_tables(struct zebra_vrf *zvrf);
extern void zebra_vxlan_close_tables(struct zebra_vrf *);
extern void zebra_vxlan_cleanup_tables(struct zebra_vrf *);
extern void zebra_vxlan_init(void);
extern void zebra_vxlan_terminate(void);
extern void zebra_vxlan_disable(void);
extern void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
const struct ethaddr *rmac,