summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2013-01-07 20:01:26 +0100
committerKozlov Dmitry <xeb@mail.ru>2013-01-25 00:11:54 +0400
commite7d09a09b377e0b778958d156a3047337aefc6f8 (patch)
treed0ad827b3cd853226a70b7a22806af01b081a66e
parentc82eec497ff2e5338c9e811765ca28e4105fb515 (diff)
downloadaccel-ppp-e7d09a09b377e0b778958d156a3047337aefc6f8.tar.gz
accel-ppp-e7d09a09b377e0b778958d156a3047337aefc6f8.zip
Fix boolean options parsing in configuration file
Explicitely interpret zero values when parsing boolean options. This allows to unset boolean parameters such as "verbose" when reloading the configuration. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c8
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c6
-rw-r--r--accel-pppd/ppp/ipcp_opt_ipaddr.c4
-rw-r--r--accel-pppd/ppp/ipv6cp_opt_intfid.c6
-rw-r--r--accel-pppd/ppp/ppp.c4
-rw-r--r--accel-pppd/radius/radius.c12
-rw-r--r--accel-pppd/shaper/shaper.c6
7 files changed, 23 insertions, 23 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index dd8b81bb..15887972 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1612,12 +1612,12 @@ static void load_config(void)
const char *opt;
opt = conf_get_opt("l2tp", "verbose");
- if (opt && atoi(opt) > 0)
- conf_verbose = 1;
+ if (opt && atoi(opt) >= 0)
+ conf_verbose = atoi(opt) > 0;
opt = conf_get_opt("l2tp", "avp_permissive");
- if (opt && atoi(opt) > 0)
- conf_avp_permissive = 1;
+ if (opt && atoi(opt) >= 0)
+ conf_avp_permissive = atoi(opt) > 0;
opt = conf_get_opt("l2tp", "hello-interval");
if (opt && atoi(opt) > 0)
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index c00f29ff..e735c72c 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -744,9 +744,9 @@ static void load_config(void)
conf_echo_failure = atoi(opt);
opt = conf_get_opt("pptp", "verbose");
- if (opt && atoi(opt) > 0)
- conf_verbose = 1;
-
+ if (opt && atoi(opt) >= 0)
+ conf_verbose = atoi(opt) > 0;
+
conf_mppe = MPPE_UNSET;
opt = conf_get_opt("pptp", "mppe");
if (opt) {
diff --git a/accel-pppd/ppp/ipcp_opt_ipaddr.c b/accel-pppd/ppp/ipcp_opt_ipaddr.c
index 44dd3ddd..e5246d55 100644
--- a/accel-pppd/ppp/ipcp_opt_ipaddr.c
+++ b/accel-pppd/ppp/ipcp_opt_ipaddr.c
@@ -177,8 +177,8 @@ static void load_config(void)
const char *opt;
opt = conf_get_opt("ppp", "check-ip");
- if (opt && atoi(opt) > 0)
- conf_check_exists = 1;
+ if (opt && atoi(opt) >= 0)
+ conf_check_exists = atoi(opt) > 0;
}
static void ipaddr_opt_init()
diff --git a/accel-pppd/ppp/ipv6cp_opt_intfid.c b/accel-pppd/ppp/ipv6cp_opt_intfid.c
index 21f0b931..a46ae17c 100644
--- a/accel-pppd/ppp/ipv6cp_opt_intfid.c
+++ b/accel-pppd/ppp/ipv6cp_opt_intfid.c
@@ -284,9 +284,9 @@ static void load_config(void)
const char *opt;
opt = conf_get_opt("ppp", "check-ip");
- if (opt && atoi(opt) > 0)
- conf_check_exists = 1;
-
+ if (opt && atoi(opt) >= 0)
+ conf_check_exists = atoi(opt) > 0;
+
opt = conf_get_opt("ppp", "ipv6-intf-id");
if (opt) {
if (!strcmp(opt, "random"))
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c
index f5877edb..53630946 100644
--- a/accel-pppd/ppp/ppp.c
+++ b/accel-pppd/ppp/ppp.c
@@ -595,8 +595,8 @@ static void load_config(void)
const char *opt;
opt = conf_get_opt("ppp", "verbose");
- if (opt && atoi(opt) > 0)
- conf_ppp_verbose = 1;
+ if (opt && atoi(opt) >= 0)
+ conf_ppp_verbose = atoi(opt) > 0;
opt = conf_get_opt("ppp", "unit-cache");
if (opt && atoi(opt) > 0)
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 5313fe18..bae5876f 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -542,13 +542,13 @@ static int load_config(void)
conf_acct_timeout = atoi(opt);
opt = conf_get_opt("radius", "verbose");
- if (opt && atoi(opt) > 0)
- conf_verbose = 1;
-
+ if (opt && atoi(opt) >= 0)
+ conf_verbose = atoi(opt) > 0;
+
opt = conf_get_opt("radius", "interim-verbose");
- if (opt && atoi(opt) > 0)
- conf_interim_verbose = 1;
-
+ if (opt && atoi(opt) >= 0)
+ conf_interim_verbose = atoi(opt) > 0;
+
opt = conf_get_opt("radius", "nas-ip-address");
if (opt)
conf_nas_ip_address = inet_addr(opt);
diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c
index 2b749c9b..d5a376b7 100644
--- a/accel-pppd/shaper/shaper.c
+++ b/accel-pppd/shaper/shaper.c
@@ -908,9 +908,9 @@ static void load_config(void)
opt = conf_get_opt("shaper", "verbose");
- if (opt && atoi(opt) > 0)
- conf_verbose = 1;
-
+ if (opt && atoi(opt) >= 0)
+ conf_verbose = atoi(opt) > 0;
+
triton_context_call(&shaper_ctx, (triton_event_func)load_time_ranges, NULL);
}