summaryrefslogtreecommitdiff
path: root/tests/net/java/com/android/server/ConnectivityServiceTest.java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-04-20 11:38:11 +0000
committerLorenzo Colitti <lorenzo@google.com>2020-04-20 12:06:45 +0000
commit0d020c6d73d94eceec60d26e9b5cf1657c07775c (patch)
treeea4dcb1dcc66f1753911d658c4389931f4c8b750 /tests/net/java/com/android/server/ConnectivityServiceTest.java
parent717992f75e2609bbe54de72b29ff27b32b61ae91 (diff)
Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix discovery is running, clatd will be correctly started, but prefix discovery will be stopped. In order to fix this, make it possible to call stopPrefixDiscovery without transitioning to IDLE state (which is obviously necessary in this case), by moving the assignment of the next state from that method to its callers. For consistency, do the same for startPrefixDiscovery. Bug: 150648313 Test: new test coverage Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21 Merged-In: I3803fa3d9806848b331c35ee8bac256934bd1f21 (cherry picked from commit c7c6f76402a989f91b02c37574b6a9de592cf1af)
Diffstat (limited to 'tests/net/java/com/android/server/ConnectivityServiceTest.java')
-rw-r--r--tests/net/java/com/android/server/ConnectivityServiceTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index c1e51dd62ad4..a478e68c7dba 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -6228,6 +6228,22 @@ public class ConnectivityServiceTest {
inOrder.verify(mMockNetd).clatdStop(iface);
inOrder.verify(mMockDnsResolver).startPrefix64Discovery(netId);
+ // If the RA prefix appears while DNS discovery is in progress, discovery is stopped and
+ // clatd is started with the prefix from the RA.
+ lp.setNat64Prefix(pref64FromRa);
+ mCellNetworkAgent.sendLinkProperties(lp);
+ expectNat64PrefixChange(callback, mCellNetworkAgent, pref64FromRa);
+ inOrder.verify(mMockNetd).clatdStart(iface, pref64FromRa.toString());
+ inOrder.verify(mMockDnsResolver).stopPrefix64Discovery(netId);
+
+ // Withdraw the RA prefix so we can test the case where an RA prefix appears after DNS
+ // discovery has succeeded.
+ lp.setNat64Prefix(null);
+ mCellNetworkAgent.sendLinkProperties(lp);
+ expectNat64PrefixChange(callback, mCellNetworkAgent, null);
+ inOrder.verify(mMockNetd).clatdStop(iface);
+ inOrder.verify(mMockDnsResolver).startPrefix64Discovery(netId);
+
mService.mNetdEventCallback.onNat64PrefixEvent(netId, true /* added */,
pref64FromDnsStr, 96);
expectNat64PrefixChange(callback, mCellNetworkAgent, pref64FromDns);