From 0e44d248a048cefa646a89fe07aa3607739b0c74 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 11 Nov 2023 20:13:00 -0500 Subject: [PATCH] pbrd: Cleanup zclient on shutdown For some reason pbrd had no shutdown code for zclient. Now it does. Signed-off-by: Donald Sharp --- pbrd/pbr_main.c | 2 ++ pbrd/pbr_zebra.c | 10 ++++++++++ pbrd/pbr_zebra.h | 1 + 3 files changed, 13 insertions(+) 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);