--- gvpe/src/vped.C 2003/03/01 15:53:03 1.1 +++ gvpe/src/vped.C 2003/09/01 21:23:35 1.8 @@ -35,6 +35,7 @@ #include +#include #include #include "gettext.h" @@ -43,10 +44,13 @@ #include "conf.h" #include "slog.h" #include "util.h" -#include "protocol.h" +#include "vpn.h" +#include "iom.h" vpn network; +static loglevel llevel = L_NONE; + /* If nonzero, display usage information and exit. */ static int show_help; @@ -128,11 +132,9 @@ case 'l': /* inc debug level */ { - loglevel l = string_to_loglevel (optarg); + llevel = string_to_loglevel (optarg); - if (l != L_NONE) - set_loglevel (l); - else + if (llevel == L_NONE) slog (L_WARN, "'%s': %s", optarg, UNKNOWN_LOGLEVEL); } break; @@ -168,17 +170,20 @@ sigterm_handler (int a) { network.events |= vpn::EVENT_SHUTDOWN; + network.event.start (0); } RETSIGTYPE sighup_handler (int a) { network.events |= vpn::EVENT_RECONNECT; + network.event.start (0); } RETSIGTYPE sigusr1_handler (int a) { + network.dump_status (); } RETSIGTYPE @@ -198,6 +203,7 @@ act.sa_handler = sigusr1_handler; sigaction (SIGUSR1, &act, NULL); act.sa_handler = sigusr2_handler; sigaction (SIGUSR2, &act, NULL); act.sa_handler = SIG_IGN; sigaction (SIGCHLD, &act, NULL); + act.sa_handler = SIG_IGN; sigaction (SIGPIPE, &act, NULL); act.sa_flags = SA_RESETHAND; act.sa_handler = sigterm_handler; sigaction (SIGINT , &act, NULL); act.sa_handler = sigterm_handler; sigaction (SIGTERM, &act, NULL); @@ -206,6 +212,8 @@ int main (int argc, char **argv, char **envp) { + ERR_load_crypto_strings (); // we have the RAM + set_loglevel (L_INFO); set_identity (argv[0]); log_to (LOGTO_SYSLOG | LOGTO_STDERR); @@ -218,7 +226,7 @@ if (show_version) { - printf (_("%s version %s (built %s %s, protocol %d:%d)\n"), get_identity (), + printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); printf (_ ("Copyright (C) 2003 Marc Lehmann and others.\n" @@ -246,9 +254,9 @@ make_names (); conf.read_config (true); - RAND_load_file ("/dev/urandom", 1024); + set_loglevel (llevel != L_NONE ? llevel : conf.llevel); - //OpenSSL_add_all_algorithms (); + RAND_load_file ("/dev/urandom", 1024); if (!THISNODE) { @@ -264,7 +272,7 @@ if (!network.setup ()) { - network.main_loop (); + iom.loop (); cleanup_and_exit (1); }