From 6a39362490f9c18acd760c3769735f5cdc71be83 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Tue, 30 Dec 2014 11:24:08 +0300 Subject: ipoe: fixed mask calculation from ipaddr radius attribute --- accel-pppd/ctrl/ipoe/ipoe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 32eaaa4b..9fa03b87 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -1825,10 +1825,13 @@ static void ev_radius_access_accept(struct ev_radius_t *ev) if (attr->val.integer > 0 && attr->val.integer < 31) ses->mask = attr->val.integer; } else if (attr->attr->type == ATTR_TYPE_IPADDR) { + if (attr->val.ipaddr == 0xffffffff) + ses->mask = 32; + else #if __BYTE_ORDER == __LITTLE_ENDIAN - ses->mask = ffs(~attr->val.ipaddr) - 1; + ses->mask = 31 - ffs(htonl(attr->val.ipaddr)); #else - ses->mask = ffs(~htole32(attr->val.ipaddr)) - 1; + ses->mask = 31 - ffs(attr->val.ipaddr); #endif } } else if (attr->attr->id == conf_attr_l4_redirect) { -- cgit v1.2.3