Fix AP build without CONFIG_WPS=y

Make the WPS processing of (Re)Association Request frame IEs conditional
on WPS support. This fixes a build issue with wps_is_20() not being
defined and makes the non-WPS build a bit smaller.
This commit is contained in:
Jouni Malinen 2011-09-12 22:23:45 +03:00
parent 531e420dd7
commit 633d4469e8

View file

@ -105,6 +105,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
if (hapd->conf->wpa) { if (hapd->conf->wpa) {
if (ie == NULL || ielen == 0) { if (ie == NULL || ielen == 0) {
#ifdef CONFIG_WPS
if (hapd->conf->wps_state) { if (hapd->conf->wps_state) {
wpa_printf(MSG_DEBUG, "STA did not include " wpa_printf(MSG_DEBUG, "STA did not include "
"WPA/RSN IE in (Re)Association " "WPA/RSN IE in (Re)Association "
@ -112,10 +113,12 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
sta->flags |= WLAN_STA_MAYBE_WPS; sta->flags |= WLAN_STA_MAYBE_WPS;
goto skip_wpa_check; goto skip_wpa_check;
} }
#endif /* CONFIG_WPS */
wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA"); wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA");
return -1; return -1;
} }
#ifdef CONFIG_WPS
if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 && if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 &&
os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) { os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {
struct wpabuf *wps; struct wpabuf *wps;
@ -132,6 +135,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
} }
goto skip_wpa_check; goto skip_wpa_check;
} }
#endif /* CONFIG_WPS */
if (sta->wpa_sm == NULL) if (sta->wpa_sm == NULL)
sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
@ -167,6 +171,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
return -1; return -1;
} }
} else if (hapd->conf->wps_state) { } else if (hapd->conf->wps_state) {
#ifdef CONFIG_WPS
struct wpabuf *wps; struct wpabuf *wps;
wps = ieee802_11_vendor_ie_concat(ie, ielen, wps = ieee802_11_vendor_ie_concat(ie, ielen,
WPS_IE_VENDOR_TYPE); WPS_IE_VENDOR_TYPE);
@ -194,8 +199,11 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
} else } else
sta->flags |= WLAN_STA_MAYBE_WPS; sta->flags |= WLAN_STA_MAYBE_WPS;
wpabuf_free(wps); wpabuf_free(wps);
#endif /* CONFIG_WPS */
} }
#ifdef CONFIG_WPS
skip_wpa_check: skip_wpa_check:
#endif /* CONFIG_WPS */
new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0; new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0;
sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC; sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;