From e7d09a09b377e0b778958d156a3047337aefc6f8 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Mon, 7 Jan 2013 20:01:26 +0100 Subject: 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 --- accel-pppd/ppp/ipcp_opt_ipaddr.c | 4 ++-- accel-pppd/ppp/ipv6cp_opt_intfid.c | 6 +++--- accel-pppd/ppp/ppp.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'accel-pppd/ppp') 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) -- cgit v1.2.3