Snap for 10604239 from 4c0e9c0cf7dd067497cfec2f9774b4cfa5e67e81 to mainline-documentsui-release Change-Id: I7cd291b4354bce71595f2d43eeb0b9f6a88baa61
diff --git a/src/android/net/dhcp6/Dhcp6Client.java b/src/android/net/dhcp6/Dhcp6Client.java index 8bda0d3..d4b4a21 100644 --- a/src/android/net/dhcp6/Dhcp6Client.java +++ b/src/android/net/dhcp6/Dhcp6Client.java
@@ -630,7 +630,7 @@ @Override protected void handlePacket(byte[] recvbuf, int length) { try { - final Dhcp6Packet packet = Dhcp6Packet.decodePacket(recvbuf, length); + final Dhcp6Packet packet = Dhcp6Packet.decode(recvbuf, length); if (DBG) Log.d(TAG, "Received packet: " + packet); sendMessage(CMD_RECEIVED_PACKET, packet); } catch (Dhcp6Packet.ParseException e) {
diff --git a/src/android/net/dhcp6/Dhcp6Packet.java b/src/android/net/dhcp6/Dhcp6Packet.java index c82b7ed..8a11547 100644 --- a/src/android/net/dhcp6/Dhcp6Packet.java +++ b/src/android/net/dhcp6/Dhcp6Packet.java
@@ -249,7 +249,7 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ @VisibleForTesting - static Dhcp6Packet decodePacket(@NonNull final ByteBuffer packet) throws ParseException { + static Dhcp6Packet decode(@NonNull final ByteBuffer packet) throws ParseException { int elapsedTime = 0; byte[] iapd = null; byte[] serverDuid = null; @@ -379,10 +379,10 @@ /** * Parse a packet from an array of bytes, stopping at the given length. */ - public static Dhcp6Packet decodePacket(@NonNull final byte[] packet, int length) + public static Dhcp6Packet decode(@NonNull final byte[] packet, int length) throws ParseException { final ByteBuffer buffer = ByteBuffer.wrap(packet, 0, length).order(ByteOrder.BIG_ENDIAN); - return decodePacket(buffer); + return decode(buffer); } /**
diff --git a/src/android/net/ip/IpReachabilityMonitor.java b/src/android/net/ip/IpReachabilityMonitor.java index ff6d65e..4d40c4f 100644 --- a/src/android/net/ip/IpReachabilityMonitor.java +++ b/src/android/net/ip/IpReachabilityMonitor.java
@@ -262,7 +262,7 @@ IP_REACHABILITY_MCAST_RESOLICIT_VERSION, true /* defaultEnabled */); mIgnoreIncompleteIpv6DnsServerEnabled = dependencies.isFeatureEnabled(context, IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DNS_SERVER_VERSION, - false /* defaultEnabled */); + true /* defaultEnabled */); mIgnoreIncompleteIpv6DefaultRouterEnabled = dependencies.isFeatureEnabled(context, IP_REACHABILITY_IGNORE_INCOMPLETE_IPV6_DEFAULT_ROUTER_VERSION, false /* defaultEnabled */);
diff --git a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java index 246d0d4..6f30d4c 100644 --- a/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java +++ b/tests/integration/common/android/net/ip/IpClientIntegrationTestCommon.java
@@ -1290,7 +1290,7 @@ // Strip the Ethernet/IPv6/UDP headers, only keep DHCPv6 message payload for decode. final byte[] payload = Arrays.copyOfRange(packet, DHCP6_HEADER_OFFSET, packet.length); - final Dhcp6Packet dhcp6Packet = Dhcp6Packet.decodePacket(payload, payload.length); + final Dhcp6Packet dhcp6Packet = Dhcp6Packet.decode(payload, payload.length); if (dhcp6Packet != null) return dhcp6Packet; } return null;
diff --git a/tests/unit/src/android/net/dhcp6/Dhcp6PacketTest.kt b/tests/unit/src/android/net/dhcp6/Dhcp6PacketTest.kt index 2d093f7..de97ed4 100644 --- a/tests/unit/src/android/net/dhcp6/Dhcp6PacketTest.kt +++ b/tests/unit/src/android/net/dhcp6/Dhcp6PacketTest.kt
@@ -42,7 +42,7 @@ // IA prefix option(option_len=25) "001A001900000000000000004000000000000000000000000000000000" val bytes = HexDump.hexStringToByteArray(solicitHex) - val packet = Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + val packet = Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) assertTrue(packet is Dhcp6SolicitPacket) } @@ -61,7 +61,7 @@ "001A001900000000000000004000000000000000000000000000000000" val bytes = HexDump.hexStringToByteArray(solicitHex) assertThrows(Dhcp6Packet.ParseException::class.java) { - Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) } } @@ -80,7 +80,7 @@ "001A0019000000000000000040000000000000000000000000000000" val bytes = HexDump.hexStringToByteArray(solicitHex) assertThrows(Dhcp6Packet.ParseException::class.java) { - Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) } } @@ -99,7 +99,7 @@ "001A001900000000000000004000000000000000000000000000000000" val bytes = HexDump.hexStringToByteArray(solicitHex) assertThrows(Dhcp6Packet.ParseException::class.java) { - Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) } } @@ -119,7 +119,7 @@ // IA prefix option(option_len=25, prefix="fdfd:9ed6:7950:2::/64") "001A00190000019F0000A8C040FDFD9ED6795000010000000000000000" val bytes = HexDump.hexStringToByteArray(advertiseHex) - val packet = Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + val packet = Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) assertTrue(packet is Dhcp6AdvertisePacket) } @@ -142,7 +142,7 @@ "001A00190000019F0000A8C040FDFD9ED6795000010000000000000000" val bytes = HexDump.hexStringToByteArray(advertiseHex) // The unsupported option will be skipped normally and won't throw ParseException. - val packet = Dhcp6Packet.decodePacket(ByteBuffer.wrap(bytes)) + val packet = Dhcp6Packet.decode(ByteBuffer.wrap(bytes)) assertTrue(packet is Dhcp6AdvertisePacket) } }