From b60da593b9ae990c1a94f45e774169b6bde1475d Mon Sep 17 00:00:00 2001 From: Liang Ma Date: Wed, 29 Aug 2018 17:42:17 +0800 Subject: Clear 4-way handshake state when network is removed When network is removed during 4-way handshake, authentication failure message with wrong password is sent. This leads to some issues such as connection failure if wifi framework tries connection to another network. This is because 4-way handshake state is not cleared in this scenario. Bug: 113563382 Test: Manual Test: Unit test Change-Id: I494f9a0509bd26146af8c09ae025bb7b593ddbe9 --- .../server/wifi/SupplicantStaIfaceHalTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java index b4ea5af34..eded7fc17 100644 --- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java @@ -1201,6 +1201,30 @@ public class SupplicantStaIfaceHalTest { eq(WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD), eq(-1)); } + /** + * Tests the handling of incorrect network passwords, edge case. + * + * If the network is removed during 4-way handshake, do not call it a password mismatch. + */ + @Test + public void testNetworkRemovedDuring4way() throws Exception { + executeAndValidateInitializationSequence(); + assertNotNull(mISupplicantStaIfaceCallback); + + int reasonCode = 3; + + mISupplicantStaIfaceCallback.onStateChanged( + ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE, + NativeUtil.macAddressToByteArray(BSSID), + SUPPLICANT_NETWORK_ID, + NativeUtil.decodeSsid(SUPPLICANT_SSID)); + mISupplicantStaIfaceCallback.onNetworkRemoved(SUPPLICANT_NETWORK_ID); + mISupplicantStaIfaceCallback.onDisconnected( + NativeUtil.macAddressToByteArray(BSSID), true, reasonCode); + verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt(), + anyInt()); + } + /** * Tests the handling of incorrect network passwords, edge case. * -- cgit v1.2.3