diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2001-12-10 03:34:52 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2001-12-10 03:34:52 +0000 |
commit | cca4bd5360ba8d11f639dbbbe9d77ad34b066aa7 (patch) | |
tree | 80d2253f493ebc6f7e6703eae9d5cc7b715052dd /sbin/isakmpd | |
parent | 45ae6f291dc1aad5ff5daf2a1b047da5ba241a7a (diff) |
Add UI option 'R' to trigger isakmpd reinit (same as SIGHUP).
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/init.c | 54 | ||||
-rw-r--r-- | sbin/isakmpd/init.h | 3 | ||||
-rw-r--r-- | sbin/isakmpd/isakmpd.c | 71 | ||||
-rw-r--r-- | sbin/isakmpd/ui.c | 7 |
4 files changed, 75 insertions, 60 deletions
diff --git a/sbin/isakmpd/init.c b/sbin/isakmpd/init.c index fec847fa400..a9dd80a78f1 100644 --- a/sbin/isakmpd/init.c +++ b/sbin/isakmpd/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.17 2001/07/06 14:37:11 ho Exp $ */ +/* $OpenBSD: init.c,v 1.18 2001/12/10 03:34:51 ho Exp $ */ /* $EOM: init.c,v 1.25 2000/03/30 14:27:24 ho Exp $ */ /* @@ -56,6 +56,7 @@ #include "transport.h" #include "udp.h" #include "ui.h" +#include "util.h" #ifdef USE_POLICY #include "policy.h" @@ -94,3 +95,54 @@ init (void) udp_init (); ui_init (); } + +/* Reinitialize, either after a SIGHUP reception or by FIFO UI cmd. */ +void +reinit (void) +{ + log_print ("reinitializing daemon"); + + /* + * XXX Remove all(/some?) pending exchange timers? - they may not be + * possible to complete after we've re-read the config file. + * User-initiated SIGHUP's maybe "authorizes" a wait until + * next connection-check. + * XXX This means we discard exchange->last_msg, is this really ok? + */ + + /* Reinitialize PRNG if we are in deterministic mode. */ + if (regrand) + srandom (seed); + + /* Reread config file. */ + conf_reinit (); + + /* Try again to link in libcrypto (good if we started without /usr). */ + libcrypto_init (); + + /* Set timezone */ + tzset (); + +#ifdef USE_POLICY + /* Reread the policies. */ + policy_init (); +#endif + + /* Reinitialize certificates */ + cert_init (); + + /* Reinitialize our connection list. */ + connection_reinit (); + + /* + * Rescan interfaces. + */ + transport_reinit (); + + /* + * XXX "These" (non-existant) reinitializations should not be done. + * cookie_reinit (); + * ui_reinit (); + * sa_reinit (); + */ +} diff --git a/sbin/isakmpd/init.h b/sbin/isakmpd/init.h index 73cc45997a1..e361dc60ab0 100644 --- a/sbin/isakmpd/init.h +++ b/sbin/isakmpd/init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: init.h,v 1.3 1998/11/17 11:10:13 niklas Exp $ */ +/* $OpenBSD: init.h,v 1.4 2001/12/10 03:34:51 ho Exp $ */ /* $EOM: init.h,v 1.2 1998/07/07 23:36:00 niklas Exp $ */ /* @@ -38,5 +38,6 @@ #define _INIT_H_ extern void init (void); +extern void reinit (void); #endif /* _INIT_H_ */ diff --git a/sbin/isakmpd/isakmpd.c b/sbin/isakmpd/isakmpd.c index 8b52b09cfa0..c6ca0566c7d 100644 --- a/sbin/isakmpd/isakmpd.c +++ b/sbin/isakmpd/isakmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isakmpd.c,v 1.37 2001/10/26 11:37:16 ho Exp $ */ +/* $OpenBSD: isakmpd.c,v 1.38 2001/12/10 03:34:51 ho Exp $ */ /* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */ /* @@ -214,59 +214,6 @@ parse_args (int argc, char *argv[]) #endif } -/* Reinitialize after a SIGHUP reception. */ -static void -reinit (void) -{ - log_print ("SIGHUP received, reinitializing daemon."); - - /* - * XXX Remove all(/some?) pending exchange timers? - they may not be - * possible to complete after we've re-read the config file. - * User-initiated SIGHUP's maybe "authorizes" a wait until - * next connection-check. - * XXX This means we discard exchange->last_msg, is this really ok? - */ - - /* Reinitialize PRNG if we are in deterministic mode. */ - if (regrand) - srandom (seed); - - /* Reread config file. */ - conf_reinit (); - - /* Try again to link in libcrypto (good if we started without /usr). */ - libcrypto_init (); - - /* Set timezone */ - tzset (); - -#ifdef USE_POLICY - /* Reread the policies. */ - policy_init (); -#endif - - /* Reinitialize certificates */ - cert_init (); - - /* Reinitialize our connection list. */ - connection_reinit (); - - /* - * Rescan interfaces. - */ - transport_reinit (); - - /* - * XXX "These" (non-existant) reinitializations should not be done. - * cookie_reinit (); - * ui_reinit (); - * sa_reinit (); - */ - - sighupped = 0; -} - static void sighup (int sig) { @@ -444,15 +391,25 @@ main (int argc, char *argv[]) { /* If someone has sent SIGHUP to us, reconfigure. */ if (sighupped) - reinit (); + { + log_print ("SIGHUP received"); + reinit (); + sighupped = 0; + } /* and if someone sent SIGUSR1, do a state report. */ if (sigusr1ed) - report (); + { + log_print ("SIGUSR1 received"); + report (); + } /* and if someone sent SIGUSR2, do a timer rehash. */ if (sigusr2ed) - rehash_timers (); + { + log_print ("SIGUSR2 received"); + rehash_timers (); + } /* * and if someone set 'sigtermed' (SIGTERM or via the UI), this diff --git a/sbin/isakmpd/ui.c b/sbin/isakmpd/ui.c index 0483b8e9dbf..162fea654f5 100644 --- a/sbin/isakmpd/ui.c +++ b/sbin/isakmpd/ui.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ui.c,v 1.24 2001/12/03 16:17:17 ho Exp $ */ +/* $OpenBSD: ui.c,v 1.25 2001/12/10 03:34:51 ho Exp $ */ /* $EOM: ui.c,v 1.43 2000/10/05 09:25:12 niklas Exp $ */ /* @@ -49,6 +49,7 @@ #include "connection.h" #include "doi.h" #include "exchange.h" +#include "init.h" #include "isakmp.h" #include "log.h" #include "sa.h" @@ -342,6 +343,10 @@ ui_handle_command (char *line) ui_shutdown_daemon (line); break; + case 'R': + reinit (); + break; + case 'r': ui_report (line); break; |