--- gvpe/src/gvpe.C 2005/04/08 16:12:49 1.7 +++ gvpe/src/gvpe.C 2008/11/21 05:02:08 1.15 @@ -2,23 +2,33 @@ gvpe.C -- the main file for gvpe Copyright (C) 1998-2002 Ivo Timmermans 2000-2002 Guus Sliepen - 2003-2005 Marc Lehmann + 2003-2008 Marc Lehmann This file is part of GVPE. - GVPE is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with gvpe; if not, write to the Free Software - Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + GVPE is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . + + Additional permission under GNU GPL version 3 section 7 + + If you modify this Program, or any covered work, by linking or + combining it with the OpenSSL project's OpenSSL library (or a modified + version of that library), containing parts covered by the terms of the + OpenSSL or SSLeay licenses, the licensors of this Program grant you + additional permission to convey the resulting work. Corresponding + Source for a non-source form of such a combination shall include the + source code for the parts of OpenSSL used as well as that of the + covered work. */ #include "config.h" @@ -50,7 +60,7 @@ #include "slog.h" #include "util.h" #include "vpn.h" -#include "iom.h" +#include "ev_cpp.h" static loglevel llevel = L_NONE; @@ -92,7 +102,7 @@ " -L, --mlock Lock tinc into main memory.\n" " --help Display this help and exit.\n" " --version Output version information and exit.\n\n")); - printf (_("Report bugs to .\n")); + printf (_("Report bugs to .\n")); } exit (status); @@ -163,14 +173,14 @@ sigterm_handler (int a) { network.events |= vpn::EVENT_SHUTDOWN; - network.event.start (0); + network.event.start (); } RETSIGTYPE sighup_handler (int a) { network.events |= vpn::EVENT_RECONNECT; - network.event.start (0); + network.event.start (); } RETSIGTYPE @@ -195,7 +205,6 @@ act.sa_handler = sighup_handler; sigaction (SIGHUP , &act, NULL); 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); @@ -222,11 +231,11 @@ if (show_version) { - printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), + printf (_("%s version %s (built %s %s, protocol version %d.%d)\n"), get_identity (), VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); printf (_("Built with kernel interface %s/%s.\n"), IFTYPE, IFSUBTYPE); printf (_ - ("Copyright (C) 2003 Marc Lehmann and others.\n" + ("Copyright (C) 2003-2008 Marc Lehmann and others.\n" "See the AUTHORS file for a complete list.\n\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n" @@ -254,6 +263,12 @@ argc--; } + if (!ev_default_loop (0)) + { + slog (L_ERR, _("unable to initialise the event loop (bad $LIBEV_METHODS?)")); + exit (EXIT_FAILURE); + } + { configuration_parser (conf, true, argc, argv); } @@ -276,7 +291,7 @@ if (!network.setup ()) { - io_manager::loop (); + ev_loop (EV_DEFAULT_ 0); cleanup_and_exit (EXIT_FAILURE); }