summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2017-03-10 16:54:26 -0800
committerMichael Plass <mplass@google.com>2017-03-14 13:57:06 -0700
commit92e43feb3eb54736a28226b588bc087fdda1646e (patch)
tree8bc8a9309b4e7940a4948e36bc19b80e4a51d625 /service
parent4fdbb2cd44da9cd50bfdc022e7fcf7eec53986a6 (diff)
[SupplicantStaIfaceHal] Detect PSK mismatch
Use checks analogous to those in wpa_supplicant_8/wpa_supplicant/events.c to decide whether or not a disconnect is likely due to an incorrect password. Test: Attempt to join a PSK network with the wrong password Test: Unit tests added Bug: 35464954 Change-Id: I47196cf89dbd602c22a61b430b764c7ea76f04d5
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaIfaceHal.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
index 8c41441c3..66bda1e64 100644
--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
@@ -1678,6 +1678,9 @@ public class SupplicantStaIfaceHal {
}
private class SupplicantStaIfaceHalCallback extends ISupplicantStaIfaceCallback.Stub {
+ private static final int WLAN_REASON_IE_IN_4WAY_DIFFERS = 17; // IEEE 802.11i
+ private boolean mStateIsFourway = false; // Used to help check for PSK password mismatch
+
/**
* Parses the provided payload into an ANQP element.
*
@@ -1755,6 +1758,7 @@ public class SupplicantStaIfaceHal {
mWifiMonitor.broadcastNetworkConnectionEvent(
mIfaceName, mFrameworkNetworkId, bssidStr);
}
+ mStateIsFourway = (newState == ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE);
}
}
@@ -1818,6 +1822,16 @@ public class SupplicantStaIfaceHal {
public void onDisconnected(byte[/* 6 */] bssid, boolean locallyGenerated, int reasonCode) {
logCallback("onDisconnected");
synchronized (mLock) {
+ if (mVerboseLoggingEnabled) {
+ Log.e(TAG, "onDisconnected 4way=" + mStateIsFourway
+ + " locallyGenerated=" + locallyGenerated
+ + " reasonCode=" + reasonCode);
+ }
+ if (mStateIsFourway
+ && (!locallyGenerated || reasonCode != WLAN_REASON_IE_IN_4WAY_DIFFERS)) {
+ mWifiMonitor.broadcastAuthenticationFailureEvent(
+ mIfaceName, WifiMonitor.AUTHENTICATION_FAILURE_REASON_WRONG_PSWD);
+ }
mWifiMonitor.broadcastNetworkDisconnectionEvent(
mIfaceName, locallyGenerated ? 1 : 0, reasonCode,
NativeUtil.macAddressFromByteArray(bssid));
@@ -1828,8 +1842,6 @@ public class SupplicantStaIfaceHal {
public void onAssociationRejected(byte[/* 6 */] bssid, int statusCode, boolean timedOut) {
logCallback("onAssociationRejected");
synchronized (mLock) {
- // TODO(b/35464954): Need to figure out when to trigger
- // |WifiMonitor.AUTHENTICATION_FAILURE_REASON_WRONG_PSWD|
mWifiMonitor.broadcastAssociationRejectionEvent(mIfaceName, statusCode, timedOut,
NativeUtil.macAddressFromByteArray(bssid));
}