diff --git a/pbrd/pbr_main.c b/pbrd/pbr_main.c index 6699079a68..dd4893bb78 100644 --- a/pbrd/pbr_main.c +++ b/pbrd/pbr_main.c @@ -71,6 +71,8 @@ static void sigint(void) pbr_vrf_terminate(); + pbr_zebra_destroy(); + frr_fini(); exit(0); diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 30eaf62902..d47a308ac8 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -419,6 +419,16 @@ void pbr_zebra_init(void) zclient->zebra_connected = zebra_connected; } +void pbr_zebra_destroy(void) +{ + if (zclient == NULL) + return; + + zclient_stop(zclient); + zclient_free(zclient); + zclient = NULL; +} + void pbr_send_rnh(struct nexthop *nhop, bool reg) { uint32_t command; diff --git a/pbrd/pbr_zebra.h b/pbrd/pbr_zebra.h index ef844ef797..5cbb1fd682 100644 --- a/pbrd/pbr_zebra.h +++ b/pbrd/pbr_zebra.h @@ -14,6 +14,7 @@ struct pbr_interface { extern struct event_loop *master; extern void pbr_zebra_init(void); +extern void pbr_zebra_destroy(void); extern void route_add(struct pbr_nexthop_group_cache *pnhgc, struct nexthop_group nhg, afi_t install_afi);