summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-04-27 08:45:49 +0000
committerLorenzo Colitti <lorenzo@google.com>2020-04-27 15:44:41 +0000
commit1725a2cd922f7af15538a856c9482f004b4535ff (patch)
treed1e027877a953d3bfc84373997d005418cf5c52b /src
parentf7642249714c429183745f8f0ed3cdca25dfadff (diff)
Don't crash or wtf if the interface doesn't exist.
This prevents the code from issuing a Log.wtf due to calling transitionTo in ClearingIpAddressesState#enter if the interface does not exist when IpClient starts provisioning is called. This prevents IpClientIntegrationTest from crashing on eng builds due to the Log.wtf being unhandled. Bug: 155005801 Bug: 152723363 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testRestoreInitialInterfaceMtu_NotFoundInterfaceWhenStartingProvisioning Original-Change: http://aosp/1290575 Merged-In: I4f34343816202c996f9227b72d453ea4a464f4b8 Change-Id: I4f34343816202c996f9227b72d453ea4a464f4b8
Diffstat (limited to 'src')
-rw-r--r--src/android/net/ip/IpClient.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index 86d3ba7..6021c6a 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -1699,25 +1699,27 @@ public class IpClient extends StateMachine {
class ClearingIpAddressesState extends State {
@Override
public void enter() {
- if (readyToProceed()) {
- deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
- } else {
- // Clear all IPv4 and IPv6 before proceeding to RunningState.
- // Clean up any leftover state from an abnormal exit from
- // 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);
+ deferMessage(obtainMessage(CMD_STOP));
return;
}
+
mLinkObserver.setInterfaceParams(mInterfaceParams);
+
+ if (readyToProceed()) {
+ deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
+ } else {
+ // Clear all IPv4 and IPv6 before proceeding to RunningState.
+ // Clean up any leftover state from an abnormal exit from
+ // tethering or during an IpClient restart.
+ stopAllIP();
+ }
+
mCallback.setNeighborDiscoveryOffload(true);
}
@@ -1752,7 +1754,7 @@ public class IpClient extends StateMachine {
}
private boolean readyToProceed() {
- return (!mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address());
+ return !mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address();
}
}