diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-12-30 11:24:08 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-12-30 11:24:08 +0300 |
commit | 6a39362490f9c18acd760c3769735f5cdc71be83 (patch) | |
tree | 31eedf0a54a6787d2f469011e0ef2b790c61b34e /accel-pppd/ctrl/ipoe/ipoe.c | |
parent | 904bc0f9eefffff153282277ea21729f46c1489d (diff) | |
download | accel-ppp-6a39362490f9c18acd760c3769735f5cdc71be83.tar.gz accel-ppp-6a39362490f9c18acd760c3769735f5cdc71be83.zip |
ipoe: fixed mask calculation from ipaddr radius attribute
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe.c')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 7 |
1 files 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) { |