diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2020-06-18 07:59:52 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-18 07:59:52 +0000 |
commit | 628ae8fc41aa1428fe4f99ea0b0491877fa30d27 (patch) | |
tree | fc41f9ea08c91afac9ef7e2da1fa04146f22469e | |
parent | fecc0bfbd60c4399a7a6e6ee6bd0e3d7f98a47cd (diff) | |
parent | cb04ddcfdcd41af5e5d5eca26090e9e9ce971046 (diff) |
Merge "Transition to appropriate state after all left addresses have been cleared." into rvc-dev am: fdbc41a222 am: cb04ddcfdc
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/NetworkStack/+/11902482
Change-Id: I484c9996a4c683db193fba7785f2e62e5192ae64
-rw-r--r-- | src/android/net/ip/IpClient.java | 2 | ||||
-rw-r--r-- | tests/integration/src/android/net/ip/IpClientIntegrationTest.java | 24 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java index 28effd3..5d5b025 100644 --- a/src/android/net/ip/IpClient.java +++ b/src/android/net/ip/IpClient.java @@ -1772,7 +1772,7 @@ public class IpClient extends StateMachine { case EVENT_NETLINK_LINKPROPERTIES_CHANGED: handleLinkPropertiesUpdate(NO_CALLBACKS); if (readyToProceed()) { - transitionTo(mRunningState); + transitionTo(isUsingPreconnection() ? mPreconnectingState : mRunningState); } break; diff --git a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java index 8a58fcd..f2cc2c6 100644 --- a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java +++ b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java @@ -1658,8 +1658,7 @@ public class IpClientIntegrationTest { HandlerUtilsKt.waitForIdle(mIpc.getHandler(), TEST_TIMEOUT_MS); } - @Test - public void testIpClientClearingIpAddressState() throws Exception { + private void doIPv4OnlyProvisioningAndExitWithLeftAddress() throws Exception { final long currentTime = System.currentTimeMillis(); performDhcpHandshake(true /* isSuccessLease */, TEST_LEASE_DURATION_S, true /* isDhcpLeaseCacheEnabled */, false /* shouldReplyRapidCommitAck */, @@ -1684,6 +1683,11 @@ public class IpClientIntegrationTest { // TODO: once IpClient gets IP addresses directly from netlink instead of from netd, it // may be sufficient to call waitForIdle to see if IpClient has seen the address. addIpAddressAndWaitForIt(mIfaceName); + } + + @Test + public void testIpClientClearingIpAddressState() throws Exception { + doIPv4OnlyProvisioningAndExitWithLeftAddress(); ProvisioningConfiguration config = new ProvisioningConfiguration.Builder() .withoutIpReachabilityMonitor() @@ -1703,6 +1707,22 @@ public class IpClientIntegrationTest { } @Test + public void testIpClientClearingIpAddressState_enablePreconnection() throws Exception { + doIPv4OnlyProvisioningAndExitWithLeftAddress(); + + // Enter ClearingIpAddressesState to clear the remaining IPv4 addresses and transition to + // PreconnectionState instead of RunningState. + startIpClientProvisioning(false /* isDhcpLeaseCacheEnabled */, + false /* shouldReplyRapidCommitAck */, true /* isDhcpPreConnectionEnabled */, + false /* isDhcpIpConflictDetectEnabled */); + assertDiscoverPacketOnPreconnectionStart(); + + // Force to enter RunningState. + mIpc.notifyPreconnectionComplete(false /* abort */); + HandlerUtilsKt.waitForIdle(mIpc.getHandler(), TEST_TIMEOUT_MS); + } + + @Test public void testDhcpClientPreconnection_success() throws Exception { doIpClientProvisioningWithPreconnectionTest(true /* shouldReplyRapidCommitAck */, false /* shouldAbortPreconnection */, false /* shouldFirePreconnectionTimeout */, |