summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Gannevaram <quic_vganneva@quicinc.com>2019-11-19 18:36:00 +0530
committerHai Shalom <haishalom@google.com>2019-12-03 15:17:30 +0000
commitfd027ad997449055483ab3b40700dbbdd87143c7 (patch)
treeacb95e220a7fd8e6c36f7e2321fecc18fc627652
parentff23d602c7a925a7aef87f1f7c3d08e67ad31a5e (diff)
downloadandroid_frameworks_opt_net_wifi-fd027ad997449055483ab3b40700dbbdd87143c7.tar.gz
android_frameworks_opt_net_wifi-fd027ad997449055483ab3b40700dbbdd87143c7.tar.bz2
android_frameworks_opt_net_wifi-fd027ad997449055483ab3b40700dbbdd87143c7.zip
Wifi: Fix connectivity issues with PSK-SHA256+SAE mode APs
Current PSK-SAE transition mode network identifier check using "PSK+SAE" sub-string but the sub-string not able to classify "PSK-SHA256+SAE" APs as PSK-SAE transition mode network. Due to this DUT cannot connect to such APs in PSK mode because the framework always targets the highest security. To resolve the issue consider network having both "PSK" and "SAE" sub- strings as PSK-SAE transition mode network. Also, added unit tests. Bug: 144773602 Bug: 144753662 Bug: 144737141 Test: atest ScanResultUtilTest Change-Id: Ida297a162edbed757556475dd4a9b75050054350 Merged-In: I2de88c7f4655de3f9946333fd4002e4b23749db8 Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
-rw-r--r--service/java/com/android/server/wifi/util/ScanResultUtil.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java76
2 files changed, 78 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/util/ScanResultUtil.java b/service/java/com/android/server/wifi/util/ScanResultUtil.java
index 39e9d2c40..b92483899 100644
--- a/service/java/com/android/server/wifi/util/ScanResultUtil.java
+++ b/service/java/com/android/server/wifi/util/ScanResultUtil.java
@@ -104,10 +104,10 @@ public class ScanResultUtil {
/**
* Helper method to check if the provided |scanResult| corresponds to PSK-SAE transition
- * network. This checks if the provided capabilities string contains PSK+SAE or not.
+ * network. This checks if the provided capabilities string contains both PSK and SAE or not.
*/
public static boolean isScanResultForPskSaeTransitionNetwork(ScanResult scanResult) {
- return scanResult.capabilities.contains("PSK+SAE");
+ return scanResult.capabilities.contains("PSK") && scanResult.capabilities.contains("SAE");
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
index 45adffd1d..266a2ce23 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
@@ -116,6 +116,82 @@ public class ScanResultUtilTest {
assertTrue(config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.IEEE8021X));
}
+ /**
+ * Test that a PSK-SHA256+SAE network is detected as transition mode
+ */
+ @Test
+ public void testPskSha256SaeTransitionModeCheck() {
+ final String ssid = "WPA3-Transition";
+ String caps = "[WPA2-FT/PSK-CCMP][RSN-FT/PSK+PSK-SHA256+SAE+FT/SAE-CCMP][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertTrue(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that a PSK+SAE network is detected as transition mode
+ */
+ @Test
+ public void testPskSaeTransitionModeCheck() {
+ final String ssid = "WPA3-Transition";
+ String caps = "[WPA2-FT/PSK+PSK+SAE+FT/SAE-CCMP][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertTrue(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that a PSK network is not detected as transition mode
+ */
+ @Test
+ public void testPskNotInTransitionModeCheck() {
+ final String ssid = "WPA2-Network";
+ String caps = "[WPA2-FT/PSK+PSK][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertFalse(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that an SAE network is not detected as transition mode
+ */
+ @Test
+ public void testSaeNotInTransitionModeCheck() {
+ final String ssid = "WPA3-Network";
+ String caps = "[WPA2-FT/SAE+SAE][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertFalse(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
private static InformationElement createIE(int id, byte[] bytes) {
InformationElement ie = new InformationElement();
ie.id = id;