summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-12-12 15:31:52 +0100
committerGitHub <noreply@github.com>2023-12-12 15:31:52 +0100
commitf17cd4587d025df33db6f57a6ac9bf33c65eba88 (patch)
tree049e9a6e4c8b4514ef8c7d437b3ab3a79fa43cb7 /zebra
parentMerge pull request #14986 from LabNConsulting/chopps/fix-asan-odr (diff)
parentzebra: On shutdown properly free up ns memory (diff)
downloadfrr-f17cd4587d025df33db6f57a6ac9bf33c65eba88.tar.xz
frr-f17cd4587d025df33db6f57a6ac9bf33c65eba88.zip
Merge pull request #14985 from donaldsharp/zebra_delete_memory_problems
Zebra delete memory problems
Diffstat (limited to 'zebra')
-rw-r--r--zebra/label_manager.c5
-rw-r--r--zebra/label_manager.h2
-rw-r--r--zebra/main.c4
-rw-r--r--zebra/zebra_pw.c18
-rw-r--r--zebra/zebra_pw.h5
-rw-r--r--zebra/zebra_vrf.c4
6 files changed, 30 insertions, 8 deletions
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index 8ae6e0cc3..c97beb6af 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -302,6 +302,11 @@ void label_manager_init(void)
install_element(CONFIG_NODE, &mpls_label_dynamic_block_cmd);
}
+void label_manager_terminate(void)
+{
+ list_delete(&lbl_mgr.lc_list);
+}
+
/* alloc and fill a label chunk */
struct label_manager_chunk *
create_label_chunk(uint8_t proto, unsigned short instance, uint32_t session_id,
diff --git a/zebra/label_manager.h b/zebra/label_manager.h
index ab6ad7f63..03cf6a681 100644
--- a/zebra/label_manager.h
+++ b/zebra/label_manager.h
@@ -105,6 +105,8 @@ struct label_manager {
};
void label_manager_init(void);
+void label_manager_terminate(void);
+
struct label_manager_chunk *
assign_label_chunk(uint8_t proto, unsigned short instance, uint32_t session_id,
uint8_t keep, uint32_t size, uint32_t base);
diff --git a/zebra/main.c b/zebra/main.c
index 1efb27db0..d34fdb3bf 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -234,6 +234,10 @@ void zebra_finalize(struct event *dummy)
zebra_mpls_terminate();
+ zebra_pw_terminate();
+
+ label_manager_terminate();
+
ns_terminate();
frr_fini();
exit(0);
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index f76bf747d..deed3b6ad 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -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)
+{
+ hook_register(zserv_client_close, zebra_pw_client_close);
+}
+
+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);
-
- hook_register(zserv_client_close, zebra_pw_client_close);
}
-void zebra_pw_exit(struct zebra_vrf *zvrf)
+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();
}
diff --git a/zebra/zebra_pw.h b/zebra/zebra_pw.h
index a41afc920..431d663f7 100644
--- a/zebra/zebra_pw.h
+++ b/zebra/zebra_pw.h
@@ -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
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 2adae61f5..92982f25c 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -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 */