]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: improve memory cleanup during shutdown
authorRenato Westphal <renato@opensourcerouting.org>
Thu, 23 Nov 2023 23:21:31 +0000 (20:21 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 1 Dec 2023 11:53:28 +0000 (08:53 -0300)
* 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>
ospfd/ospf_ri.c
ospfd/ospfd.c

index 725443f490786a71b1a7898b0b6f269853f4a8ec..c6aaf3f5a0751b5fd0e042705b2d3388170ec1a7 100644 (file)
@@ -153,6 +153,7 @@ static int ospf_router_info_unregister(void)
 void ospf_router_info_term(void)
 {
 
+       list_delete(&OspfRI.area_info);
        list_delete(&OspfRI.pce_info.pce_domain);
        list_delete(&OspfRI.pce_info.pce_neighbor);
 
index d5cf9564ff2f52d5d6142e8c974eb05ebfda6489..b3f4cad5c1a3886f0d15cc7241f670471e139e90 100644 (file)
@@ -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();
 }