diff options
author | Xiao Ma <xiaom@google.com> | 2020-04-18 17:51:17 +0900 |
---|---|---|
committer | Xiao Ma <xiaom@google.com> | 2020-04-22 11:29:07 +0900 |
commit | dfe6cd89f4f49d6475ea1669447efed2c84a04d6 (patch) | |
tree | 105b23875604fbc2bf697e2a2691e9177be66a30 | |
parent | e67124ed6522986876872ad83e1ade954dad06f9 (diff) |
Fill L2 Information in the initial provisioning configuration.
Since CMD_UPDATE_L2INFO has been removed from IpClient#StoppedState,
which was used to update the initial l2key and groupHint parameters,
pass these two params in the initial provisioning configuration
instead, then IpClient gets l2key and groupHint when starting prov
before DhcpClient starts.
This patch also removes the redundant updateLayer2Information call
after supplicant state COMPLETED. We can rely on the updated current
BSSID in handleSupplicantStateChange to detect if L2 roaming happened
and then trigger DNAv4/DNAv6 probe. The call graph when L2 roaming
happened looks like:
- WiFi is trying to associate to another AP
- supplicant state changes
- L2Key and GroupHint pair changes
- updateLayer2Information
- IpClient already in StartedState, will process CMD_UPDATE_L2INFO.
- DNAv4/v6 probe if updated bssid doesn't equal to current one.
- Rebind IP Lease if needed.
- update the current bssid on IpClient side.
- complete 802.1x AUTH
- supplicant state changes(supplicate.COMPLETE)
- updateLayer2Information // this is redundant, remove it.
Bug: 131797393
Test: atest FrameworksWifiTests
Change-Id: If3167c3f831283d5a63a7099baa243c8d4ac9921
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 00e02df4a..7a659704a 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -2692,9 +2692,14 @@ public class ClientModeImpl extends StateMachine { if (mIpClient != null) { Pair<String, String> p = mWifiScoreCard.getL2KeyAndGroupHint(mWifiInfo); if (!p.equals(mLastL2KeyAndGroupHint)) { + final MacAddress lastBssid = getCurrentBssid(); final Layer2Information l2Information = new Layer2Information( - p.first, p.second, - mLastBssid != null ? MacAddress.fromString(mLastBssid) : null); + p.first, p.second, lastBssid); + // Update current BSSID on IpClient side whenever l2Key and groupHint + // pair changes (i.e. the initial connection establishment or L2 roaming + // happened). If we have COMPLETED the roaming to a different BSSID, start + // doing DNAv4/DNAv6 -style probing for on-link neighbors of interest (e.g. + // routers/DNS servers/default gateway). if (mIpClient.updateLayer2Information(l2Information)) { mLastL2KeyAndGroupHint = p; } else { @@ -3675,6 +3680,16 @@ public class ClientModeImpl extends StateMachine { return mLastBssid; } + MacAddress getCurrentBssid() { + MacAddress bssid = null; + try { + bssid = (mLastBssid != null) ? MacAddress.fromString(mLastBssid) : null; + } catch (IllegalArgumentException e) { + Log.e(TAG, "Invalid BSSID format: " + mLastBssid); + } + return bssid; + } + void connectToNetwork(WifiConfiguration config) { if ((config != null) && mWifiNative.connectToNetwork(mInterfaceName, config)) { mWifiInjector.getWifiLastResortWatchdog().noteStartConnectTime(); @@ -3892,23 +3907,7 @@ public class ClientModeImpl extends StateMachine { transitionTo(mDisconnectedState); } - // If we have COMPLETED a connection to a BSSID, start doing - // DNAv4/DNAv6 -style probing for on-link neighbors of - // interest (e.g. routers); harmless if none are configured. if (state == SupplicantState.COMPLETED) { - if (mIpClient != null) { - MacAddress lastBssid = null; - try { - lastBssid = (mLastBssid != null) - ? MacAddress.fromString(mLastBssid) : null; - } catch (IllegalArgumentException e) { - Log.e(TAG, "Invalid BSSID format: " + mLastBssid); - } - final Layer2Information info = new Layer2Information( - mLastL2KeyAndGroupHint.first, mLastL2KeyAndGroupHint.second, - lastBssid); - mIpClient.updateLayer2Information(info); - } mWifiScoreReport.noteIpCheck(); } break; @@ -6377,6 +6376,14 @@ public class ClientModeImpl extends StateMachine { + " isFilsConnection=" + isFilsConnection); } + final MacAddress currentBssid = getCurrentBssid(); + final String l2Key = mLastL2KeyAndGroupHint != null + ? mLastL2KeyAndGroupHint.first : null; + final String groupHint = mLastL2KeyAndGroupHint != null + ? mLastL2KeyAndGroupHint.second : null; + final Layer2Information layer2Info = new Layer2Information(l2Key, groupHint, + currentBssid); + if (isFilsConnection) { stopIpClient(); if (isUsingStaticIp) { @@ -6390,6 +6397,7 @@ public class ClientModeImpl extends StateMachine { .withPreconnection() .withApfCapabilities( mWifiNative.getApfCapabilities(mInterfaceName)) + .withLayer2Information(layer2Info) .build(); mIpClient.startProvisioning(prov); } else { @@ -6454,6 +6462,7 @@ public class ClientModeImpl extends StateMachine { .withNetwork(getCurrentNetwork()) .withDisplayName(config.SSID) .withScanResultInfo(scanResultInfo) + .withLayer2Information(layer2Info) .build(); } else { StaticIpConfiguration staticIpConfig = config.getStaticIpConfiguration(); @@ -6462,6 +6471,7 @@ public class ClientModeImpl extends StateMachine { .withApfCapabilities(mWifiNative.getApfCapabilities(mInterfaceName)) .withNetwork(getCurrentNetwork()) .withDisplayName(config.SSID) + .withLayer2Information(layer2Info) .build(); } mIpClient.startProvisioning(prov); |