diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 5b616dd0a..b5bd479db 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -6447,12 +6447,17 @@ public class ClientModeImpl extends StateMachine { final boolean isUsingStaticIp = (config.getIpAssignment() == IpConfiguration.IpAssignment.STATIC); + final boolean isUsingMacRandomization = + config.macRandomizationSetting + == WifiConfiguration.RANDOMIZATION_PERSISTENT + && isConnectedMacRandomizationEnabled(); if (mVerboseLoggingEnabled) { final String key = config.getKey(); log("startIpClient netId=" + Integer.toString(mLastNetworkId) + " " + key + " " + " roam=" + mIsAutoRoaming + " static=" + isUsingStaticIp + + " randomMac=" + isUsingMacRandomization + " isFilsConnection=" + isFilsConnection); } @@ -6471,15 +6476,18 @@ public class ClientModeImpl extends StateMachine { return false; } setConfigurationsPriorToIpClientProvisioning(config); - final ProvisioningConfiguration prov = + final ProvisioningConfiguration.Builder prov = new ProvisioningConfiguration.Builder() .withPreDhcpAction() .withPreconnection() .withApfCapabilities( mWifiNative.getApfCapabilities(mInterfaceName)) - .withLayer2Information(layer2Info) - .build(); - mIpClient.startProvisioning(prov); + .withLayer2Information(layer2Info); + if (isUsingMacRandomization) { + // Use EUI64 address generation for link-local IPv6 addresses. + prov.withRandomMacAddress(); + } + mIpClient.startProvisioning(prov.build()); } else { sendNetworkChangeBroadcast(DetailedState.OBTAINING_IPADDR); // We must clear the config BSSID, as the wifi chipset may decide to roam @@ -6521,7 +6529,7 @@ public class ClientModeImpl extends StateMachine { } } - final ProvisioningConfiguration prov; + final ProvisioningConfiguration.Builder prov; ProvisioningConfiguration.ScanResultInfo scanResultInfo = null; if (scanResult != null) { final List<ScanResultInfo.InformationElement> ies = @@ -6542,8 +6550,7 @@ public class ClientModeImpl extends StateMachine { .withNetwork(getCurrentNetwork()) .withDisplayName(config.SSID) .withScanResultInfo(scanResultInfo) - .withLayer2Information(layer2Info) - .build(); + .withLayer2Information(layer2Info); } else { StaticIpConfiguration staticIpConfig = config.getStaticIpConfiguration(); prov = new ProvisioningConfiguration.Builder() @@ -6551,10 +6558,13 @@ public class ClientModeImpl extends StateMachine { .withApfCapabilities(mWifiNative.getApfCapabilities(mInterfaceName)) .withNetwork(getCurrentNetwork()) .withDisplayName(config.SSID) - .withLayer2Information(layer2Info) - .build(); + .withLayer2Information(layer2Info); + } + if (isUsingMacRandomization) { + // Use EUI64 address generation for link-local IPv6 addresses. + prov.withRandomMacAddress(); } - mIpClient.startProvisioning(prov); + mIpClient.startProvisioning(prov.build()); } return true; |