summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2013-04-19 12:00:34 +0400
committerKozlov Dmitry <xeb@mail.ru>2013-04-19 12:00:34 +0400
commite003275f092bdbe8b64b3da301886d5e02218d6e (patch)
tree26e21b668e45febec52a7499b8fc3d7f34b7d99b
parent199bd3556de16e4a92fd4e3d79ec6741c5959336 (diff)
downloadaccel-ppp-e003275f092bdbe8b64b3da301886d5e02218d6e.tar.gz
accel-ppp-e003275f092bdbe8b64b3da301886d5e02218d6e.zip
ipoe: fix local-net handling
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c7
-rw-r--r--drivers/ipoe/ipoe.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 214f93a9..aae1cd10 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1627,7 +1627,12 @@ static void parse_local_net(const char *opt)
if (mask == 32)
mask = 0xffffffff;
else
- mask = (1 << mask) - 1;
+ mask = (1 << (32-mask)) - 1;
+
+ addr = ntohl(addr);
+ mask = ~mask;
+
+ //printf("%x/%x %x\n", htonl(addr), ~mask, htonl(addr)&(~mask));
ipoe_nl_add_net(addr & mask, mask);
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index 54cb2176..6fe13f8f 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -155,7 +155,7 @@ static int ipoe_check_network(__be32 addr)
rcu_read_lock();
list_for_each_entry_rcu(n, &ipoe_networks, entry) {
- if ((addr & n->mask) == n->addr) {
+ if ((ntohl(addr) & n->mask) == n->addr) {
r = 1;
break;
}