… | |
… | |
45 | #include "util.h" |
45 | #include "util.h" |
46 | #include "protocol.h" |
46 | #include "protocol.h" |
47 | |
47 | |
48 | vpn network; |
48 | vpn network; |
49 | |
49 | |
|
|
50 | static loglevel llevel = L_NONE; |
|
|
51 | |
50 | /* If nonzero, display usage information and exit. */ |
52 | /* If nonzero, display usage information and exit. */ |
51 | static int show_help; |
53 | static int show_help; |
52 | |
54 | |
53 | /* If nonzero, print the version on standard output and exit. */ |
55 | /* If nonzero, print the version on standard output and exit. */ |
54 | static int show_version; |
56 | static int show_version; |
… | |
… | |
126 | break; |
128 | break; |
127 | #endif |
129 | #endif |
128 | |
130 | |
129 | case 'l': /* inc debug level */ |
131 | case 'l': /* inc debug level */ |
130 | { |
132 | { |
131 | loglevel l = string_to_loglevel (optarg); |
133 | llevel = string_to_loglevel (optarg); |
132 | |
134 | |
133 | if (l != L_NONE) |
135 | if (llevel == L_NONE) |
134 | set_loglevel (l); |
|
|
135 | else |
|
|
136 | slog (L_WARN, "'%s': %s", optarg, UNKNOWN_LOGLEVEL); |
136 | slog (L_WARN, "'%s': %s", optarg, UNKNOWN_LOGLEVEL); |
137 | } |
137 | } |
138 | break; |
138 | break; |
139 | |
139 | |
140 | case '?': |
140 | case '?': |
… | |
… | |
244 | #endif |
244 | #endif |
245 | |
245 | |
246 | make_names (); |
246 | make_names (); |
247 | conf.read_config (true); |
247 | conf.read_config (true); |
248 | |
248 | |
|
|
249 | set_loglevel (llevel != L_NONE ? llevel : conf.llevel); |
|
|
250 | |
249 | RAND_load_file ("/dev/urandom", 1024); |
251 | RAND_load_file ("/dev/urandom", 1024); |
250 | |
252 | |
251 | //OpenSSL_add_all_algorithms (); |
253 | if (!thisnode) |
252 | |
|
|
253 | if (!THISNODE) |
|
|
254 | { |
254 | { |
255 | slog (L_ERR, _("current node not set, or node '%s' not found in configfile, use the -n switch when starting vped."), |
255 | slog (L_ERR, _("current node not set, or node '%s' not found in configfile, use the -n switch when starting vped."), |
256 | thisnode ? thisnode : "<unset>"); |
256 | thisnode ? thisnode : "<unset>"); |
257 | exit (1); |
257 | exit (1); |
258 | } |
258 | } |