diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-03-27 14:53:53 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-03-27 14:53:53 +0300 |
commit | e6134c0bdf33ed9ff850c9b8a97029d5b1f1ca7e (patch) | |
tree | 148337eaabf183398dfd2175b7f0d1c72eb68bdd /accel-pppd/ctrl | |
parent | 954b4dd6a27b6a11d809ad2fc4239a5558db10f8 (diff) | |
download | accel-ppp-e6134c0bdf33ed9ff850c9b8a97029d5b1f1ca7e.tar.gz accel-ppp-e6134c0bdf33ed9ff850c9b8a97029d5b1f1ca7e.zip |
ipoe: fixed prefix calculation from ipaddr
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index ab2cb007..917b28a5 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -2093,13 +2093,13 @@ void ipoe_serv_recv_arp(struct ipoe_serv *serv, struct _arphdr *arph) static int ipaddr_to_prefix(in_addr_t ipaddr) { - if (ipaddr == 0xffffffff) - return 32; + if (ipaddr == 0) + return 0; #if __BYTE_ORDER == __LITTLE_ENDIAN - return 31 - ffs(htonl(ipaddr)); + return 33 - ffs(htonl(ipaddr)); #else - return 31 - ffs(ipaddr); + return 33 - ffs(ipaddr); #endif } @@ -2119,7 +2119,7 @@ static void ev_radius_access_accept(struct ev_radius_t *ev) ses->router = attr->val.ipaddr; else if (attr->attr->id == conf_attr_dhcp_mask) { if (attr->attr->type == ATTR_TYPE_INTEGER) { - if (attr->val.integer > 0 && attr->val.integer < 31) + if (attr->val.integer > 0 && attr->val.integer <= 32) ses->mask = attr->val.integer; } else if (attr->attr->type == ATTR_TYPE_IPADDR) ses->mask = ipaddr_to_prefix(attr->val.ipaddr); |