summaryrefslogtreecommitdiffstats
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2023-11-24 00:21:31 +0100
committerRenato Westphal <renato@opensourcerouting.org>2023-12-01 12:53:28 +0100
commit37f861f1dbeda410c52d3b5f9f685e32a177211c (patch)
treee970b01ae98e34512c66db1f45ae1b67e06a625b /ospfd/ospfd.c
parentMerge pull request #14909 from chiragshah6/fdev4 (diff)
downloadfrr-37f861f1dbeda410c52d3b5f9f685e32a177211c.tar.xz
frr-37f861f1dbeda410c52d3b5f9f685e32a177211c.zip
ospfd: improve memory cleanup during shutdown
* On ospf_terminate(), proceed to clear the ospfd global variables even when no OSPF instance is configured * Remove double call to route_map_finish() * Call ospf_opaque_term() to clear the opaque LSA infrastructure * Clear the `OspfRI.area_info` and `om->ospf` global lists. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index d5cf9564f..b3f4cad5c 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -658,10 +658,6 @@ void ospf_terminate(void)
SET_FLAG(om->options, OSPF_MASTER_SHUTDOWN);
- /* Skip some steps if OSPF not actually running */
- if (listcount(om->ospf) == 0)
- goto done;
-
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
ospf_finish(ospf);
@@ -679,9 +675,11 @@ void ospf_terminate(void)
/* Cleanup vrf info */
ospf_vrf_terminate();
- route_map_finish();
-
keychain_terminate();
+
+ ospf_opaque_term();
+ list_delete(&om->ospf);
+
/* Deliberately go back up, hopefully to thread scheduler, as
* One or more ospf_finish()'s may have deferred shutdown to a timer
* thread
@@ -691,7 +689,6 @@ void ospf_terminate(void)
zclient_stop(zclient_sync);
zclient_free(zclient_sync);
-done:
frr_fini();
}