Merge pull request #6570 from mjstapp/fix_daemon_fini_7_4

[7.4] Daemons should call frr_fini() on shutdown
This commit is contained in:
Donald Sharp 2020-06-11 18:47:49 -04:00 committed by GitHub
commit e28f42625e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 4 deletions

View File

@ -406,9 +406,11 @@ static void zprivs_caps_init(struct zebra_privs_t *zprivs)
static void zprivs_caps_terminate(void) static void zprivs_caps_terminate(void)
{ {
/* clear all capabilities */ /* Clear all capabilities, if we have any. */
if (zprivs_state.caps) if (zprivs_state.caps)
cap_clear(zprivs_state.caps); cap_clear(zprivs_state.caps);
else
return;
/* and boom, capabilities are gone forever */ /* and boom, capabilities are gone forever */
if (cap_set_proc(zprivs_state.caps)) { if (cap_set_proc(zprivs_state.caps)) {

View File

@ -1094,7 +1094,8 @@ static void do_thread_cancel(struct thread_master *master)
} }
/* Delete and free all cancellation requests */ /* Delete and free all cancellation requests */
list_delete_all_node(master->cancel_req); if (master->cancel_req)
list_delete_all_node(master->cancel_req);
/* Wake up any threads which may be blocked in thread_cancel_async() */ /* Wake up any threads which may be blocked in thread_cancel_async() */
master->canceled = true; master->canceled = true;

View File

@ -98,6 +98,7 @@ static void sigint(void)
{ {
zlog_notice("Terminating on signal"); zlog_notice("Terminating on signal");
ospf_terminate(); ospf_terminate();
exit(0);
} }
/* SIGUSR1 handler. */ /* SIGUSR1 handler. */

View File

@ -517,9 +517,9 @@ void ospf_terminate(void)
SET_FLAG(om->options, OSPF_MASTER_SHUTDOWN); SET_FLAG(om->options, OSPF_MASTER_SHUTDOWN);
/* exit immediately if OSPF not actually running */ /* Skip some steps if OSPF not actually running */
if (listcount(om->ospf) == 0) if (listcount(om->ospf) == 0)
exit(0); goto done;
bfd_gbl_exit(); bfd_gbl_exit();
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
@ -543,6 +543,7 @@ void ospf_terminate(void)
zclient_stop(zclient); zclient_stop(zclient);
zclient_free(zclient); zclient_free(zclient);
done:
frr_fini(); frr_fini();
} }

View File

@ -82,6 +82,8 @@ static void sigint(void)
{ {
zlog_notice("Terminating on signal"); zlog_notice("Terminating on signal");
frr_fini();
exit(0); exit(0);
} }

View File

@ -81,6 +81,8 @@ static void sigint(void)
{ {
zlog_notice("Terminating on signal"); zlog_notice("Terminating on signal");
frr_fini();
exit(0); exit(0);
} }

View File

@ -42,6 +42,7 @@ char backup_config_file[256];
bool mpls_enabled; bool mpls_enabled;
zebra_capabilities_t _caps_p[] = { zebra_capabilities_t _caps_p[] = {
}; };
@ -75,6 +76,8 @@ static void sigint(void)
static_vrf_terminate(); static_vrf_terminate();
frr_fini();
exit(0); exit(0);
} }

View File

@ -82,6 +82,8 @@ static void __attribute__((noreturn)) sigint(void)
vrrp_fini(); vrrp_fini();
frr_fini();
exit(0); exit(0);
} }