From f01205bb9617d3474edf5b3b617db51935c18aca Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 13 Aug 2024 14:11:07 -0400 Subject: [PATCH 1/2] pbrd: Call vrf_terminate on shutdown Free up vrf memory on shutdown. Signed-off-by: Donald Sharp --- pbrd/pbr_vrf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pbrd/pbr_vrf.c b/pbrd/pbr_vrf.c index ef4a4c2c6310..d8adb91fef8b 100644 --- a/pbrd/pbr_vrf.c +++ b/pbrd/pbr_vrf.c @@ -123,4 +123,6 @@ void pbr_vrf_terminate(void) FOR_ALL_INTERFACES (vrf, ifp) pbr_if_del(ifp); } + + vrf_terminate(); } From 68fff4905627b73f92f12b1e6c023e8de561fd99 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 13 Aug 2024 14:12:05 -0400 Subject: [PATCH 2/2] babeld: Free up memory on shutdown a) call vector_delete on created vector on shutdown. b) Call babel_clean_routing_process on shutdown Signed-off-by: Donald Sharp --- babeld/babel_interface.c | 5 +++++ babeld/babel_interface.h | 1 + babeld/babel_main.c | 4 ++-- babeld/babeld.c | 3 +-- babeld/babeld.h | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 76ecd4fe4ee6..943ae9def1c2 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -1171,6 +1171,11 @@ DEFUN (show_babel_parameters, return CMD_SUCCESS; } +void babel_if_terminate(void) +{ + vector_free(babel_enable_if); +} + void babel_if_init(void) { diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h index a585e23afc70..ab08ded91a1c 100644 --- a/babeld/babel_interface.h +++ b/babeld/babel_interface.h @@ -94,6 +94,7 @@ struct buffered_update { /* init function */ void babel_if_init(void); +void babel_if_terminate(void); /* Callback functions for zebra client */ int babel_interface_up (int, struct zclient *, zebra_size_t, vrf_id_t); diff --git a/babeld/babel_main.c b/babeld/babel_main.c index 10ab1b53c32b..ddc75f7182c2 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -305,9 +305,9 @@ babel_exit_properly(void) /* Uninstall and flush all routes. */ debugf(BABEL_DEBUG_COMMON, "Uninstall routes."); - flush_all_routes(); - babel_interface_close_all(); + babel_clean_routing_process(); babel_zebra_close_connexion(); + babel_if_terminate(); babel_save_state_file(); debugf(BABEL_DEBUG_COMMON, "Remove pid file."); debugf(BABEL_DEBUG_COMMON, "Done."); diff --git a/babeld/babeld.c b/babeld/babeld.c index 6f0a5a7bb4ff..73deb1dd9254 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -299,8 +299,7 @@ babel_initial_noise(void) } /* Delete all the added babel routes, make babeld only speak to zebra. */ -static void -babel_clean_routing_process(void) +void babel_clean_routing_process(void) { flush_all_routes(); babel_interface_close_all(); diff --git a/babeld/babeld.h b/babeld/babeld.h index 5573719ab3ef..17a0381d2c50 100644 --- a/babeld/babeld.h +++ b/babeld/babeld.h @@ -98,5 +98,6 @@ extern int redistribute_filter(const unsigned char *prefix, unsigned short plen, extern int resize_receive_buffer(int size); extern void schedule_neighbours_check(int msecs, int override); extern struct babel *babel_lookup(void); +extern void babel_clean_routing_process(void); #endif /* BABEL_BABELD_H */