diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-12-01 05:49:40 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-12-01 05:49:40 +0300 |
commit | 2712035632c53f7432d372b04a7c2a563614e537 (patch) | |
tree | 18f98d3d6c7ba1a9a19b6b8a1761acded8751c10 | |
parent | d4e123933f71773c91e2e0f3da2687a4e8715ab5 (diff) | |
download | accel-ppp-xebd-2712035632c53f7432d372b04a7c2a563614e537.tar.gz accel-ppp-xebd-2712035632c53f7432d372b04a7c2a563614e537.zip |
iprange: fixed incorrect range calculation in form x.x.x.x/mask
-rw-r--r-- | accel-pptpd/iprange.c | 6 |
1 files 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); |