mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
zebra: Properly unregister hook on shutdown
the zebra pseudo wire code was registering a callback per vrf. These callbacks are not per vrf based. They are vrf agnostic so this was a mistake. Modify the code to on startup register once and on shutdown unregister once. Finally rename the zebra_pw_init and zebra_pw_exit functions to more properly reflect when they are called. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
c783d5b698
commit
7cabd9361c
|
@ -234,6 +234,8 @@ void zebra_finalize(struct event *dummy)
|
|||
|
||||
zebra_mpls_terminate();
|
||||
|
||||
zebra_pw_terminate();
|
||||
|
||||
ns_terminate();
|
||||
frr_fini();
|
||||
exit(0);
|
||||
|
|
|
@ -377,15 +377,18 @@ static int zebra_pw_client_close(struct zserv *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void zebra_pw_init(struct zebra_vrf *zvrf)
|
||||
static void zebra_pw_init(void)
|
||||
{
|
||||
RB_INIT(zebra_pw_head, &zvrf->pseudowires);
|
||||
RB_INIT(zebra_static_pw_head, &zvrf->static_pseudowires);
|
||||
|
||||
hook_register(zserv_client_close, zebra_pw_client_close);
|
||||
}
|
||||
|
||||
void zebra_pw_exit(struct zebra_vrf *zvrf)
|
||||
void zebra_pw_init_vrf(struct zebra_vrf *zvrf)
|
||||
{
|
||||
RB_INIT(zebra_pw_head, &zvrf->pseudowires);
|
||||
RB_INIT(zebra_static_pw_head, &zvrf->static_pseudowires);
|
||||
}
|
||||
|
||||
void zebra_pw_exit_vrf(struct zebra_vrf *zvrf)
|
||||
{
|
||||
struct zebra_pw *pw;
|
||||
|
||||
|
@ -396,6 +399,11 @@ void zebra_pw_exit(struct zebra_vrf *zvrf)
|
|||
}
|
||||
}
|
||||
|
||||
void zebra_pw_terminate(void)
|
||||
{
|
||||
hook_unregister(zserv_client_close, zebra_pw_client_close);
|
||||
}
|
||||
|
||||
DEFUN_NOSH (pseudowire_if,
|
||||
pseudowire_if_cmd,
|
||||
"pseudowire IFNAME",
|
||||
|
@ -837,4 +845,6 @@ void zebra_pw_vty_init(void)
|
|||
|
||||
install_element(VIEW_NODE, &show_pseudowires_cmd);
|
||||
install_element(VIEW_NODE, &show_pseudowires_detail_cmd);
|
||||
|
||||
zebra_pw_init();
|
||||
}
|
||||
|
|
|
@ -60,8 +60,9 @@ void zebra_pw_change(struct zebra_pw *, ifindex_t, int, int, union g_addr *,
|
|||
struct zebra_pw *zebra_pw_find(struct zebra_vrf *, const char *);
|
||||
void zebra_pw_update(struct zebra_pw *);
|
||||
void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus);
|
||||
void zebra_pw_init(struct zebra_vrf *);
|
||||
void zebra_pw_exit(struct zebra_vrf *);
|
||||
void zebra_pw_init_vrf(struct zebra_vrf *);
|
||||
void zebra_pw_exit_vrf(struct zebra_vrf *);
|
||||
void zebra_pw_terminate(void);
|
||||
void zebra_pw_vty_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -195,7 +195,7 @@ static int zebra_vrf_disable(struct vrf *vrf)
|
|||
/* Cleanup Vxlan, MPLS and PW tables. */
|
||||
zebra_vxlan_cleanup_tables(zvrf);
|
||||
zebra_mpls_cleanup_tables(zvrf);
|
||||
zebra_pw_exit(zvrf);
|
||||
zebra_pw_exit_vrf(zvrf);
|
||||
|
||||
/* Remove link-local IPv4 addresses created for BGP unnumbered peering.
|
||||
*/
|
||||
|
@ -376,7 +376,7 @@ struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf)
|
|||
|
||||
zebra_vxlan_init_tables(zvrf);
|
||||
zebra_mpls_init_tables(zvrf);
|
||||
zebra_pw_init(zvrf);
|
||||
zebra_pw_init_vrf(zvrf);
|
||||
zvrf->table_id = rt_table_main_id;
|
||||
/* by default table ID is default one */
|
||||
|
||||
|
|
Loading…
Reference in a new issue