From 2712035632c53f7432d372b04a7c2a563614e537 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Wed, 1 Dec 2010 05:49:40 +0300 Subject: iprange: fixed incorrect range calculation in form x.x.x.x/mask --- accel-pptpd/iprange.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/accel-pptpd/iprange.c b/accel-pptpd/iprange.c index e55a5c4..411dcb7 100644 --- a/accel-pptpd/iprange.c +++ b/accel-pptpd/iprange.c @@ -47,10 +47,8 @@ static struct iprange_t *parse1(const char *str) r = _malloc(sizeof(*r)); r->begin = (f4 << 24) | (f3 << 16) | (f2 << 8) | f1; - - mask = 0; - for (n = 0; n < m ; n++) - mask |= 1 << n; + + mask = htonl(~((1 << (32 - m)) - 1)); r->end = ntohl(r->begin | ~mask); r->begin = ntohl(r->begin); -- cgit v1.2.3