Enter WPA_4WAY_HANDSHAKE state change
On devices where the EAPOL 4 way H/S is offloaded
to driver, after association is completed,
supplicant sets the WPA_ASSOCIATED state change
and waits for the port authorization event from driver.
It never sets the WPA_4WAY_HANDSHAKE state. This makes
the upper layer(Android framework) and lower layer(driver/supplicant)
out of sync in state. So the last received supplicant state
change will be WPA_ASSOCIATED. Framework is not aware of 4 way
H/S offload feature. And Framework detects the connection
failure due to wrong password on checking the last state
and connection failure reasons. Since the last received state
is WPA_ASSOCIATED, framework fails to detect the wrong password error.
To fix the issue, once supplicant receives the association completion,
set the state to WPA_4WAY_HANDSHAKE. So the state change indications to
framework during the connection will be WPA_ASSOCIATED
-> WPA_4WAY_HANDSHAKE -> WPA_COMPLETED.
Bug: 278490035
Bug: 283160713
Test: Tried to connect with wrong password - A wrong
password notification was seen in the UI.
Test: connect/Disconnect to WPA AP multiple times.
Change-Id: I5efb00d21afa6ef3bc23ac1bf027d87732f8c3df
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 253f87d..0909961 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3889,6 +3889,7 @@
* EVENT_PORT_AUTHORIZED handler when the driver is done
* with the 4-way handshake.
*/
+ wpa_supplicant_set_state(wpa_s, WPA_4WAY_HANDSHAKE);
wpa_msg(wpa_s, MSG_INFO,
"ASSOC INFO: wait for driver port authorized indication");
}
@@ -5020,7 +5021,7 @@
static void wpa_supplicant_event_port_authorized(struct wpa_supplicant *wpa_s)
{
- if (wpa_s->wpa_state == WPA_ASSOCIATED) {
+ if (wpa_s->wpa_state >= WPA_ASSOCIATED) {
wpa_supplicant_cancel_auth_timeout(wpa_s);
wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
eapol_sm_notify_portValid(wpa_s->eapol, true);