… | |
… | |
93 | if (rsa_key) |
93 | if (rsa_key) |
94 | RSA_free (rsa_key); |
94 | RSA_free (rsa_key); |
95 | |
95 | |
96 | free (nodename); |
96 | free (nodename); |
97 | free (hostname); |
97 | free (hostname); |
|
|
98 | #if ENABLE_DNS |
98 | free (domain); |
99 | free (domain); |
|
|
100 | free (dns_hostname); |
|
|
101 | #endif |
99 | } |
102 | } |
100 | |
103 | |
101 | void configuration::init () |
104 | void configuration::init () |
102 | { |
105 | { |
103 | memset (this, 0, sizeof (*this)); |
106 | memset (this, 0, sizeof (*this)); |
… | |
… | |
115 | default_node.tcp_port = DEFAULT_UDPPORT; // ehrm |
118 | default_node.tcp_port = DEFAULT_UDPPORT; // ehrm |
116 | default_node.connectmode = conf_node::C_ALWAYS; |
119 | default_node.connectmode = conf_node::C_ALWAYS; |
117 | default_node.compress = true; |
120 | default_node.compress = true; |
118 | default_node.protocols = 0; |
121 | default_node.protocols = 0; |
119 | default_node.max_retry = DEFAULT_MAX_RETRY; |
122 | default_node.max_retry = DEFAULT_MAX_RETRY; |
|
|
123 | |
|
|
124 | #if ENABLE_DNS |
|
|
125 | default_node.dns_port = 53; |
|
|
126 | dns_forw_port = 53; |
|
|
127 | #endif |
120 | |
128 | |
121 | conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid"); |
129 | conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid"); |
122 | } |
130 | } |
123 | |
131 | |
124 | void configuration::cleanup() |
132 | void configuration::cleanup() |
… | |
… | |
311 | free (script_node_up), script_node_up = strdup (val); |
319 | free (script_node_up), script_node_up = strdup (val); |
312 | else if (!strcmp (var, "node-down")) |
320 | else if (!strcmp (var, "node-down")) |
313 | free (script_node_down), script_node_down = strdup (val); |
321 | free (script_node_down), script_node_down = strdup (val); |
314 | else if (!strcmp (var, "pid-file")) |
322 | else if (!strcmp (var, "pid-file")) |
315 | free (pidfilename), pidfilename = strdup (val); |
323 | free (pidfilename), pidfilename = strdup (val); |
|
|
324 | #if ENABLE_DNS |
316 | else if (!strcmp (var, "dns-forw-host")) |
325 | else if (!strcmp (var, "dns-forw-host")) |
317 | { |
|
|
318 | #if ENABLE_DNS |
|
|
319 | free (dns_forw_host), dns_forw_host = strdup (val); |
326 | free (dns_forw_host), dns_forw_host = strdup (val); |
320 | #endif |
|
|
321 | } |
|
|
322 | else if (!strcmp (var, "dns-forw-port")) |
327 | else if (!strcmp (var, "dns-forw-port")) |
323 | { |
|
|
324 | #if ENABLE_DNS |
|
|
325 | dns_forw_port = atoi (val); |
328 | dns_forw_port = atoi (val); |
326 | #endif |
329 | #endif |
327 | } |
|
|
328 | else if (!strcmp (var, "http-proxy-host")) |
330 | else if (!strcmp (var, "http-proxy-host")) |
329 | { |
331 | { |
330 | #if ENABLE_HTTP_PROXY |
332 | #if ENABLE_HTTP_PROXY |
331 | free (proxy_host), proxy_host = strdup (val); |
333 | free (proxy_host), proxy_host = strdup (val); |
332 | #endif |
334 | #endif |
… | |
… | |
351 | /* node-specific, defaultable */ |
353 | /* node-specific, defaultable */ |
352 | else if (!strcmp (var, "udp-port")) |
354 | else if (!strcmp (var, "udp-port")) |
353 | node->udp_port = atoi (val); |
355 | node->udp_port = atoi (val); |
354 | else if (!strcmp (var, "tcp-port")) |
356 | else if (!strcmp (var, "tcp-port")) |
355 | node->tcp_port = atoi (val); |
357 | node->tcp_port = atoi (val); |
|
|
358 | #if ENABLE_DNS |
|
|
359 | else if (!strcmp (var, "dns-hostname")) |
|
|
360 | free (node->dns_hostname), node->dns_hostname = strdup (val); |
356 | else if (!strcmp (var, "dns-port")) |
361 | else if (!strcmp (var, "dns-port")) |
357 | { |
|
|
358 | #if ENABLE_DNS |
|
|
359 | node->dns_port = atoi (val); |
362 | node->dns_port = atoi (val); |
360 | #endif |
363 | #endif |
361 | } |
|
|
362 | else if (!strcmp (var, "dns-domain")) |
364 | else if (!strcmp (var, "dns-domain")) |
363 | { |
365 | { |
364 | #if ENABLE_DNS |
366 | #if ENABLE_DNS |
365 | free (node->domain), node->domain = strdup (val); |
367 | free (node->domain), node->domain = strdup (val); |
366 | #endif |
368 | #endif |