summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-05-06 23:27:45 +0900
committerLorenzo Colitti <lorenzo@google.com>2020-05-06 23:47:00 +0900
commitc193cc0099006dae01922090a248fafbd6f2368c (patch)
tree69ee061cbe8b51d9325ed86ecb7d54ef52bfb780
parentaa2d8a3af4df361fe60560b1a50990d37dbfa817 (diff)
Test that the system doesn't accept non-/96 NAT64 prefixes.
Other system components (clatd, netd's DNS64 synthesis) don't support non-/96 prefixes, so such prefixes must be ignored. CTS already checks that LinkProperties#setNat64Prefix throws IllegalArgumentException when passed an invalid prefix length. Here we test that nothing happens (e.g., the network stack doesn't crash) when that exception is thrown. Bug: 153694684 Test: new unit tests Change-Id: I8a57e171d472532b930c8d5c33e11a99024cf128
-rw-r--r--tests/integration/src/android/net/ip/IpClientIntegrationTest.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java
index 4a3f445..e286439 100644
--- a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java
+++ b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java
@@ -1528,6 +1528,13 @@ public class IpClientIntegrationTest {
expectAlarmCancelled(inOrder, pref64Alarm);
expectNat64PrefixUpdate(inOrder, null);
+ // Announce a non-/96 prefix and expect it to be ignored.
+ IpPrefix invalidPrefix = new IpPrefix("64:ff9b::/64");
+ pref64 = new StructNdOptPref64(invalidPrefix, 1200).toByteBuffer();
+ ra = buildRaPacket(pio, rdnss, pref64);
+ mPacketReader.sendResponse(ra);
+ expectNoNat64PrefixUpdate(inOrder, invalidPrefix);
+
// Re-announce the prefix.
pref64 = new StructNdOptPref64(prefix, 600).toByteBuffer();
ra = buildRaPacket(pio, rdnss, pref64);