summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorBram Bonné <brambonne@google.com>2020-06-03 07:53:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-03 07:53:10 +0000
commitedd8833275a5b7b750b2a58fa7c323b45b86b961 (patch)
treea924452808cc60b95a55daec4103842ef5b2de3f /service
parent69416dd547b00d612ef5795f07de09fcacfb67fc (diff)
parent9cd977f9f469bba280e7875d0fac0b1565da4f17 (diff)
Merge "Use EUI64 IPv6 link-local address generation when randomizing MAC" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java30
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;