From 761fec1b48fa7329dc40713ccfe0637dd9dd20a9 Mon Sep 17 00:00:00 2001 From: xshu Date: Wed, 22 Apr 2020 18:36:54 -0700 Subject: Randomize sta MAC address upon start This is needed to prevent factory MAC leakage for features like DPP, which at some point sends packets using the currently programed MAC. Bug: 154393320 Test: com.android.server.wifi Change-Id: I3c5a388545e049daa8430af5010f4b2386210ac9 --- service/java/com/android/server/wifi/ClientModeImpl.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'service') diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 00e02df4a..7d89505e3 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -67,6 +67,7 @@ import android.net.shared.Inet4AddressUtils; import android.net.shared.Layer2Information; import android.net.shared.ProvisioningConfiguration; import android.net.shared.ProvisioningConfiguration.ScanResultInfo; +import android.net.util.MacAddressUtils; import android.net.util.NetUtils; import android.net.wifi.IActionListener; import android.net.wifi.INetworkRequestMatchCallback; @@ -3549,6 +3550,7 @@ public class ClientModeImpl extends StateMachine { mLastSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; mLastSimBasedConnectionCarrierName = null; mLastSignalLevel = -1; + mWifiNative.setMacAddress(mInterfaceName, MacAddressUtils.createRandomUnicastAddress()); mWifiInfo.setMacAddress(mWifiNative.getMacAddress(mInterfaceName)); // TODO: b/79504296 This broadcast has been deprecated and should be removed sendSupplicantConnectionChangedBroadcast(true); -- cgit v1.2.3