Merge "add test for TetheringUtils::setupNsSocket()" am: d3bb5a544c

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1638165

Change-Id: I2dcb5a315a3abc81a88c2625f28392fd6933af20
This commit is contained in:
Maciej Żenczykowski
2021-03-16 06:47:53 +00:00
committed by Automerger Merge Worker

View File

@@ -167,6 +167,7 @@ public class TetheringUtilsTest {
Inet6Address allRouters = NetworkStackConstants.IPV6_ADDR_ALL_ROUTERS_MULTICAST; Inet6Address allRouters = NetworkStackConstants.IPV6_ADDR_ALL_ROUTERS_MULTICAST;
final ByteBuffer na = Ipv6Utils.buildNaPacket(mac1, mac2, ll1, ll2, 0, ll1); final ByteBuffer na = Ipv6Utils.buildNaPacket(mac1, mac2, ll1, ll2, 0, ll1);
final ByteBuffer ns = Ipv6Utils.buildNsPacket(mac1, mac2, ll1, ll2, ll1);
final ByteBuffer rs = Ipv6Utils.buildRsPacket(mac1, mac2, ll1, allRouters); final ByteBuffer rs = Ipv6Utils.buildRsPacket(mac1, mac2, ll1, allRouters);
ByteBuffer received = checkIcmpSocketFilter(na /* passed */, rs /* dropped */, ByteBuffer received = checkIcmpSocketFilter(na /* passed */, rs /* dropped */,
@@ -175,5 +176,12 @@ public class TetheringUtilsTest {
Struct.parse(Ipv6Header.class, received); // Skip IPv6 header. Struct.parse(Ipv6Header.class, received); // Skip IPv6 header.
Icmpv6Header icmpv6 = Struct.parse(Icmpv6Header.class, received); Icmpv6Header icmpv6 = Struct.parse(Icmpv6Header.class, received);
assertEquals(NetworkStackConstants.ICMPV6_NEIGHBOR_ADVERTISEMENT, icmpv6.type); assertEquals(NetworkStackConstants.ICMPV6_NEIGHBOR_ADVERTISEMENT, icmpv6.type);
received = checkIcmpSocketFilter(ns /* passed */, rs /* dropped */,
TetheringUtils::setupNsSocket);
Struct.parse(Ipv6Header.class, received); // Skip IPv6 header.
icmpv6 = Struct.parse(Icmpv6Header.class, received);
assertEquals(NetworkStackConstants.ICMPV6_NEIGHBOR_SOLICITATION, icmpv6.type);
} }
} }