summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-03-18 21:13:08 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-03-18 21:13:08 +0400
commit5d158d9b0a1ef6e1f620a517de6de196ea0cfbc8 (patch)
tree7565f71ca905422262098b9f5b4275d5aa8b6490 /accel-pppd
parent88e90fd0812099807511152930a01035f6f3ce5a (diff)
downloadaccel-ppp-5d158d9b0a1ef6e1f620a517de6de196ea0cfbc8.tar.gz
accel-ppp-5d158d9b0a1ef6e1f620a517de6de196ea0cfbc8.zip
ipoe: add support for ipaddr typeo of dhcp-mask attribute
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index d971ce5..082ff06 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1187,8 +1187,16 @@ static void ev_radius_access_accept(struct ev_radius_t *ev)
else if (attr->attr->id == conf_attr_dhcp_router_ip)
ses->router = attr->val.ipaddr;
else if (attr->attr->id == conf_attr_dhcp_mask) {
- if (attr->val.integer > 0 && attr->val.integer < 31)
- ses->mask = attr->val.integer;
+ if (attr->attr->type == ATTR_TYPE_INTEGER) {
+ if (attr->val.integer > 0 && attr->val.integer < 31)
+ ses->mask = attr->val.integer;
+ } else if (attr->attr->type == ATTR_TYPE_IPADDR) {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ ses->mask = ffs(~attr->val.ipaddr) - 1;
+#else
+ ses->mask = ffs(~htole32(attr->val.ipaddr)) - 1;
+#endif
+ }
} else if (attr->attr->id == conf_attr_l4_redirect) {
if (attr->attr->type == ATTR_TYPE_STRING) {
if (attr->len && attr->val.string[0] != '0')