diff options
author | Sunil Ravi <sunilravi@google.com> | 2020-04-21 20:43:02 -0700 |
---|---|---|
committer | Sunil Ravi <sunilravi@google.com> | 2020-04-22 20:32:24 -0700 |
commit | 58d352d96f6379a23338abd08d1eabfa342390ae (patch) | |
tree | ab2d2efe9fbf7a52f0ca951120be64b3fb042cb8 /tests | |
parent | 73ecfa71e9e35568b55e00745c2dc83cde44d2d1 (diff) |
wifi: Indicate AUTH_FAILURE for WEP password error
For WEP password error, supplicant reports ASSOC_REJECT, this
will not indicate password error to GUI and instead bssid is added
to blacklist on continous failures.
Similar to WPA3, check the status code in Assoc reject event
and if it is "Authentication rejected because of challenge failure",
indicate AUTH_FAILURE for WEP password error.
Bug: 153923670
Test: Manual - Try Connecting to wpa3 and wep network with wrong password
Test: atest com.android.server.wifi
CRs-Fixed: 2433524
Change-Id: Ibe0902ee832504013c2017ecc2442f4580b847e3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java index ad2eac8a8..39f6876df 100644 --- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java @@ -1063,12 +1063,12 @@ public class SupplicantStaIfaceHalTest extends WifiBaseTest { * Tests the handling of incorrect network passwords for WPA3-Personal networks */ @Test - public void testAuthRejectionPassword() throws Exception { + public void testWpa3AuthRejectionPassword() throws Exception { executeAndValidateInitializationSequence(); assertNotNull(mISupplicantStaIfaceCallback); executeAndValidateConnectSequenceWithKeyMgmt(SUPPLICANT_NETWORK_ID, false, - WifiConfiguration.KeyMgmt.SAE); + WifiConfiguration.KeyMgmt.SAE, null); int statusCode = ISupplicantStaIfaceCallback.StatusCode.UNSPECIFIED_FAILURE; @@ -1081,6 +1081,27 @@ public class SupplicantStaIfaceHalTest extends WifiBaseTest { } /** + * Tests the handling of incorrect network passwords for WEP networks. + */ + @Test + public void testWepAuthRejectionPassword() throws Exception { + executeAndValidateInitializationSequence(); + assertNotNull(mISupplicantStaIfaceCallback); + + executeAndValidateConnectSequenceWithKeyMgmt(SUPPLICANT_NETWORK_ID, false, + WifiConfiguration.KeyMgmt.NONE, "97CA326539"); + + int statusCode = ISupplicantStaIfaceCallback.StatusCode.CHALLENGE_FAIL; + + mISupplicantStaIfaceCallback.onAssociationRejected( + NativeUtil.macAddressToByteArray(BSSID), statusCode, false); + verify(mWifiMonitor).broadcastAuthenticationFailureEvent(eq(WLAN0_IFACE_NAME), + eq(WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD), eq(-1)); + verify(mWifiMonitor).broadcastAssociationRejectionEvent( + eq(WLAN0_IFACE_NAME), eq(statusCode), eq(false), eq(BSSID)); + } + + /** * 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. @@ -2366,7 +2387,7 @@ public class SupplicantStaIfaceHalTest extends WifiBaseTest { private WifiConfiguration executeAndValidateConnectSequence( final int newFrameworkNetworkId, final boolean haveExistingNetwork) throws Exception { return executeAndValidateConnectSequenceWithKeyMgmt(newFrameworkNetworkId, - haveExistingNetwork, WifiConfiguration.KeyMgmt.WPA_PSK); + haveExistingNetwork, WifiConfiguration.KeyMgmt.WPA_PSK, null); } /** @@ -2374,16 +2395,19 @@ public class SupplicantStaIfaceHalTest extends WifiBaseTest { * * @param newFrameworkNetworkId Framework Network Id of the new network to connect. * @param haveExistingNetwork Removes the existing network. - * @param keyMgmt Key management of the new network + * @param keyMgmt Key management of the new network. + * @param wepKey if configurations are for a WEP network else null. * @return the WifiConfiguration object of the new network to connect. */ private WifiConfiguration executeAndValidateConnectSequenceWithKeyMgmt( final int newFrameworkNetworkId, final boolean haveExistingNetwork, - int keyMgmt) throws Exception { + int keyMgmt, String wepKey) throws Exception { setupMocksForConnectSequence(haveExistingNetwork); WifiConfiguration config = new WifiConfiguration(); config.networkId = newFrameworkNetworkId; config.allowedKeyManagement.set(keyMgmt); + config.wepKeys[0] = wepKey; + config.wepTxKeyIndex = 0; assertTrue(mDut.connectToNetwork(WLAN0_IFACE_NAME, config)); validateConnectSequence(haveExistingNetwork, 1); return config; |