Merge changes Ief507b3f,I45256bb1
* changes:
Add InetDiagMessage.inetDiagReqV2 with different args
Fix StructInetDiagSockId parsing for v4-mapped v6 address
diff --git a/staticlibs/device/com/android/net/module/util/netlink/InetDiagMessage.java b/staticlibs/device/com/android/net/module/util/netlink/InetDiagMessage.java
index 5a180e7..0a2f50d 100644
--- a/staticlibs/device/com/android/net/module/util/netlink/InetDiagMessage.java
+++ b/staticlibs/device/com/android/net/module/util/netlink/InetDiagMessage.java
@@ -58,8 +58,8 @@
private static final int TIMEOUT_MS = 500;
/**
- * Construct an inet_diag_req_v2 message. This method will throw {@code NullPointerException}
- * if local and remote are not both null or both non-null.
+ * Construct an inet_diag_req_v2 message. This method will throw
+ * {@link IllegalArgumentException} if local and remote are not both null or both non-null.
*/
public static byte[] inetDiagReqV2(int protocol, InetSocketAddress local,
InetSocketAddress remote, int family, short flags) {
@@ -68,16 +68,16 @@
}
/**
- * Construct an inet_diag_req_v2 message. This method will throw {@code NullPointerException}
- * if local and remote are not both null or both non-null.
+ * Construct an inet_diag_req_v2 message. This method will throw
+ * {@code IllegalArgumentException} if local and remote are not both null or both non-null.
*
* @param protocol the request protocol type. This should be set to one of IPPROTO_TCP,
* IPPROTO_UDP, or IPPROTO_UDPLITE.
* @param local local socket address of the target socket. This will be packed into a
- * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * {@link StructInetDiagSockId}. Request to diagnose for all sockets if both of
* local or remote address is null.
* @param remote remote socket address of the target socket. This will be packed into a
- * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * {@link StructInetDiagSockId}. Request to diagnose for all sockets if both of
* local or remote address is null.
* @param family the ip family of the request message. This should be set to either AF_INET or
* AF_INET6 for IPv4 or IPv6 sockets respectively.
@@ -90,18 +90,47 @@
*/
public static byte[] inetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
@Nullable InetSocketAddress remote, int family, short flags, int pad, int idiagExt,
- int state) throws NullPointerException {
+ int state) throws IllegalArgumentException {
+ // Request for all sockets if no specific socket is requested. Specify the local and remote
+ // socket address information for target request socket.
+ if ((local == null) != (remote == null)) {
+ throw new IllegalArgumentException(
+ "Local and remote must be both null or both non-null");
+ }
+ final StructInetDiagSockId id = ((local != null && remote != null)
+ ? new StructInetDiagSockId(local, remote) : null);
+ return inetDiagReqV2(protocol, id, family,
+ SOCK_DIAG_BY_FAMILY, flags, pad, idiagExt, state);
+ }
+
+ /**
+ * Construct an inet_diag_req_v2 message.
+ *
+ * @param protocol the request protocol type. This should be set to one of IPPROTO_TCP,
+ * IPPROTO_UDP, or IPPROTO_UDPLITE.
+ * @param id inet_diag_sockid. See {@link StructInetDiagSockId}
+ * @param family the ip family of the request message. This should be set to either AF_INET or
+ * AF_INET6 for IPv4 or IPv6 sockets respectively.
+ * @param type message types.
+ * @param flags message flags. See <linux_src>/include/uapi/linux/netlink.h.
+ * @param pad for raw socket protocol specification.
+ * @param idiagExt a set of flags defining what kind of extended information to report.
+ * @param state a bit mask that defines a filter of socket states.
+ * @return bytes array representation of the message
+ */
+ public static byte[] inetDiagReqV2(int protocol, @Nullable StructInetDiagSockId id, int family,
+ short type, short flags, int pad, int idiagExt, int state) {
final byte[] bytes = new byte[StructNlMsgHdr.STRUCT_SIZE + StructInetDiagReqV2.STRUCT_SIZE];
final ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byteBuffer.order(ByteOrder.nativeOrder());
final StructNlMsgHdr nlMsgHdr = new StructNlMsgHdr();
nlMsgHdr.nlmsg_len = bytes.length;
- nlMsgHdr.nlmsg_type = SOCK_DIAG_BY_FAMILY;
+ nlMsgHdr.nlmsg_type = type;
nlMsgHdr.nlmsg_flags = flags;
nlMsgHdr.pack(byteBuffer);
final StructInetDiagReqV2 inetDiagReqV2 =
- new StructInetDiagReqV2(protocol, local, remote, family, pad, idiagExt, state);
+ new StructInetDiagReqV2(protocol, id, family, pad, idiagExt, state);
inetDiagReqV2.pack(byteBuffer);
return bytes;
diff --git a/staticlibs/device/com/android/net/module/util/netlink/NetlinkConstants.java b/staticlibs/device/com/android/net/module/util/netlink/NetlinkConstants.java
index c44a5b4..44c51d8 100644
--- a/staticlibs/device/com/android/net/module/util/netlink/NetlinkConstants.java
+++ b/staticlibs/device/com/android/net/module/util/netlink/NetlinkConstants.java
@@ -141,6 +141,7 @@
/* see include/uapi/linux/sock_diag.h */
public static final short SOCK_DIAG_BY_FAMILY = 20;
+ public static final short SOCK_DESTROY = 21;
// Netlink groups.
public static final int RTMGRP_LINK = 1;
diff --git a/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagReqV2.java b/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagReqV2.java
index 6eef865..3b47008 100644
--- a/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagReqV2.java
+++ b/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagReqV2.java
@@ -18,7 +18,6 @@
import androidx.annotation.Nullable;
-import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
/**
@@ -48,23 +47,11 @@
private final int mState;
public static final int INET_DIAG_REQ_V2_ALL_STATES = (int) 0xffffffff;
- public StructInetDiagReqV2(int protocol, InetSocketAddress local, InetSocketAddress remote,
- int family) {
- this(protocol, local, remote, family, 0 /* pad */, 0 /* extension */,
- INET_DIAG_REQ_V2_ALL_STATES);
- }
-
- public StructInetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
- @Nullable InetSocketAddress remote, int family, int pad, int extension, int state)
- throws NullPointerException {
+ public StructInetDiagReqV2(int protocol, @Nullable StructInetDiagSockId id, int family, int pad,
+ int extension, int state) {
mSdiagFamily = (byte) family;
mSdiagProtocol = (byte) protocol;
- // Request for all sockets if no specific socket is requested. Specify the local and remote
- // socket address information for target request socket.
- if ((local == null) != (remote == null)) {
- throw new NullPointerException("Local and remote must be both null or both non-null");
- }
- mId = ((local != null && remote != null) ? new StructInetDiagSockId(local, remote) : null);
+ mId = id;
mPad = (byte) pad;
mIdiagExt = (byte) extension;
mState = state;
diff --git a/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagSockId.java b/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagSockId.java
index 1e728ea..dd85934 100644
--- a/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagSockId.java
+++ b/staticlibs/device/com/android/net/module/util/netlink/StructInetDiagSockId.java
@@ -29,6 +29,7 @@
import androidx.annotation.Nullable;
import java.net.Inet4Address;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
@@ -89,43 +90,53 @@
final int srcPort = Short.toUnsignedInt(byteBuffer.getShort());
final int dstPort = Short.toUnsignedInt(byteBuffer.getShort());
- final byte[] srcAddrByte;
- final byte[] dstAddrByte;
+ final InetAddress srcAddr;
+ final InetAddress dstAddr;
if (family == AF_INET) {
- srcAddrByte = new byte[IPV4_ADDR_LEN];
- dstAddrByte = new byte[IPV4_ADDR_LEN];
+ final byte[] srcAddrByte = new byte[IPV4_ADDR_LEN];
+ final byte[] dstAddrByte = new byte[IPV4_ADDR_LEN];
byteBuffer.get(srcAddrByte);
// Address always uses IPV6_ADDR_LEN in the buffer. So if the address is IPv4, position
// needs to be advanced to the next field.
byteBuffer.position(byteBuffer.position() + (IPV6_ADDR_LEN - IPV4_ADDR_LEN));
byteBuffer.get(dstAddrByte);
byteBuffer.position(byteBuffer.position() + (IPV6_ADDR_LEN - IPV4_ADDR_LEN));
+ try {
+ srcAddr = Inet4Address.getByAddress(srcAddrByte);
+ dstAddr = Inet4Address.getByAddress(dstAddrByte);
+ } catch (UnknownHostException e) {
+ Log.wtf(TAG, "Failed to parse address: " + e);
+ return null;
+ }
} else if (family == AF_INET6) {
- srcAddrByte = new byte[IPV6_ADDR_LEN];
- dstAddrByte = new byte[IPV6_ADDR_LEN];
+ final byte[] srcAddrByte = new byte[IPV6_ADDR_LEN];
+ final byte[] dstAddrByte = new byte[IPV6_ADDR_LEN];
byteBuffer.get(srcAddrByte);
byteBuffer.get(dstAddrByte);
+ try {
+ // Using Inet6Address.getByAddress to be consistent with idiag_family field since
+ // InetAddress.getByAddress returns Inet4Address if the address is v4-mapped v6
+ // address.
+ srcAddr = Inet6Address.getByAddress(
+ null /* host */, srcAddrByte, -1 /* scope_id */);
+ dstAddr = Inet6Address.getByAddress(
+ null /* host */, dstAddrByte, -1 /* scope_id */);
+ } catch (UnknownHostException e) {
+ Log.wtf(TAG, "Failed to parse address: " + e);
+ return null;
+ }
} else {
Log.wtf(TAG, "Invalid address family: " + family);
return null;
}
- final InetSocketAddress srcAddr;
- final InetSocketAddress dstAddr;
- try {
- srcAddr = new InetSocketAddress(InetAddress.getByAddress(srcAddrByte), srcPort);
- dstAddr = new InetSocketAddress(InetAddress.getByAddress(dstAddrByte), dstPort);
- } catch (UnknownHostException e) {
- // Should not happen. UnknownHostException is thrown only if addr byte array is of
- // illegal length.
- Log.wtf(TAG, "Failed to parse address: " + e);
- return null;
- }
+ final InetSocketAddress srcSocketAddr = new InetSocketAddress(srcAddr, srcPort);
+ final InetSocketAddress dstSocketAddr = new InetSocketAddress(dstAddr, dstPort);
byteBuffer.order(ByteOrder.nativeOrder());
final int ifIndex = byteBuffer.getInt();
final long cookie = byteBuffer.getLong();
- return new StructInetDiagSockId(srcAddr, dstAddr, ifIndex, cookie);
+ return new StructInetDiagSockId(srcSocketAddr, dstSocketAddr, ifIndex, cookie);
}
/**
diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/netlink/InetDiagSocketTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/netlink/InetDiagSocketTest.java
index 6837c83..30796d2 100644
--- a/staticlibs/tests/unit/src/com/android/net/module/util/netlink/InetDiagSocketTest.java
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/netlink/InetDiagSocketTest.java
@@ -22,6 +22,8 @@
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.NETLINK_INET_DIAG;
+import static com.android.net.module.util.netlink.NetlinkConstants.SOCK_DESTROY;
+import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_ACK;
import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_DUMP;
import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_REQUEST;
@@ -41,6 +43,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
@@ -49,6 +52,21 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
public class InetDiagSocketTest {
+ // ::FFFF:192.0.2.1
+ private static final byte[] SRC_V4_MAPPED_V6_ADDRESS_BYTES = {
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0xff, (byte) 0xff,
+ (byte) 0xc0, (byte) 0x00, (byte) 0x02, (byte) 0x01,
+ };
+ // ::FFFF:192.0.2.2
+ private static final byte[] DST_V4_MAPPED_V6_ADDRESS_BYTES = {
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0xff, (byte) 0xff,
+ (byte) 0xc0, (byte) 0x00, (byte) 0x02, (byte) 0x02,
+ };
+
// Hexadecimal representation of InetDiagReqV2 request.
private static final String INET_DIAG_REQ_V2_UDP_INET4_HEX =
// struct nlmsghdr
@@ -205,14 +223,14 @@
msg = InetDiagMessage.inetDiagReqV2(IPPROTO_TCP, null, remote, AF_INET6,
NLM_F_REQUEST);
fail("Both remote and local should be null, expected UnknownHostException");
- } catch (NullPointerException e) {
+ } catch (IllegalArgumentException e) {
}
try {
msg = InetDiagMessage.inetDiagReqV2(IPPROTO_TCP, local, null, AF_INET6,
NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
fail("Both remote and local should be null, expected UnknownHostException");
- } catch (NullPointerException e) {
+ } catch (IllegalArgumentException e) {
}
msg = InetDiagMessage.inetDiagReqV2(IPPROTO_TCP, null, null, AF_INET6,
@@ -221,6 +239,85 @@
assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFIED_BYTES, msgExt);
}
+ // Hexadecimal representation of InetDiagReqV2 request with v4-mapped v6 address
+ private static final String INET_DIAG_REQ_V2_TCP_INET6_V4_MAPPED_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0100" + // flags = NLM_F_REQUEST
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "0a" + // family = AF_INET6
+ "06" + // protcol = IPPROTO_TCP
+ "00" + // idiag_ext
+ "00" + // pad
+ "ffffffff" + // idiag_states
+ // inet_diag_sockid
+ "a817" + // idiag_sport = 43031
+ "960f" + // idiag_dport = 38415
+ "00000000000000000000ffffc0000201" + // idiag_src = ::FFFF:192.0.2.1
+ "00000000000000000000ffffc0000202" + // idiag_dst = ::FFFF:192.0.2.2
+ "00000000" + // idiag_if
+ "ffffffffffffffff"; // idiag_cookie = INET_DIAG_NOCOOKIE
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET6_V4_MAPPED_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET6_V4_MAPPED_HEX.toCharArray(), false);
+
+ @Test
+ public void testInetDiagReqV2TcpInet6V4Mapped() throws Exception {
+ final Inet6Address srcAddr = Inet6Address.getByAddress(
+ null /* host */, SRC_V4_MAPPED_V6_ADDRESS_BYTES, -1 /* scope_id */);
+ final Inet6Address dstAddr = Inet6Address.getByAddress(
+ null /* host */, DST_V4_MAPPED_V6_ADDRESS_BYTES, -1 /* scope_id */);
+ final byte[] msg = InetDiagMessage.inetDiagReqV2(
+ IPPROTO_TCP,
+ new InetSocketAddress(srcAddr, 43031),
+ new InetSocketAddress(dstAddr, 38415),
+ AF_INET6,
+ NLM_F_REQUEST);
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_V4_MAPPED_BYTES, msg);
+ }
+
+ // Hexadecimal representation of InetDiagReqV2 request with SOCK_DESTROY
+ private static final String INET_DIAG_REQ_V2_TCP_INET6_DESTROY_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1500" + // type = SOCK_DESTROY
+ "0500" + // flags = NLM_F_REQUEST | NLM_F_ACK
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "0a" + // family = AF_INET6
+ "06" + // protcol = IPPROTO_TCP
+ "00" + // idiag_ext
+ "00" + // pad
+ "ffffffff" + // idiag_states = TCP_ALL_STATES
+ // inet_diag_sockid
+ "a817" + // idiag_sport = 43031
+ "960f" + // idiag_dport = 38415
+ "20010db8000000000000000000000001" + // idiag_src = 2001:db8::1
+ "20010db8000000000000000000000002" + // idiag_dst = 2001:db8::2
+ "07000000" + // idiag_if = 7
+ "5800000000000000"; // idiag_cookie = 88
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET6_DESTROY_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET6_DESTROY_HEX.toCharArray(), false);
+
+ @Test
+ public void testInetDiagReqV2TcpInet6Destroy() throws Exception {
+ final StructInetDiagSockId sockId = new StructInetDiagSockId(
+ new InetSocketAddress(InetAddresses.parseNumericAddress("2001:db8::1"), 43031),
+ new InetSocketAddress(InetAddresses.parseNumericAddress("2001:db8::2"), 38415),
+ 7 /* ifIndex */,
+ 88 /* cookie */);
+ final byte[] msg = InetDiagMessage.inetDiagReqV2(IPPROTO_TCP, sockId, AF_INET6,
+ SOCK_DESTROY, (short) (NLM_F_REQUEST | NLM_F_ACK), 0 /* pad */, 0 /* idiagExt */,
+ TCP_ALL_STATES);
+
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_DESTROY_BYTES, msg);
+ }
+
private void assertNlMsgHdr(StructNlMsgHdr hdr, short type, short flags, int seq, int pid) {
assertNotNull(hdr);
assertEquals(type, hdr.nlmsg_type);
@@ -352,7 +449,7 @@
@Test
public void testParseInetDiagResponse() throws Exception {
final ByteBuffer byteBuffer = ByteBuffer.wrap(INET_DIAG_MSG_BYTES);
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
+ byteBuffer.order(ByteOrder.nativeOrder());
assertInetDiagMsg1(NetlinkMessage.parse(byteBuffer, NETLINK_INET_DIAG));
}
@@ -363,8 +460,87 @@
@Test
public void testParseInetDiagResponseMultiple() {
final ByteBuffer byteBuffer = ByteBuffer.wrap(INET_DIAG_MSG_BYTES_MULTIPLE);
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
+ byteBuffer.order(ByteOrder.nativeOrder());
assertInetDiagMsg1(NetlinkMessage.parse(byteBuffer, NETLINK_INET_DIAG));
assertInetDiagMsg2(NetlinkMessage.parse(byteBuffer, NETLINK_INET_DIAG));
}
+
+ private static final String INET_DIAG_SOCK_ID_V4_MAPPED_V6_HEX =
+ "a845" + // idiag_sport = 43077
+ "01bb" + // idiag_dport = 443
+ "00000000000000000000ffffc0000201" + // idiag_src = ::FFFF:192.0.2.1
+ "00000000000000000000ffffc0000202" + // idiag_dst = ::FFFF:192.0.2.2
+ "08000000" + // idiag_if = 8
+ "6300000000000000"; // idiag_cookie = 99
+
+ private static final byte[] INET_DIAG_SOCK_ID_V4_MAPPED_V6_BYTES =
+ HexEncoding.decode(INET_DIAG_SOCK_ID_V4_MAPPED_V6_HEX.toCharArray(), false);
+
+ @Test
+ public void testParseAndPackInetDiagSockIdV4MappedV6() {
+ final ByteBuffer parseByteBuffer = ByteBuffer.wrap(INET_DIAG_SOCK_ID_V4_MAPPED_V6_BYTES);
+ parseByteBuffer.order(ByteOrder.nativeOrder());
+ final StructInetDiagSockId diagSockId =
+ StructInetDiagSockId.parse(parseByteBuffer, (short) AF_INET6);
+ assertNotNull(diagSockId);
+
+ final ByteBuffer packByteBuffer =
+ ByteBuffer.allocate(INET_DIAG_SOCK_ID_V4_MAPPED_V6_BYTES.length);
+ diagSockId.pack(packByteBuffer);
+
+ // Move position to the head since ByteBuffer#equals compares the values from the current
+ // position.
+ parseByteBuffer.position(0);
+ packByteBuffer.position(0);
+ assertEquals(parseByteBuffer, packByteBuffer);
+ }
+
+ // Hexadecimal representation of InetDiagMessage with v4-mapped v6 address
+ private static final String INET_DIAG_MSG_V4_MAPPED_V6_HEX =
+ // struct nlmsghdr
+ "58000000" + // length = 88
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0200" + // flags = NLM_F_MULTI
+ "00000000" + // seqno
+ "f5220000" + // pid
+ // struct inet_diag_msg
+ "0a" + // family = AF_INET6
+ "01" + // idiag_state = 1
+ "02" + // idiag_timer = 2
+ "03" + // idiag_retrans = 3
+ // inet_diag_sockid
+ "a817" + // idiag_sport = 43031
+ "960f" + // idiag_dport = 38415
+ "00000000000000000000ffffc0000201" + // idiag_src = ::FFFF:192.0.2.1
+ "00000000000000000000ffffc0000202" + // idiag_dst = ::FFFF:192.0.2.2
+ "07000000" + // idiag_if = 7
+ "5800000000000000" + // idiag_cookie = 88
+ "04000000" + // idiag_expires = 4
+ "05000000" + // idiag_rqueue = 5
+ "06000000" + // idiag_wqueue = 6
+ "a3270000" + // idiag_uid = 10147
+ "A57E1900"; // idiag_inode = 1670821
+
+ private static final byte[] INET_DIAG_MSG_V4_MAPPED_V6_BYTES =
+ HexEncoding.decode(INET_DIAG_MSG_V4_MAPPED_V6_HEX.toCharArray(), false);
+
+ @Test
+ public void testParseInetDiagResponseV4MappedV6() throws Exception {
+ final ByteBuffer byteBuffer = ByteBuffer.wrap(INET_DIAG_MSG_V4_MAPPED_V6_BYTES);
+ byteBuffer.order(ByteOrder.nativeOrder());
+ final NetlinkMessage msg = NetlinkMessage.parse(byteBuffer, NETLINK_INET_DIAG);
+
+ assertNotNull(msg);
+ assertTrue(msg instanceof InetDiagMessage);
+ final InetDiagMessage inetDiagMsg = (InetDiagMessage) msg;
+ final Inet6Address srcAddr = Inet6Address.getByAddress(
+ null /* host */, SRC_V4_MAPPED_V6_ADDRESS_BYTES, -1 /* scope_id */);
+ final Inet6Address dstAddr = Inet6Address.getByAddress(
+ null /* host */, DST_V4_MAPPED_V6_ADDRESS_BYTES, -1 /* scope_id */);
+ assertInetDiagSockId(inetDiagMsg.inetDiagMsg.id,
+ new InetSocketAddress(srcAddr, 43031),
+ new InetSocketAddress(dstAddr, 38415),
+ 7 /* ifIndex */,
+ 88 /* cookie */);
+ }
}