From af3c71f28531c8d52ebc8e913f34b674f91b9fd8 Mon Sep 17 00:00:00 2001 From: Rebecca Silberstein Date: Wed, 13 Apr 2016 10:29:48 -0700 Subject: WifiConfigStore: set requirePMF when ieee80211w==2 When reading back WifiConfigurations, the ieee80211w value is incorrectly defaulting to 3, this is causing the requirePMF value to be incorrectly set to true. Change this behavior to only set requirePMF when the value read is 2. BUG: 28159304 Change-Id: I0896b1feb10415c04b335ac1b91844ae0fe87f2d --- service/java/com/android/server/wifi/WifiConfigStore.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index 8b4535ebf..0f842ec79 100644 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -83,6 +83,10 @@ public class WifiConfigStore { public static final String ID_STRING_KEY_FQDN = "fqdn"; public static final String ID_STRING_KEY_CREATOR_UID = "creatorUid"; public static final String ID_STRING_KEY_CONFIG_KEY = "configKey"; + + // Value stored by supplicant to requirePMF + public static final int STORED_VALUE_FOR_REQUIRE_PMF = 2; + /** * In old configurations, the "private_key" field was used. However, newer * configurations use the key_id field with the engine_id set to "keystore". @@ -373,7 +377,7 @@ public class WifiConfigStore { config.requirePMF = false; if (!TextUtils.isEmpty(value)) { try { - config.requirePMF = Integer.parseInt(value) != 0; + config.requirePMF = Integer.parseInt(value) == STORED_VALUE_FOR_REQUIRE_PMF; } catch (NumberFormatException ignore) { } } @@ -812,7 +816,7 @@ public class WifiConfigStore { if (config.requirePMF && !mWifiNative.setNetworkVariable( netId, WifiConfiguration.pmfVarName, - "2")) { + Integer.toString(STORED_VALUE_FOR_REQUIRE_PMF))) { loge(config.SSID + ": failed to set requirePMF: " + config.requirePMF); return false; } -- cgit v1.2.3