… | |
… | |
37 | #include <openssl/pem.h> |
37 | #include <openssl/pem.h> |
38 | #include <openssl/rsa.h> |
38 | #include <openssl/rsa.h> |
39 | #include <openssl/rand.h> |
39 | #include <openssl/rand.h> |
40 | #include <openssl/bn.h> |
40 | #include <openssl/bn.h> |
41 | |
41 | |
42 | #include "gettext.h" |
|
|
43 | |
|
|
44 | #include "conf.h" |
42 | #include "conf.h" |
45 | #include "slog.h" |
43 | #include "slog.h" |
46 | #include "util.h" |
44 | #include "util.h" |
47 | |
45 | |
48 | char *confbase; |
46 | char *confbase; |
… | |
… | |
219 | val = strtok (NULL, "\t\n\r ="); |
217 | val = strtok (NULL, "\t\n\r ="); |
220 | |
218 | |
221 | if (!val || val[0] == '#') |
219 | if (!val || val[0] == '#') |
222 | { |
220 | { |
223 | slog (L_WARN, |
221 | slog (L_WARN, |
224 | _("no value for variable `%s', at '%s' line %d"), |
222 | _("no value for variable `%s', at '%s' line %d, skipping."), |
225 | var, fname, lineno); |
223 | var, fname, lineno); |
226 | break; |
224 | continue; |
227 | } |
225 | } |
228 | |
226 | |
229 | if (!strcmp (var, "on")) |
227 | if (!strcmp (var, "on")) |
230 | { |
228 | { |
231 | if (!::thisnode |
229 | if (!::thisnode |
… | |
… | |
303 | thisnode = node; |
301 | thisnode = node; |
304 | } |
302 | } |
305 | else if (!strcmp (var, "private-key")) |
303 | else if (!strcmp (var, "private-key")) |
306 | free (prikeyfile), prikeyfile = strdup (val); |
304 | free (prikeyfile), prikeyfile = strdup (val); |
307 | else if (!strcmp (var, "ifpersist")) |
305 | else if (!strcmp (var, "ifpersist")) |
308 | { |
|
|
309 | parse_bool (ifpersist, "ifpersist", true, false); |
306 | parse_bool (ifpersist, "ifpersist", true, false); |
310 | } |
|
|
311 | else if (!strcmp (var, "ifname")) |
307 | else if (!strcmp (var, "ifname")) |
312 | free (ifname), ifname = strdup (val); |
308 | free (ifname), ifname = strdup (val); |
313 | else if (!strcmp (var, "rekey")) |
309 | else if (!strcmp (var, "rekey")) |
314 | rekey = atoi (val); |
310 | rekey = atoi (val); |
315 | else if (!strcmp (var, "keepalive")) |
311 | else if (!strcmp (var, "keepalive")) |
… | |
… | |
396 | node->connectmode = conf_node::C_ALWAYS; |
392 | node->connectmode = conf_node::C_ALWAYS; |
397 | else if (!strcmp (val, "disabled")) |
393 | else if (!strcmp (val, "disabled")) |
398 | node->connectmode = conf_node::C_DISABLED; |
394 | node->connectmode = conf_node::C_DISABLED; |
399 | else |
395 | else |
400 | slog (L_WARN, |
396 | slog (L_WARN, |
401 | _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), |
397 | _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d, ignoring."), |
402 | var, fname, lineno); |
398 | var, fname, lineno); |
403 | } |
399 | } |
404 | else if (!strcmp (var, "inherit-tos")) |
400 | else if (!strcmp (var, "inherit-tos")) |
405 | { |
|
|
406 | parse_bool (node->inherit_tos, "inherit-tos", true, false); |
401 | parse_bool (node->inherit_tos, "inherit-tos", true, false); |
407 | } |
|
|
408 | else if (!strcmp (var, "compress")) |
402 | else if (!strcmp (var, "compress")) |
409 | { |
|
|
410 | parse_bool (node->compress, "compress", true, false); |
403 | parse_bool (node->compress, "compress", true, false); |
411 | } |
|
|
412 | // all these bool options really really cost a lot of executable size! |
404 | // all these bool options really really cost a lot of executable size! |
413 | else if (!strcmp (var, "enable-tcp")) |
405 | else if (!strcmp (var, "enable-tcp")) |
414 | { |
406 | { |
415 | #if ENABLE_TCP |
407 | #if ENABLE_TCP |
416 | u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v; |
408 | u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v; |
… | |
… | |
438 | } |
430 | } |
439 | |
431 | |
440 | // unknown or misplaced |
432 | // unknown or misplaced |
441 | else |
433 | else |
442 | slog (L_WARN, |
434 | slog (L_WARN, |
443 | _("unknown or misplaced variable `%s', at '%s' line %d"), |
435 | _("unknown or misplaced variable `%s', at '%s' line %d, skipping."), |
444 | var, fname, lineno); |
436 | var, fname, lineno); |
445 | } |
437 | } |
446 | |
438 | |
447 | fclose (f); |
439 | fclose (f); |
448 | } |
440 | } |