… | |
… | |
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 | free (domain); |
98 | } |
99 | } |
99 | |
100 | |
100 | void configuration::init () |
101 | void configuration::init () |
101 | { |
102 | { |
102 | memset (this, 0, sizeof (*this)); |
103 | memset (this, 0, sizeof (*this)); |
… | |
… | |
125 | if (rsa_key) |
126 | if (rsa_key) |
126 | RSA_free (rsa_key); |
127 | RSA_free (rsa_key); |
127 | |
128 | |
128 | rsa_key = 0; |
129 | rsa_key = 0; |
129 | |
130 | |
130 | free (pidfilename); pidfilename = 0; |
131 | free (pidfilename); pidfilename = 0; |
131 | free (ifname); ifname = 0; |
132 | free (ifname); ifname = 0; |
132 | #if ENABLE_HTTP_PROXY |
133 | #if ENABLE_HTTP_PROXY |
133 | free (proxy_host); proxy_host = 0; |
134 | free (proxy_host); proxy_host = 0; |
134 | free (proxy_auth); proxy_auth = 0; |
135 | free (proxy_auth); proxy_auth = 0; |
|
|
136 | #endif |
|
|
137 | #if ENABLE_DNS |
|
|
138 | free (dns_forw_host); dns_forw_host = 0; |
135 | #endif |
139 | #endif |
136 | } |
140 | } |
137 | |
141 | |
138 | void |
142 | void |
139 | configuration::clear_config () |
143 | configuration::clear_config () |
… | |
… | |
307 | free (script_node_up), script_node_up = strdup (val); |
311 | free (script_node_up), script_node_up = strdup (val); |
308 | else if (!strcmp (var, "node-down")) |
312 | else if (!strcmp (var, "node-down")) |
309 | free (script_node_down), script_node_down = strdup (val); |
313 | free (script_node_down), script_node_down = strdup (val); |
310 | else if (!strcmp (var, "pid-file")) |
314 | else if (!strcmp (var, "pid-file")) |
311 | free (pidfilename), pidfilename = strdup (val); |
315 | free (pidfilename), pidfilename = strdup (val); |
|
|
316 | else if (!strcmp (var, "dns-forwarder-host")) |
|
|
317 | { |
|
|
318 | #if ENABLE_DNS |
|
|
319 | free (dns_forw_host), dns_forw_host = strdup (val); |
|
|
320 | #endif |
|
|
321 | } |
|
|
322 | else if (!strcmp (var, "dns-forwarder-port")) |
|
|
323 | { |
|
|
324 | #if ENABLE_DNS |
|
|
325 | dns_forw_port = atoi (val); |
|
|
326 | #endif |
|
|
327 | } |
312 | else if (!strcmp (var, "http-proxy-host")) |
328 | else if (!strcmp (var, "http-proxy-host")) |
313 | { |
329 | { |
314 | #if ENABLE_HTTP_PROXY |
330 | #if ENABLE_HTTP_PROXY |
315 | free (proxy_host), proxy_host = strdup (val); |
331 | free (proxy_host), proxy_host = strdup (val); |
316 | #endif |
332 | #endif |
… | |
… | |
336 | else if (!strcmp (var, "udp-port")) |
352 | else if (!strcmp (var, "udp-port")) |
337 | node->udp_port = atoi (val); |
353 | node->udp_port = atoi (val); |
338 | else if (!strcmp (var, "tcp-port")) |
354 | else if (!strcmp (var, "tcp-port")) |
339 | node->tcp_port = atoi (val); |
355 | node->tcp_port = atoi (val); |
340 | else if (!strcmp (var, "dns-port")) |
356 | else if (!strcmp (var, "dns-port")) |
|
|
357 | { |
|
|
358 | #if ENABLE_DNS |
341 | node->dns_port = atoi (val); |
359 | node->dns_port = atoi (val); |
|
|
360 | #endif |
|
|
361 | } |
|
|
362 | else if (!strcmp (var, "dns-domain")) |
|
|
363 | { |
|
|
364 | #if ENABLE_DNS |
|
|
365 | free (node->domain), node->domain = strdup (val); |
|
|
366 | #endif |
|
|
367 | } |
342 | else if (!strcmp (var, "router-priority")) |
368 | else if (!strcmp (var, "router-priority")) |
343 | node->routerprio = atoi (val); |
369 | node->routerprio = atoi (val); |
344 | else if (!strcmp (var, "max-retry")) |
370 | else if (!strcmp (var, "max-retry")) |
345 | node->max_retry = atoi (val); |
371 | node->max_retry = atoi (val); |
346 | else if (!strcmp (var, "connect")) |
372 | else if (!strcmp (var, "connect")) |
… | |
… | |
388 | else if (!strcmp (var, "enable-udp")) |
414 | else if (!strcmp (var, "enable-udp")) |
389 | { |
415 | { |
390 | u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; |
416 | u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; |
391 | } |
417 | } |
392 | else if (!strcmp (var, "enable-rawip")) |
418 | else if (!strcmp (var, "enable-rawip")) |
393 | {; |
419 | { |
394 | u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; |
420 | u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; |
395 | } |
421 | } |
396 | |
422 | |
397 | // unknown or misplaced |
423 | // unknown or misplaced |
398 | else |
424 | else |