diff options
author | Mukesh Agrawal <quiche@google.com> | 2018-03-29 22:25:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-03-29 22:25:13 +0000 |
commit | 453bfc87609e12da3e831caca0e206eadaf8f186 (patch) | |
tree | 98b2b472c09dfcde3ec668fd85aae79840b7808c /service | |
parent | c4002658545b95d0f7f1686e925072518416a78e (diff) | |
parent | de108ed648e6aeed94c61ac9bb893181e83dcb4b (diff) |
Merge "Use "02:00:00:00:00:00" as default invalid mac" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 5 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 5fb1eac10..336ebbd16 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -431,11 +431,12 @@ public class WifiConfigManager { /** * Helper method to mask randomized MAC address from the provided WifiConfiguration Object. * This is needed when the network configurations are being requested via the public - * WifiManager API's. This method puts "0:0:0:0:0:0" as the MAC address. + * WifiManager API's. This method puts "02:00:00:00:00:00" as the MAC address. * @param configuration WifiConfiguration to hide the MAC address */ private void maskRandomizedMacAddressInWifiConfiguration(WifiConfiguration configuration) { - configuration.setRandomizedMacAddress(MacAddress.ALL_ZEROS_ADDRESS); + MacAddress defaultMac = MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS); + configuration.setRandomizedMacAddress(defaultMac); } /** diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index c96ea79fe..efa93223e 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3363,7 +3363,9 @@ public class WifiStateMachine extends StateMachine { MacAddress newMac = config.getOrCreateRandomizedMacAddress(); mWifiConfigManager.setNetworkRandomizedMacAddress(config.networkId, newMac); - if (currentMac.equals(newMac)) { + if (!WifiConfiguration.isValidMacAddressForRandomization(newMac)) { + Log.wtf(TAG, "Config generated an invalid MAC address"); + } else if (currentMac.equals(newMac)) { Log.i(TAG, "No changes in MAC address"); } else { Log.i(TAG, "ConnectedMacRandomization SSID(" + config.getPrintableSsid() |