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.26 by pcg, Wed May 12 13:32:13 2004 UTC vs.
Revision 1.30 by pcg, Thu Mar 3 07:24:57 2005 UTC

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
99 free (domain);
100 free (dns_hostname);
101#endif
98} 102}
99 103
100void configuration::init () 104void configuration::init ()
101{ 105{
102 memset (this, 0, sizeof (*this)); 106 memset (this, 0, sizeof (*this));
112 116
113 default_node.udp_port = DEFAULT_UDPPORT; 117 default_node.udp_port = DEFAULT_UDPPORT;
114 default_node.tcp_port = DEFAULT_UDPPORT; // ehrm 118 default_node.tcp_port = DEFAULT_UDPPORT; // ehrm
115 default_node.connectmode = conf_node::C_ALWAYS; 119 default_node.connectmode = conf_node::C_ALWAYS;
116 default_node.compress = true; 120 default_node.compress = true;
117 default_node.protocols = PROT_UDPv4; 121 default_node.protocols = 0;
122 default_node.max_retry = DEFAULT_MAX_RETRY;
118 123
124#if ENABLE_DNS
125 default_node.dns_port = 53;
126 dns_forw_port = 53;
127#endif
128
119 conf.pidfilename = strdup (LOCALSTATEDIR "/run/vped.pid"); 129 conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid");
120} 130}
121 131
122void configuration::cleanup() 132void configuration::cleanup()
123{ 133{
124 if (rsa_key) 134 if (rsa_key)
125 RSA_free (rsa_key); 135 RSA_free (rsa_key);
126 136
127 rsa_key = 0; 137 rsa_key = 0;
128 138
129 free (pidfilename); pidfilename = 0; 139 free (pidfilename); pidfilename = 0;
130 free (ifname); ifname = 0; 140 free (ifname); ifname = 0;
131#if ENABLE_HTTP_PROXY 141#if ENABLE_HTTP_PROXY
132 free (proxy_host); proxy_host = 0; 142 free (proxy_host); proxy_host = 0;
133 free (proxy_auth); proxy_auth = 0; 143 free (proxy_auth); proxy_auth = 0;
144#endif
145#if ENABLE_DNS
146 free (dns_forw_host); dns_forw_host = 0;
134#endif 147#endif
135} 148}
136 149
137void 150void
138configuration::clear_config () 151configuration::clear_config ()
163 char *fname; 176 char *fname;
164 FILE *f; 177 FILE *f;
165 178
166 clear_config (); 179 clear_config ();
167 180
168 asprintf (&fname, "%s/vped.conf", confbase); 181 asprintf (&fname, "%s/gvpe.conf", confbase);
169 f = fopen (fname, "r"); 182 f = fopen (fname, "r");
170 183
171 if (f) 184 if (f)
172 { 185 {
173 char line[16384]; 186 char line[16384];
306 free (script_node_up), script_node_up = strdup (val); 319 free (script_node_up), script_node_up = strdup (val);
307 else if (!strcmp (var, "node-down")) 320 else if (!strcmp (var, "node-down"))
308 free (script_node_down), script_node_down = strdup (val); 321 free (script_node_down), script_node_down = strdup (val);
309 else if (!strcmp (var, "pid-file")) 322 else if (!strcmp (var, "pid-file"))
310 free (pidfilename), pidfilename = strdup (val); 323 free (pidfilename), pidfilename = strdup (val);
324#if ENABLE_DNS
325 else if (!strcmp (var, "dns-forw-host"))
326 free (dns_forw_host), dns_forw_host = strdup (val);
327 else if (!strcmp (var, "dns-forw-port"))
328 dns_forw_port = atoi (val);
329#endif
311 else if (!strcmp (var, "http-proxy-host")) 330 else if (!strcmp (var, "http-proxy-host"))
312 { 331 {
313#if ENABLE_HTTP_PROXY 332#if ENABLE_HTTP_PROXY
314 free (proxy_host), proxy_host = strdup (val); 333 free (proxy_host), proxy_host = strdup (val);
315#endif 334#endif
334 /* node-specific, defaultable */ 353 /* node-specific, defaultable */
335 else if (!strcmp (var, "udp-port")) 354 else if (!strcmp (var, "udp-port"))
336 node->udp_port = atoi (val); 355 node->udp_port = atoi (val);
337 else if (!strcmp (var, "tcp-port")) 356 else if (!strcmp (var, "tcp-port"))
338 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);
339 else if (!strcmp (var, "dns-port")) 361 else if (!strcmp (var, "dns-port"))
340 node->dns_port = atoi (val); 362 node->dns_port = atoi (val);
363#endif
364 else if (!strcmp (var, "dns-domain"))
365 {
366#if ENABLE_DNS
367 free (node->domain), node->domain = strdup (val);
368#endif
369 }
341 else if (!strcmp (var, "router-priority")) 370 else if (!strcmp (var, "router-priority"))
342 node->routerprio = atoi (val); 371 node->routerprio = atoi (val);
372 else if (!strcmp (var, "max-retry"))
373 node->max_retry = atoi (val);
343 else if (!strcmp (var, "connect")) 374 else if (!strcmp (var, "connect"))
344 { 375 {
345 if (!strcmp (val, "ondemand")) 376 if (!strcmp (val, "ondemand"))
346 node->connectmode = conf_node::C_ONDEMAND; 377 node->connectmode = conf_node::C_ONDEMAND;
347 else if (!strcmp (val, "never")) 378 else if (!strcmp (val, "never"))
350 node->connectmode = conf_node::C_ALWAYS; 381 node->connectmode = conf_node::C_ALWAYS;
351 else if (!strcmp (val, "disabled")) 382 else if (!strcmp (val, "disabled"))
352 node->connectmode = conf_node::C_DISABLED; 383 node->connectmode = conf_node::C_DISABLED;
353 else 384 else
354 slog (L_WARN, 385 slog (L_WARN,
355 _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), 386 _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"),
356 var, fname, lineno); 387 var, fname, lineno);
357 } 388 }
358 else if (!strcmp (var, "inherit-tos")) 389 else if (!strcmp (var, "inherit-tos"))
359 { 390 {
360 parse_bool (node->inherit_tos, "inherit-tos", true, false); 391 parse_bool (node->inherit_tos, "inherit-tos", true, false);
361 } 392 }
385 else if (!strcmp (var, "enable-udp")) 416 else if (!strcmp (var, "enable-udp"))
386 { 417 {
387 u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; 418 u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v;
388 } 419 }
389 else if (!strcmp (var, "enable-rawip")) 420 else if (!strcmp (var, "enable-rawip"))
390 {; 421 {
391 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; 422 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v;
392 } 423 }
393 424
394 // unknown or misplaced 425 // unknown or misplaced
395 else 426 else
485 printf ("\n"); 516 printf ("\n");
486} 517}
487 518
488configuration::configuration () 519configuration::configuration ()
489{ 520{
490 asprintf (&confbase, "%s/vpe", CONFDIR); 521 asprintf (&confbase, "%s/gvpe", CONFDIR);
491 522
492 init (); 523 init ();
493} 524}
494 525
495configuration::~configuration () 526configuration::~configuration ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines