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