From 58d352d96f6379a23338abd08d1eabfa342390ae Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Tue, 21 Apr 2020 20:43:02 -0700 Subject: 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 --- .../wifi/SupplicantStaIfaceCallbackImpl.java | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackImpl.java b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackImpl.java index 2d78514e4..92ba43b4c 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackImpl.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackImpl.java @@ -258,29 +258,36 @@ abstract class SupplicantStaIfaceCallbackImpl extends ISupplicantStaIfaceCallbac public void onAssociationRejected(byte[/* 6 */] bssid, int statusCode, boolean timedOut) { synchronized (mLock) { mStaIfaceHal.logCallback("onAssociationRejected"); + boolean isWrongPwd = false; WifiConfiguration curConfiguration = mStaIfaceHal.getCurrentNetworkLocalConfig(mIfaceName); - if (curConfiguration != null && !timedOut) { - Log.d(TAG, "flush PMK cache due to association rejection for config id " - + curConfiguration.networkId + "."); - mStaIfaceHal.removePmkCacheEntry(curConfiguration.networkId); - } - - if (statusCode == StatusCode.UNSPECIFIED_FAILURE) { - if (curConfiguration != null - && curConfiguration.allowedKeyManagement - .get(WifiConfiguration.KeyMgmt.SAE)) { - // Special handling for WPA3-Personal networks. If the password is - // incorrect, the AP will send association rejection, with status code 1 - // (unspecified failure). In SAE networks, the password authentication - // is not related to the 4-way handshake. In this case, we will send an - // authentication failure event up. + if (curConfiguration != null) { + if (!timedOut) { + Log.d(TAG, "flush PMK cache due to association rejection for config id " + + curConfiguration.networkId + "."); + mStaIfaceHal.removePmkCacheEntry(curConfiguration.networkId); + } + // Special handling for WPA3-Personal networks. If the password is + // incorrect, the AP will send association rejection, with status code 1 + // (unspecified failure). In SAE networks, the password authentication + // is not related to the 4-way handshake. In this case, we will send an + // authentication failure event up. + if (statusCode == StatusCode.UNSPECIFIED_FAILURE + && WifiConfigurationUtil.isConfigForSaeNetwork(curConfiguration)) { mStaIfaceHal.logCallback("SAE incorrect password"); - mWifiMonitor.broadcastAuthenticationFailureEvent( - mIfaceName, WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD, -1); + isWrongPwd = true; + } else if (statusCode == StatusCode.CHALLENGE_FAIL + && WifiConfigurationUtil.isConfigForWepNetwork(curConfiguration)) { + mStaIfaceHal.logCallback("WEP incorrect password"); + isWrongPwd = true; } } + + if (isWrongPwd) { + mWifiMonitor.broadcastAuthenticationFailureEvent( + mIfaceName, WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD, -1); + } mWifiMonitor .broadcastAssociationRejectionEvent( mIfaceName, statusCode, timedOut, -- cgit v1.2.3