]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/ap/ieee802_11.c
WPS: Fix association when both WPS and WPA/RSN IE are included
[thirdparty/hostap.git] / src / ap / ieee802_11.c
index e119474780d52fcaee13e99ac7f5fb1b8be6d05a..4986381c0dd394a741af88e6a0b5c8bbcd5aefb7 100644 (file)
@@ -681,21 +681,19 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 
 #ifdef CONFIG_WPS
        sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
-       if (hapd->conf->wps_state && wpa_ie == NULL) {
-               if (elems.wps_ie) {
-                       wpa_printf(MSG_DEBUG, "STA included WPS IE in "
-                                  "(Re)Association Request - assume WPS is "
-                                  "used");
-                       sta->flags |= WLAN_STA_WPS;
-                       wpabuf_free(sta->wps_ie);
-                       sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4,
-                                                       elems.wps_ie_len - 4);
-               } else {
-                       wpa_printf(MSG_DEBUG, "STA did not include WPA/RSN IE "
-                                  "in (Re)Association Request - possible WPS "
-                                  "use");
-                       sta->flags |= WLAN_STA_MAYBE_WPS;
-               }
+       if (hapd->conf->wps_state && elems.wps_ie) {
+               wpa_printf(MSG_DEBUG, "STA included WPS IE in (Re)Association "
+                          "Request - assume WPS is used");
+               sta->flags |= WLAN_STA_WPS;
+               wpabuf_free(sta->wps_ie);
+               sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4,
+                                               elems.wps_ie_len - 4);
+               wpa_ie = NULL;
+               wpa_ie_len = 0;
+       } else if (hapd->conf->wps_state && wpa_ie == NULL) {
+               wpa_printf(MSG_DEBUG, "STA did not include WPA/RSN IE in "
+                          "(Re)Association Request - possible WPS use");
+               sta->flags |= WLAN_STA_MAYBE_WPS;
        } else
 #endif /* CONFIG_WPS */
        if (hapd->conf->wpa && wpa_ie == NULL) {