summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2020-04-02 11:48:59 +0000
committerXiao Ma <xiaom@google.com>2020-04-03 01:32:21 +0000
commit56b911573b6b1bceb268dbbd3c735da4917c3129 (patch)
tree2d73ec97183c03baf44491c501369e5ba30485cb /src
parent9b105a99a3223fe2b573533cba503fb63bd97257 (diff)
Getting interface params in ClearingIpAddressState#enter.
In case of wifi might stop IpClient and then restart prov immediately to avoid wifi disconnection especially when roaming happens, this might cause getting interface params with incorrect interface mtu when starting provisioning again before interface mtu hasn't been restored. Moving getting interface params to ClearingIpAddressState#enter ensures that interface parameters are fetched on the handler thread so they are properly ordered with other events, such as restoring the interface MTU on teardown. Bug: 152169857 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: Ifd06b8d18ce570b1aa424ad215111c80f094ca97 (cherry picked from commit a6aba532103a3258d09e6931106d6fb05368c130) Change-Id: I0c8c1ed1646ab12bc30da2b7f8e5819d2d9495ba
Diffstat (limited to 'src')
-rw-r--r--src/android/net/ip/IpClient.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index ebb31c6..74a4070 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -765,14 +765,6 @@ public class IpClient extends StateMachine {
return;
}
- mInterfaceParams = mDependencies.getInterfaceParams(mInterfaceName);
- if (mInterfaceParams == null) {
- logError("Failed to find InterfaceParams for " + mInterfaceName);
- doImmediateProvisioningFailure(IpManagerEvent.ERROR_INTERFACE_NOT_FOUND);
- return;
- }
-
- mCallback.setNeighborDiscoveryOffload(true);
sendMessage(CMD_START, new android.net.shared.ProvisioningConfiguration(req));
}
@@ -1636,6 +1628,17 @@ public class IpClient extends StateMachine {
// tethering or during an IpClient restart.
stopAllIP();
}
+
+ // Ensure that interface parameters are fetched on the handler thread so they are
+ // properly ordered with other events, such as restoring the interface MTU on teardown.
+ mInterfaceParams = mDependencies.getInterfaceParams(mInterfaceName);
+ if (mInterfaceParams == null) {
+ logError("Failed to find InterfaceParams for " + mInterfaceName);
+ doImmediateProvisioningFailure(IpManagerEvent.ERROR_INTERFACE_NOT_FOUND);
+ transitionTo(mStoppedState);
+ return;
+ }
+ mCallback.setNeighborDiscoveryOffload(true);
}
@Override