--- gvpe/src/conf.C 2005/03/05 15:48:54 1.32 +++ gvpe/src/conf.C 2005/03/23 14:33:34 1.37 @@ -39,8 +39,6 @@ #include #include -#include "gettext.h" - #include "conf.h" #include "slog.h" #include "util.h" @@ -125,6 +123,7 @@ #if ENABLE_DNS default_node.dns_port = 0; // default is 0 == client + dns_forw_host = strdup ("127.0.0.1"); dns_forw_port = 53; #endif @@ -161,8 +160,8 @@ init (); } -#define parse_bool(target,name,trueval,falseval) \ - if (!strcmp (val, "yes")) target = trueval; \ +#define parse_bool(target,name,trueval,falseval) do { \ + if (!strcmp (val, "yes")) target = trueval; \ else if (!strcmp (val, "no")) target = falseval; \ else if (!strcmp (val, "true")) target = trueval; \ else if (!strcmp (val, "false")) target = falseval; \ @@ -171,7 +170,8 @@ else \ slog (L_WARN, \ _("illegal value for '%s', only 'yes|true|on' or 'no|false|off' allowed, at '%s' line %d"), \ - name, var, fname, lineno); + name, var, fname, lineno); \ +} while (0) void configuration::read_config (bool need_keys) { @@ -220,9 +220,9 @@ if (!val || val[0] == '#') { slog (L_WARN, - _("no value for variable `%s', at '%s' line %d"), + _("no value for variable `%s', at '%s' line %d, skipping."), var, fname, lineno); - break; + continue; } if (!strcmp (var, "on")) @@ -304,9 +304,7 @@ else if (!strcmp (var, "private-key")) free (prikeyfile), prikeyfile = strdup (val); else if (!strcmp (var, "ifpersist")) - { - parse_bool (ifpersist, "ifpersist", true, false); - } + parse_bool (ifpersist, "ifpersist", true, false); else if (!strcmp (var, "ifname")) free (ifname), ifname = strdup (val); else if (!strcmp (var, "rekey")) @@ -323,12 +321,18 @@ free (script_node_down), script_node_down = strdup (val); else if (!strcmp (var, "pid-file")) free (pidfilename), pidfilename = strdup (val); -#if ENABLE_DNS else if (!strcmp (var, "dns-forw-host")) - free (dns_forw_host), dns_forw_host = strdup (val); + { +#if ENABLE_DNS + free (dns_forw_host), dns_forw_host = strdup (val); +#endif + } else if (!strcmp (var, "dns-forw-port")) - dns_forw_port = atoi (val); + { +#if ENABLE_DNS + dns_forw_port = atoi (val); #endif + } else if (!strcmp (var, "http-proxy-host")) { #if ENABLE_HTTP_PROXY @@ -357,12 +361,18 @@ node->udp_port = atoi (val); else if (!strcmp (var, "tcp-port")) node->tcp_port = atoi (val); -#if ENABLE_DNS else if (!strcmp (var, "dns-hostname")) - free (node->dns_hostname), node->dns_hostname = strdup (val); + { +#if ENABLE_DNS + free (node->dns_hostname), node->dns_hostname = strdup (val); +#endif + } else if (!strcmp (var, "dns-port")) - node->dns_port = atoi (val); + { +#if ENABLE_DNS + node->dns_port = atoi (val); #endif + } else if (!strcmp (var, "dns-domain")) { #if ENABLE_DNS @@ -385,17 +395,13 @@ node->connectmode = conf_node::C_DISABLED; else slog (L_WARN, - _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), + _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d, ignoring."), var, fname, lineno); } else if (!strcmp (var, "inherit-tos")) - { - parse_bool (node->inherit_tos, "inherit-tos", true, false); - } + parse_bool (node->inherit_tos, "inherit-tos", true, false); else if (!strcmp (var, "compress")) - { - parse_bool (node->compress, "compress", true, false); - } + parse_bool (node->compress, "compress", true, false); // all these bool options really really cost a lot of executable size! else if (!strcmp (var, "enable-tcp")) { @@ -427,7 +433,7 @@ // unknown or misplaced else slog (L_WARN, - _("unknown or misplaced variable `%s', at '%s' line %d"), + _("unknown or misplaced variable `%s', at '%s' line %d, skipping."), var, fname, lineno); }