1 | /* |
1 | /* |
2 | vped.C -- the main file for vped |
2 | vped.C -- the main file for vped |
3 | Copyright (C) 1998-2002 Ivo Timmermans <ivo@o2w.nl> |
3 | Copyright (C) 1998-2002 Ivo Timmermans <ivo@o2w.nl> |
4 | 2000-2002 Guus Sliepen <guus@sliepen.eu.org> |
4 | 2000-2002 Guus Sliepen <guus@sliepen.eu.org> |
5 | 2003 Marc Lehmannn <pcg@goof.com> |
5 | 2003 Marc Lehmann <pcg@goof.com> |
6 | |
6 | |
7 | This program is free software; you can redistribute it and/or modify |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. |
10 | (at your option) any later version. |
… | |
… | |
21 | |
21 | |
22 | #include "config.h" |
22 | #include "config.h" |
23 | |
23 | |
24 | #include <cstdio> |
24 | #include <cstdio> |
25 | #include <cstring> |
25 | #include <cstring> |
|
|
26 | #include <clocale> |
26 | |
27 | |
27 | #include <errno.h> |
28 | #include <errno.h> |
28 | #include <fcntl.h> |
29 | #include <fcntl.h> |
29 | #include <getopt.h> |
30 | #include <getopt.h> |
30 | #include <signal.h> |
31 | #include <signal.h> |
… | |
… | |
46 | #include "conf.h" |
47 | #include "conf.h" |
47 | #include "slog.h" |
48 | #include "slog.h" |
48 | #include "util.h" |
49 | #include "util.h" |
49 | #include "vpn.h" |
50 | #include "vpn.h" |
50 | #include "iom.h" |
51 | #include "iom.h" |
51 | |
|
|
52 | vpn network; |
|
|
53 | |
52 | |
54 | static loglevel llevel = L_NONE; |
53 | static loglevel llevel = L_NONE; |
55 | |
54 | |
56 | /* If nonzero, display usage information and exit. */ |
55 | /* If nonzero, display usage information and exit. */ |
57 | static int show_help; |
56 | static int show_help; |
… | |
… | |
222 | |
221 | |
223 | if (show_version) |
222 | if (show_version) |
224 | { |
223 | { |
225 | printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), |
224 | printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), |
226 | VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); |
225 | VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); |
|
|
226 | printf (_("Built with kernel interface %s/%s.\n"), IFTYPE, IFSUBTYPE); |
227 | printf (_ |
227 | printf (_ |
228 | ("Copyright (C) 2003 Marc Lehmann <vpe@plan9.de> and others.\n" |
228 | ("Copyright (C) 2003 Marc Lehmann <vpe@plan9.de> and others.\n" |
229 | "See the AUTHORS file for a complete list.\n\n" |
229 | "See the AUTHORS file for a complete list.\n\n" |
230 | "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" |
230 | "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" |
231 | "and you are welcome to redistribute it under certain conditions;\n" |
231 | "and you are welcome to redistribute it under certain conditions;\n" |
… | |
… | |
239 | |
239 | |
240 | log_to (LOGTO_SYSLOG | LOGTO_STDERR); |
240 | log_to (LOGTO_SYSLOG | LOGTO_STDERR); |
241 | |
241 | |
242 | /* Lock all pages into memory if requested */ |
242 | /* Lock all pages into memory if requested */ |
243 | |
243 | |
244 | #if HAVE_MLOCKALL && HAVE_SYS_MMAN_H |
244 | #if HAVE_MLOCKALL && HAVE_SYS_MMAN_H && _POSIX_MEMLOCK |
245 | if (do_mlock) |
245 | if (do_mlock) |
246 | if (mlockall (MCL_CURRENT | MCL_FUTURE)) |
246 | if (mlockall (MCL_CURRENT | MCL_FUTURE)) |
247 | slog (L_ERR, _("system call `%s' failed: %s"), "mlockall", strerror (errno)); |
247 | slog (L_ERR, _("system call `%s' failed: %s"), "mlockall", strerror (errno)); |
248 | #endif |
248 | #endif |
249 | |
249 | |