WPS: Fix association when both WPS and WPA/RSN IE are included

The WPS IE was overriding the WPA/RSN IE in driver based MLME case
(hostapd_notif_assoc), but the MLME code here was not using WPS IE
correctly, i.e., it allowed the WPA/RSN IE override the operation.
This commit is contained in:
Jouni Malinen 2010-04-15 12:55:34 +03:00 committed by Jouni Malinen
parent 5fbc1f279b
commit c47cf42e4b

View file

@ -681,21 +681,19 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
if (hapd->conf->wps_state && wpa_ie == NULL) { if (hapd->conf->wps_state && elems.wps_ie) {
if (elems.wps_ie) { wpa_printf(MSG_DEBUG, "STA included WPS IE in (Re)Association "
wpa_printf(MSG_DEBUG, "STA included WPS IE in " "Request - assume WPS is used");
"(Re)Association Request - assume WPS is " sta->flags |= WLAN_STA_WPS;
"used"); wpabuf_free(sta->wps_ie);
sta->flags |= WLAN_STA_WPS; sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4,
wpabuf_free(sta->wps_ie); elems.wps_ie_len - 4);
sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4, wpa_ie = NULL;
elems.wps_ie_len - 4); wpa_ie_len = 0;
} else { } else if (hapd->conf->wps_state && wpa_ie == NULL) {
wpa_printf(MSG_DEBUG, "STA did not include WPA/RSN IE " wpa_printf(MSG_DEBUG, "STA did not include WPA/RSN IE in "
"in (Re)Association Request - possible WPS " "(Re)Association Request - possible WPS use");
"use"); sta->flags |= WLAN_STA_MAYBE_WPS;
sta->flags |= WLAN_STA_MAYBE_WPS;
}
} else } else
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
if (hapd->conf->wpa && wpa_ie == NULL) { if (hapd->conf->wpa && wpa_ie == NULL) {