PacketReflector: Ignore IPv6 flow labels in ICMPv6 test
Since Linux kernel 4.2, net.ipv6.auto_flowlabels is set by default, and
therefore the request and reply may have different IPv6 flow label.
Bug: 31444338
Test: On a kernel 4.4 board, run com.android.cts.net.HostsideNetworkTests#testVpn
Test: On a kernel 3.18 board, run echo 1 > /proc/sys/net/ipv6/auto_flowlabels, then
com.android.cts.net.HostsideNetworkTests#testVpn
Change-Id: I913bbf91574239a24cb32ae908834eb951ea2010
This commit is contained in:
@@ -151,6 +151,15 @@ public class PacketReflector extends Thread {
|
||||
request[hdrLen] = buf[hdrLen]; // Type.
|
||||
request[hdrLen + 2] = buf[hdrLen + 2]; // Checksum byte 1.
|
||||
request[hdrLen + 3] = buf[hdrLen + 3]; // Checksum byte 2.
|
||||
|
||||
// Since Linux kernel 4.2, net.ipv6.auto_flowlabels is set by default, and therefore
|
||||
// the request and reply may have different IPv6 flow label: ignore that as well.
|
||||
if (version == 6) {
|
||||
request[1] = (byte)(request[1] & 0xf0 | buf[1] & 0x0f);
|
||||
request[2] = buf[2];
|
||||
request[3] = buf[3];
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (buf[i] != request[i]) {
|
||||
Log.i(TAG, "Received non-matching packet when expecting ping response.");
|
||||
|
||||
Reference in New Issue
Block a user