From d682a0aa8a142b0213a352b0057572fd1a3b76a4 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Wed, 11 May 2016 13:13:07 +0200 Subject: iprange: warn before disabling module due to /0 network with non-null IP Using a /0 prefix on an IP different from 0.0.0.0 is valid, but might be a configuration mistake. Log warning message in this case so that user can easily troubleshoot it. Signed-off-by: Guillaume Nault --- accel-pppd/iprange.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c index 593f493a..f7b77a27 100644 --- a/accel-pppd/iprange.c +++ b/accel-pppd/iprange.c @@ -114,8 +114,12 @@ static int parse_iprange(const char *str, struct iprange_t **range) } /* Interpret /0 as disable request */ - if (prefix_len == 0) + if (prefix_len == 0) { + if (ipmin != INADDR_ANY) + log_warn("iprange: %s is equivalent to 0.0.0.0/0 and disables the iprange module\n", + str); goto disable; + } mask = INADDR_BROADCAST << (32 - prefix_len); if (ipmin != (ipmin & mask)) { -- cgit v1.2.3