summaryrefslogtreecommitdiffstats
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
commit137ce8dd46d313f15ee93ddbb5428d702aa61ed8 (patch)
treea49f76849019651842962dff2197b705e33831e7 /ospfd/ospfd.c
parentReleasing progress-linux version 9.1-0.1~progress7.99u1. (diff)
downloadfrr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.tar.xz
frr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c68
1 files changed, 18 insertions, 50 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 9ed1d30..4c4666d 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -575,39 +575,12 @@ static struct ospf *ospf_lookup_by_name(const char *vrf_name)
return NULL;
}
-/* Handle the second half of deferred shutdown. This is called either
- * from the deferred-shutdown timer thread, or directly through
- * ospf_deferred_shutdown_check.
- *
- * Function is to cleanup G-R state, if required then call ospf_finish_final
- * to complete shutdown of this ospf instance. Possibly exit if the
- * whole process is being shutdown and this was the last OSPF instance.
- */
-static void ospf_deferred_shutdown_finish(struct ospf *ospf)
-{
- ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
- EVENT_OFF(ospf->t_deferred_shutdown);
-
- ospf_finish_final(ospf);
-
- /* *ospf is now invalid */
-
- /* ospfd being shut-down? If so, was this the last ospf instance? */
- if (CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN)
- && (listcount(om->ospf) == 0)) {
- frr_fini();
- exit(0);
- }
-
- return;
-}
-
-/* Timer thread for G-R */
+/* Timer thread for deferred shutdown */
static void ospf_deferred_shutdown_timer(struct event *t)
{
struct ospf *ospf = EVENT_ARG(t);
- ospf_deferred_shutdown_finish(ospf);
+ ospf_finish_final(ospf);
}
/* Check whether deferred-shutdown must be scheduled, otherwise call
@@ -634,15 +607,12 @@ static void ospf_deferred_shutdown_check(struct ospf *ospf)
ospf_router_lsa_update_area(area);
}
timeout = ospf->stub_router_shutdown_time;
+ OSPF_TIMER_ON(ospf->t_deferred_shutdown,
+ ospf_deferred_shutdown_timer, timeout);
} else {
/* No timer needed */
- ospf_deferred_shutdown_finish(ospf);
- return;
+ ospf_finish_final(ospf);
}
-
- OSPF_TIMER_ON(ospf->t_deferred_shutdown, ospf_deferred_shutdown_timer,
- timeout);
- return;
}
/* Shut down the entire process */
@@ -657,10 +627,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);
@@ -678,6 +644,11 @@ void ospf_terminate(void)
/* Cleanup vrf info */
ospf_vrf_terminate();
+ 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
@@ -687,20 +658,17 @@ void ospf_terminate(void)
zclient_stop(zclient_sync);
zclient_free(zclient_sync);
-done:
frr_fini();
}
void ospf_finish(struct ospf *ospf)
{
- /* let deferred shutdown decide */
- ospf_deferred_shutdown_check(ospf);
-
- /* if ospf_deferred_shutdown returns, then ospf_finish_final is
- * deferred to expiry of G-S timer thread. Return back up, hopefully
- * to thread scheduler.
- */
- return;
+ if (CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN))
+ ospf_finish_final(ospf);
+ else {
+ /* let deferred shutdown decide */
+ ospf_deferred_shutdown_check(ospf);
+ }
}
/* Final cleanup of ospf instance */
@@ -900,6 +868,7 @@ static void ospf_finish_final(struct ospf *ospf)
EVENT_OFF(ospf->t_ase_calc);
EVENT_OFF(ospf->t_maxage);
EVENT_OFF(ospf->t_maxage_walker);
+ EVENT_OFF(ospf->t_deferred_shutdown);
EVENT_OFF(ospf->t_abr_task);
EVENT_OFF(ospf->t_abr_fr);
EVENT_OFF(ospf->t_asbr_check);
@@ -1442,7 +1411,6 @@ static void ospf_network_run_interface(struct ospf *ospf, struct interface *ifp,
struct prefix *p,
struct ospf_area *given_area)
{
- struct listnode *cnode;
struct connected *co;
if (memcmp(ifp->name, "VLINK", 5) == 0)
@@ -1454,7 +1422,7 @@ static void ospf_network_run_interface(struct ospf *ospf, struct interface *ifp,
/* if interface prefix is match specified prefix,
then create socket and join multicast group. */
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, co))
+ frr_each (if_connected, ifp->connected, co)
ospf_network_run_subnet(ospf, co, p, given_area);
}