summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_main.c')
-rw-r--r--ospf6d/ospf6_main.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index 8444d90f..65fcb597 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -131,6 +131,35 @@ Report bugs to zebra@zebra.org\n", progname);
exit (status);
}
+static void
+ospf6_exit (int status)
+{
+ extern struct ospf6 *ospf6;
+ extern struct zclient *zclient;
+
+ if (ospf6)
+ ospf6_delete (ospf6);
+
+ ospf6_message_terminate ();
+ ospf6_asbr_terminate ();
+ ospf6_lsa_terminate ();
+
+ if_terminate ();
+ vty_terminate ();
+ cmd_terminate ();
+
+ if (zclient)
+ zclient_free (zclient);
+
+ if (master)
+ thread_master_free (master);
+
+ if (zlog_default)
+ closezlog (zlog_default);
+
+ exit (status);
+}
+
/* SIGHUP handler. */
static void
sighup (void)
@@ -143,7 +172,7 @@ static void
sigint (void)
{
zlog_notice ("Terminating on signal SIGINT");
- exit (0);
+ ospf6_exit (0);
}
/* SIGTERM handler. */
@@ -151,7 +180,7 @@ static void
sigterm (void)
{
zlog_notice ("Terminating on signal SIGTERM");
- exit (0);
+ ospf6_exit (0);
}
/* SIGUSR1 handler. */
@@ -325,7 +354,7 @@ main (int argc, char *argv[], char *envp[])
zlog_warn ("Thread failed");
/* Not reached. */
- exit (0);
+ ospf6_exit (0);
}