From fa859ebb19d21e8d4288d6a9d08a571725285305 Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Thu, 21 Jan 2021 17:40:33 +0200 Subject: [PATCH] RSN+WPA: Fix RSNE removing in EAPOL-Key msg 3/4 when RSNXE is included When the AP advertised RSNE, RSNXE, and WPA IE, hostapd incorrectly removed the RSNE in the EAPOL-Key msg 3/4 if the STA associates with WPA, leaving only RSNXE instead of WPA IE. WPA STA fails to connect to such AP as the WPA IE is missing. Since RSNXE is not really used in non-RSN connection, just remove it here with RSNE. Signed-off-by: Andrei Otcheretianski --- src/ap/wpa_auth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index acb4416c5..7c53797e0 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -3393,6 +3393,8 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING) wpa_ie_len > wpa_ie[1] + 2U && wpa_ie[0] == WLAN_EID_RSN) { /* WPA-only STA, remove RSN IE and possible MDIE */ wpa_ie = wpa_ie + wpa_ie[1] + 2; + if (wpa_ie[0] == WLAN_EID_RSNX) + wpa_ie = wpa_ie + wpa_ie[1] + 2; if (wpa_ie[0] == WLAN_EID_MOBILITY_DOMAIN) wpa_ie = wpa_ie + wpa_ie[1] + 2; wpa_ie_len = wpa_ie[1] + 2; @@ -5397,6 +5399,8 @@ int wpa_auth_resend_m3(struct wpa_state_machine *sm, wpa_ie_len > wpa_ie[1] + 2 && wpa_ie[0] == WLAN_EID_RSN) { /* WPA-only STA, remove RSN IE and possible MDIE */ wpa_ie = wpa_ie + wpa_ie[1] + 2; + if (wpa_ie[0] == WLAN_EID_RSNX) + wpa_ie = wpa_ie + wpa_ie[1] + 2; if (wpa_ie[0] == WLAN_EID_MOBILITY_DOMAIN) wpa_ie = wpa_ie + wpa_ie[1] + 2; wpa_ie_len = wpa_ie[1] + 2;