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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines