]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow hostapd_notif_assoc() to be called with all IEs
authorJouni Malinen <jouni.malinen@atheros.com>
Sat, 3 Apr 2010 18:03:13 +0000 (21:03 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 4 Apr 2010 05:14:18 +0000 (08:14 +0300)
This makes the call simpler for driver wrappers since there is no need
to parse the IEs anymore before indicating association. In addition,
this allows association processing to be extended to use other IEs
in the future.

src/ap/drv_callbacks.c

index 61ca690e6db404ba037deb9b7542db7386d7fbba..0fa6f730cfc0054fe7fc309f0d846839104a0271 100644 (file)
@@ -18,6 +18,7 @@
 #include "radius/radius.h"
 #include "drivers/driver.h"
 #include "common/ieee802_11_defs.h"
+#include "common/ieee802_11_common.h"
 #include "hostapd.h"
 #include "ieee802_11.h"
 #include "sta_info.h"
@@ -36,10 +37,31 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
 {
        struct sta_info *sta;
        int new_assoc, res;
+       struct ieee802_11_elems elems;
 
        hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
                       HOSTAPD_LEVEL_INFO, "associated");
 
+       ieee802_11_parse_elems(ie, ielen, &elems, 0);
+       if (elems.wps_ie) {
+               ie = elems.wps_ie - 2;
+               ielen = elems.wps_ie_len + 2;
+               wpa_printf(MSG_DEBUG, "STA included WPS IE in (Re)AssocReq");
+       } else if (elems.rsn_ie) {
+               ie = elems.rsn_ie - 2;
+               ielen = elems.rsn_ie_len + 2;
+               wpa_printf(MSG_DEBUG, "STA included RSN IE in (Re)AssocReq");
+       } else if (elems.wpa_ie) {
+               ie = elems.wpa_ie - 2;
+               ielen = elems.wpa_ie_len + 2;
+               wpa_printf(MSG_DEBUG, "STA included WPA IE in (Re)AssocReq");
+       } else {
+               ie = NULL;
+               ielen = 0;
+               wpa_printf(MSG_DEBUG, "STA did not include WPS/RSN/WPA IE in "
+                          "(Re)AssocReq");
+       }
+
        sta = ap_get_sta(hapd, addr);
        if (sta) {
                accounting_sta_stop(hapd, sta);