… | |
… | |
113 | default_node.udp_port = DEFAULT_UDPPORT; |
113 | default_node.udp_port = DEFAULT_UDPPORT; |
114 | default_node.tcp_port = DEFAULT_UDPPORT; // ehrm |
114 | default_node.tcp_port = DEFAULT_UDPPORT; // ehrm |
115 | default_node.connectmode = conf_node::C_ALWAYS; |
115 | default_node.connectmode = conf_node::C_ALWAYS; |
116 | default_node.compress = true; |
116 | default_node.compress = true; |
117 | default_node.protocols = PROT_UDPv4; |
117 | default_node.protocols = PROT_UDPv4; |
|
|
118 | default_node.max_retry = DEFAULT_MAX_RETRY; |
|
|
119 | |
|
|
120 | conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid"); |
118 | } |
121 | } |
119 | |
122 | |
120 | void configuration::cleanup() |
123 | void configuration::cleanup() |
121 | { |
124 | { |
122 | if (rsa_key) |
125 | if (rsa_key) |
… | |
… | |
161 | char *fname; |
164 | char *fname; |
162 | FILE *f; |
165 | FILE *f; |
163 | |
166 | |
164 | clear_config (); |
167 | clear_config (); |
165 | |
168 | |
166 | asprintf (&fname, "%s/vped.conf", confbase); |
169 | asprintf (&fname, "%s/gvpe.conf", confbase); |
167 | f = fopen (fname, "r"); |
170 | f = fopen (fname, "r"); |
168 | |
171 | |
169 | if (f) |
172 | if (f) |
170 | { |
173 | { |
171 | char line[16384]; |
174 | char line[16384]; |
… | |
… | |
336 | node->tcp_port = atoi (val); |
339 | node->tcp_port = atoi (val); |
337 | else if (!strcmp (var, "dns-port")) |
340 | else if (!strcmp (var, "dns-port")) |
338 | node->dns_port = atoi (val); |
341 | node->dns_port = atoi (val); |
339 | else if (!strcmp (var, "router-priority")) |
342 | else if (!strcmp (var, "router-priority")) |
340 | node->routerprio = atoi (val); |
343 | node->routerprio = atoi (val); |
|
|
344 | else if (!strcmp (var, "max-retry")) |
|
|
345 | node->max_retry = atoi (val); |
341 | else if (!strcmp (var, "connect")) |
346 | else if (!strcmp (var, "connect")) |
342 | { |
347 | { |
343 | if (!strcmp (val, "ondemand")) |
348 | if (!strcmp (val, "ondemand")) |
344 | node->connectmode = conf_node::C_ONDEMAND; |
349 | node->connectmode = conf_node::C_ONDEMAND; |
345 | else if (!strcmp (val, "never")) |
350 | else if (!strcmp (val, "never")) |
… | |
… | |
348 | node->connectmode = conf_node::C_ALWAYS; |
353 | node->connectmode = conf_node::C_ALWAYS; |
349 | else if (!strcmp (val, "disabled")) |
354 | else if (!strcmp (val, "disabled")) |
350 | node->connectmode = conf_node::C_DISABLED; |
355 | node->connectmode = conf_node::C_DISABLED; |
351 | else |
356 | else |
352 | slog (L_WARN, |
357 | slog (L_WARN, |
353 | _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), |
358 | _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), |
354 | var, fname, lineno); |
359 | var, fname, lineno); |
355 | } |
360 | } |
356 | else if (!strcmp (var, "inherit-tos")) |
361 | else if (!strcmp (var, "inherit-tos")) |
357 | { |
362 | { |
358 | parse_bool (node->inherit_tos, "inherit-tos", true, false); |
363 | parse_bool (node->inherit_tos, "inherit-tos", true, false); |
359 | } |
364 | } |
… | |
… | |
483 | printf ("\n"); |
488 | printf ("\n"); |
484 | } |
489 | } |
485 | |
490 | |
486 | configuration::configuration () |
491 | configuration::configuration () |
487 | { |
492 | { |
|
|
493 | asprintf (&confbase, "%s/gvpe", CONFDIR); |
|
|
494 | |
488 | init (); |
495 | init (); |
489 | } |
496 | } |
490 | |
497 | |
491 | configuration::~configuration () |
498 | configuration::~configuration () |
492 | { |
499 | { |