… | |
… | |
33 | #include <signal.h> |
33 | #include <signal.h> |
34 | #include <termios.h> |
34 | #include <termios.h> |
35 | |
35 | |
36 | #include <sys/mman.h> |
36 | #include <sys/mman.h> |
37 | |
37 | |
|
|
38 | #include <openssl/err.h> |
38 | #include <openssl/rand.h> |
39 | #include <openssl/rand.h> |
39 | |
40 | |
40 | #include "gettext.h" |
41 | #include "gettext.h" |
41 | #include "pidfile.h" |
42 | #include "pidfile.h" |
42 | |
43 | |
43 | #include "conf.h" |
44 | #include "conf.h" |
44 | #include "slog.h" |
45 | #include "slog.h" |
45 | #include "util.h" |
46 | #include "util.h" |
46 | #include "protocol.h" |
47 | #include "vpn.h" |
47 | #include "iom.h" |
48 | #include "iom.h" |
48 | |
49 | |
49 | vpn network; |
50 | vpn network; |
50 | |
51 | |
51 | static loglevel llevel = L_NONE; |
52 | static loglevel llevel = L_NONE; |
… | |
… | |
180 | } |
181 | } |
181 | |
182 | |
182 | RETSIGTYPE |
183 | RETSIGTYPE |
183 | sigusr1_handler (int a) |
184 | sigusr1_handler (int a) |
184 | { |
185 | { |
|
|
186 | network.dump_status (); |
185 | } |
187 | } |
186 | |
188 | |
187 | RETSIGTYPE |
189 | RETSIGTYPE |
188 | sigusr2_handler (int a) |
190 | sigusr2_handler (int a) |
189 | { |
191 | { |
… | |
… | |
199 | |
201 | |
200 | act.sa_handler = sighup_handler; sigaction (SIGHUP , &act, NULL); |
202 | act.sa_handler = sighup_handler; sigaction (SIGHUP , &act, NULL); |
201 | act.sa_handler = sigusr1_handler; sigaction (SIGUSR1, &act, NULL); |
203 | act.sa_handler = sigusr1_handler; sigaction (SIGUSR1, &act, NULL); |
202 | act.sa_handler = sigusr2_handler; sigaction (SIGUSR2, &act, NULL); |
204 | act.sa_handler = sigusr2_handler; sigaction (SIGUSR2, &act, NULL); |
203 | act.sa_handler = SIG_IGN; sigaction (SIGCHLD, &act, NULL); |
205 | act.sa_handler = SIG_IGN; sigaction (SIGCHLD, &act, NULL); |
|
|
206 | act.sa_handler = SIG_IGN; sigaction (SIGPIPE, &act, NULL); |
204 | act.sa_flags = SA_RESETHAND; |
207 | act.sa_flags = SA_RESETHAND; |
205 | act.sa_handler = sigterm_handler; sigaction (SIGINT , &act, NULL); |
208 | act.sa_handler = sigterm_handler; sigaction (SIGINT , &act, NULL); |
206 | act.sa_handler = sigterm_handler; sigaction (SIGTERM, &act, NULL); |
209 | act.sa_handler = sigterm_handler; sigaction (SIGTERM, &act, NULL); |
207 | } |
210 | } |
208 | |
211 | |
209 | int |
212 | int |
210 | main (int argc, char **argv, char **envp) |
213 | main (int argc, char **argv, char **envp) |
211 | { |
214 | { |
|
|
215 | ERR_load_crypto_strings (); // we have the RAM |
|
|
216 | |
212 | set_loglevel (L_INFO); |
217 | set_loglevel (L_INFO); |
213 | set_identity (argv[0]); |
218 | set_identity (argv[0]); |
214 | log_to (LOGTO_SYSLOG | LOGTO_STDERR); |
219 | log_to (LOGTO_SYSLOG | LOGTO_STDERR); |
215 | |
220 | |
216 | setlocale (LC_ALL, ""); |
221 | setlocale (LC_ALL, ""); |
… | |
… | |
219 | |
224 | |
220 | parse_options (argc, argv, envp); |
225 | parse_options (argc, argv, envp); |
221 | |
226 | |
222 | if (show_version) |
227 | if (show_version) |
223 | { |
228 | { |
224 | printf (_("%s version %s (built %s %s, protocol %d:%d)\n"), get_identity (), |
229 | printf (_("%s version %s (built %s %s, protocol %d.%d)\n"), get_identity (), |
225 | VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); |
230 | VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR); |
226 | printf (_ |
231 | printf (_ |
227 | ("Copyright (C) 2003 Marc Lehmann <vpe@plan9.de> and others.\n" |
232 | ("Copyright (C) 2003 Marc Lehmann <vpe@plan9.de> and others.\n" |
228 | "See the AUTHORS file for a complete list.\n\n" |
233 | "See the AUTHORS file for a complete list.\n\n" |
229 | "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" |
234 | "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" |