summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2016-05-11 13:13:07 +0200
committerDmitry Kozlov <xeb@mail.ru>2016-05-11 14:45:56 +0300
commitd682a0aa8a142b0213a352b0057572fd1a3b76a4 (patch)
treefc972a3cb8274e6918a22ae115bc07ee9eda2724
parentff2000c206059d029f0a0542863565dfcef7d077 (diff)
downloadaccel-ppp-d682a0aa8a142b0213a352b0057572fd1a3b76a4.tar.gz
accel-ppp-d682a0aa8a142b0213a352b0057572fd1a3b76a4.zip
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 <g.nault@alphalink.fr>
-rw-r--r--accel-pppd/iprange.c6
1 files changed, 5 insertions, 1 deletions
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)) {