]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add Framed-IP-Address to Accounting-Request if STA address is known
authorJouni Malinen <j@w1.fi>
Sat, 17 Oct 2015 16:53:29 +0000 (19:53 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 17 Oct 2015 16:53:29 +0000 (19:53 +0300)
The recently added ProxyARP support (proxy_arp=1) in hostapd allows a
STA IPv4 address to be learned from DHCP or ARP messages. If that
information is available, add it to Account-Request messages in
Framed-IP-Address attribute.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/accounting.c
src/radius/radius.c
src/radius/radius.h

index a096de4d3e5147da9d1f0ccfc9d7432bbb3b3289..c60b3a6c3e8935243678e0b30bb00673a41f2e83 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * hostapd / RADIUS Accounting
- * Copyright (c) 2002-2009, 2012, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, 2012-2015, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -147,6 +147,15 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
                        wpa_printf(MSG_ERROR, "Could not add CUI from ACL");
                        goto fail;
                }
+
+               if (sta->ipaddr &&
+                   !radius_msg_add_attr_int32(msg,
+                                              RADIUS_ATTR_FRAMED_IP_ADDRESS,
+                                              be_to_host32(sta->ipaddr))) {
+                       wpa_printf(MSG_ERROR,
+                                  "Could not add Framed-IP-Address");
+                       goto fail;
+               }
        }
 
        return msg;
index 1ebfd11f3b9a2b7a81d562dd6bf42a3cb3073078..bd2aadde13fc253af88888703ed201d05f8b38c7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * RADIUS message processing
- * Copyright (c) 2002-2009, 2011-2014, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, 2011-2015, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -173,6 +173,7 @@ static const struct radius_attr_type radius_attrs[] =
        { RADIUS_ATTR_USER_PASSWORD, "User-Password", RADIUS_ATTR_UNDIST },
        { RADIUS_ATTR_NAS_IP_ADDRESS, "NAS-IP-Address", RADIUS_ATTR_IP },
        { RADIUS_ATTR_NAS_PORT, "NAS-Port", RADIUS_ATTR_INT32 },
+       { RADIUS_ATTR_FRAMED_IP_ADDRESS, "Framed-IP-Address", RADIUS_ATTR_IP },
        { RADIUS_ATTR_FRAMED_MTU, "Framed-MTU", RADIUS_ATTR_INT32 },
        { RADIUS_ATTR_REPLY_MESSAGE, "Reply-Message", RADIUS_ATTR_TEXT },
        { RADIUS_ATTR_STATE, "State", RADIUS_ATTR_UNDIST },
index 5977339e08d2b29f1a0557feee0556747944e5a0..f14de5301a063d44747d5a28c24b48dd53796411 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * RADIUS message processing
- * Copyright (c) 2002-2009, 2012, 2014, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, 2012, 2014-2015, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -52,6 +52,7 @@ enum { RADIUS_ATTR_USER_NAME = 1,
        RADIUS_ATTR_USER_PASSWORD = 2,
        RADIUS_ATTR_NAS_IP_ADDRESS = 4,
        RADIUS_ATTR_NAS_PORT = 5,
+       RADIUS_ATTR_FRAMED_IP_ADDRESS = 8,
        RADIUS_ATTR_FRAMED_MTU = 12,
        RADIUS_ATTR_REPLY_MESSAGE = 18,
        RADIUS_ATTR_STATE = 24,