ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/conf.C
(Generate patch)

Comparing gvpe/src/conf.C (file contents):
Revision 1.31 by pcg, Thu Mar 3 16:54:34 2005 UTC vs.
Revision 1.36 by pcg, Sun Mar 20 02:34:16 2005 UTC

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
48char *confbase; 46char *confbase;
122 default_node.compress = true; 120 default_node.compress = true;
123 default_node.protocols = 0; 121 default_node.protocols = 0;
124 default_node.max_retry = DEFAULT_MAX_RETRY; 122 default_node.max_retry = DEFAULT_MAX_RETRY;
125 123
126#if ENABLE_DNS 124#if ENABLE_DNS
127 default_node.dns_port = 53; 125 default_node.dns_port = 0; // default is 0 == client
126 dns_forw_host = strdup ("127.0.0.1");
128 dns_forw_port = 53; 127 dns_forw_port = 53;
129#endif 128#endif
130 129
131 conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid"); 130 conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid");
132} 131}
218 val = strtok (NULL, "\t\n\r ="); 217 val = strtok (NULL, "\t\n\r =");
219 218
220 if (!val || val[0] == '#') 219 if (!val || val[0] == '#')
221 { 220 {
222 slog (L_WARN, 221 slog (L_WARN,
223 _("no value for variable `%s', at '%s' line %d"), 222 _("no value for variable `%s', at '%s' line %d, skipping."),
224 var, fname, lineno); 223 var, fname, lineno);
225 break; 224 continue;
226 } 225 }
227 226
228 if (!strcmp (var, "on")) 227 if (!strcmp (var, "on"))
229 { 228 {
230 if (!::thisnode 229 if (!::thisnode
302 thisnode = node; 301 thisnode = node;
303 } 302 }
304 else if (!strcmp (var, "private-key")) 303 else if (!strcmp (var, "private-key"))
305 free (prikeyfile), prikeyfile = strdup (val); 304 free (prikeyfile), prikeyfile = strdup (val);
306 else if (!strcmp (var, "ifpersist")) 305 else if (!strcmp (var, "ifpersist"))
307 {
308 parse_bool (ifpersist, "ifpersist", true, false); 306 parse_bool (ifpersist, "ifpersist", true, false);
309 }
310 else if (!strcmp (var, "ifname")) 307 else if (!strcmp (var, "ifname"))
311 free (ifname), ifname = strdup (val); 308 free (ifname), ifname = strdup (val);
312 else if (!strcmp (var, "rekey")) 309 else if (!strcmp (var, "rekey"))
313 rekey = atoi (val); 310 rekey = atoi (val);
314 else if (!strcmp (var, "keepalive")) 311 else if (!strcmp (var, "keepalive"))
321 free (script_node_up), script_node_up = strdup (val); 318 free (script_node_up), script_node_up = strdup (val);
322 else if (!strcmp (var, "node-down")) 319 else if (!strcmp (var, "node-down"))
323 free (script_node_down), script_node_down = strdup (val); 320 free (script_node_down), script_node_down = strdup (val);
324 else if (!strcmp (var, "pid-file")) 321 else if (!strcmp (var, "pid-file"))
325 free (pidfilename), pidfilename = strdup (val); 322 free (pidfilename), pidfilename = strdup (val);
326#if ENABLE_DNS
327 else if (!strcmp (var, "dns-forw-host")) 323 else if (!strcmp (var, "dns-forw-host"))
324 {
325#if ENABLE_DNS
328 free (dns_forw_host), dns_forw_host = strdup (val); 326 free (dns_forw_host), dns_forw_host = strdup (val);
327#endif
328 }
329 else if (!strcmp (var, "dns-forw-port")) 329 else if (!strcmp (var, "dns-forw-port"))
330 {
331#if ENABLE_DNS
330 dns_forw_port = atoi (val); 332 dns_forw_port = atoi (val);
331#endif 333#endif
334 }
332 else if (!strcmp (var, "http-proxy-host")) 335 else if (!strcmp (var, "http-proxy-host"))
333 { 336 {
334#if ENABLE_HTTP_PROXY 337#if ENABLE_HTTP_PROXY
335 free (proxy_host), proxy_host = strdup (val); 338 free (proxy_host), proxy_host = strdup (val);
336#endif 339#endif
355 /* node-specific, defaultable */ 358 /* node-specific, defaultable */
356 else if (!strcmp (var, "udp-port")) 359 else if (!strcmp (var, "udp-port"))
357 node->udp_port = atoi (val); 360 node->udp_port = atoi (val);
358 else if (!strcmp (var, "tcp-port")) 361 else if (!strcmp (var, "tcp-port"))
359 node->tcp_port = atoi (val); 362 node->tcp_port = atoi (val);
360#if ENABLE_DNS
361 else if (!strcmp (var, "dns-hostname")) 363 else if (!strcmp (var, "dns-hostname"))
364 {
365#if ENABLE_DNS
362 free (node->dns_hostname), node->dns_hostname = strdup (val); 366 free (node->dns_hostname), node->dns_hostname = strdup (val);
367#endif
368 }
363 else if (!strcmp (var, "dns-port")) 369 else if (!strcmp (var, "dns-port"))
370 {
371#if ENABLE_DNS
364 node->dns_port = atoi (val); 372 node->dns_port = atoi (val);
365#endif 373#endif
374 }
366 else if (!strcmp (var, "dns-domain")) 375 else if (!strcmp (var, "dns-domain"))
367 { 376 {
368#if ENABLE_DNS 377#if ENABLE_DNS
369 free (node->domain), node->domain = strdup (val); 378 free (node->domain), node->domain = strdup (val);
370#endif 379#endif
383 node->connectmode = conf_node::C_ALWAYS; 392 node->connectmode = conf_node::C_ALWAYS;
384 else if (!strcmp (val, "disabled")) 393 else if (!strcmp (val, "disabled"))
385 node->connectmode = conf_node::C_DISABLED; 394 node->connectmode = conf_node::C_DISABLED;
386 else 395 else
387 slog (L_WARN, 396 slog (L_WARN,
388 _("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."),
389 var, fname, lineno); 398 var, fname, lineno);
390 } 399 }
391 else if (!strcmp (var, "inherit-tos")) 400 else if (!strcmp (var, "inherit-tos"))
392 {
393 parse_bool (node->inherit_tos, "inherit-tos", true, false); 401 parse_bool (node->inherit_tos, "inherit-tos", true, false);
394 }
395 else if (!strcmp (var, "compress")) 402 else if (!strcmp (var, "compress"))
396 {
397 parse_bool (node->compress, "compress", true, false); 403 parse_bool (node->compress, "compress", true, false);
398 }
399 // 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!
400 else if (!strcmp (var, "enable-tcp")) 405 else if (!strcmp (var, "enable-tcp"))
401 { 406 {
402#if ENABLE_TCP 407#if ENABLE_TCP
403 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;
425 } 430 }
426 431
427 // unknown or misplaced 432 // unknown or misplaced
428 else 433 else
429 slog (L_WARN, 434 slog (L_WARN,
430 _("unknown or misplaced variable `%s', at '%s' line %d"), 435 _("unknown or misplaced variable `%s', at '%s' line %d, skipping."),
431 var, fname, lineno); 436 var, fname, lineno);
432 } 437 }
433 438
434 fclose (f); 439 fclose (f);
435 } 440 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines