Merge "Ignore ipv6 tx traffic on clat uid."
This commit is contained in:
@@ -832,25 +832,23 @@ public class NetworkStatsTest {
|
||||
0 /* operations */);
|
||||
|
||||
// Traffic measured for the root uid on the base interface if eBPF is in use.
|
||||
// Incorrectly includes appEntry's bytes and packets, plus IPv4-IPv6 translation
|
||||
// overhead (20 bytes per packet), only for TX traffic.
|
||||
final NetworkStats.Entry ebpfRootUidEntry = new NetworkStats.Entry(
|
||||
baseIface, rootUid, SET_DEFAULT, TAG_NONE,
|
||||
163577 /* rxBytes */,
|
||||
187 /* rxPackets */,
|
||||
1169942 /* txBytes */,
|
||||
13902 /* txPackets */,
|
||||
17607 /* txBytes */,
|
||||
97 /* txPackets */,
|
||||
0 /* operations */);
|
||||
|
||||
// Traffic measured for the root uid on the base interface if xt_qtaguid is in use.
|
||||
// Incorrectly includes appEntry's bytes and packets, plus IPv4-IPv6 translation
|
||||
// overhead (20 bytes per packet), in both directions.
|
||||
// overhead (20 bytes per packet), in rx direction.
|
||||
final NetworkStats.Entry xtRootUidEntry = new NetworkStats.Entry(
|
||||
baseIface, rootUid, SET_DEFAULT, TAG_NONE,
|
||||
31113087 /* rxBytes */,
|
||||
22588 /* rxPackets */,
|
||||
1169942 /* txBytes */,
|
||||
13902 /* txPackets */,
|
||||
17607 /* txBytes */,
|
||||
97 /* txPackets */,
|
||||
0 /* operations */);
|
||||
|
||||
final NetworkStats.Entry otherEntry = new NetworkStats.Entry(
|
||||
|
||||
@@ -159,7 +159,7 @@ public class NetworkStatsFactoryTest {
|
||||
assertStatsEntry(stats, "v4-wlan0", 1000, SET_DEFAULT, 0x0, 30812L, 2310L);
|
||||
assertStatsEntry(stats, "v4-wlan0", 10102, SET_DEFAULT, 0x0, 10022L, 3330L);
|
||||
assertStatsEntry(stats, "v4-wlan0", 10060, SET_DEFAULT, 0x0, 9532772L, 254112L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, 15229L, 5766L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, 15229L, 0L);
|
||||
assertStatsEntry(stats, "wlan0", 1000, SET_DEFAULT, 0x0, 6126L, 2013L);
|
||||
assertStatsEntry(stats, "wlan0", 10013, SET_DEFAULT, 0x0, 0L, 144L);
|
||||
assertStatsEntry(stats, "wlan0", 10018, SET_DEFAULT, 0x0, 5980263L, 167667L);
|
||||
@@ -170,6 +170,8 @@ public class NetworkStatsFactoryTest {
|
||||
assertStatsEntry(stats, "dummy0", 0, SET_DEFAULT, 0x0, 0L, 168L);
|
||||
assertStatsEntry(stats, "lo", 0, SET_DEFAULT, 0x0, 1288L, 1288L);
|
||||
|
||||
assertNoStatsEntry(stats, "wlan0", 1029, SET_DEFAULT, 0x0);
|
||||
|
||||
NetworkStatsFactory.clearStackedIfaces();
|
||||
}
|
||||
|
||||
@@ -191,12 +193,12 @@ public class NetworkStatsFactoryTest {
|
||||
// Stats snapshot before the download
|
||||
stats = parseDetailedStats(R.raw.xt_qtaguid_with_clat_100mb_download_before);
|
||||
assertStatsEntry(stats, "v4-wlan0", 10106, SET_FOREGROUND, 0x0, appRxBytesBefore, 5199872L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytesBefore, 647888L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytesBefore, 0L);
|
||||
|
||||
// Stats snapshot after the download
|
||||
stats = parseDetailedStats(R.raw.xt_qtaguid_with_clat_100mb_download_after);
|
||||
assertStatsEntry(stats, "v4-wlan0", 10106, SET_FOREGROUND, 0x0, appRxBytesAfter, 7867488L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytesAfter, 647587L);
|
||||
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytesAfter, 0L);
|
||||
|
||||
NetworkStatsFactory.clearStackedIfaces();
|
||||
}
|
||||
@@ -252,6 +254,15 @@ public class NetworkStatsFactoryTest {
|
||||
assertEquals("unexpected txBytes", txBytes, entry.txBytes);
|
||||
}
|
||||
|
||||
private static void assertNoStatsEntry(NetworkStats stats, String iface, int uid, int set,
|
||||
int tag) {
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO,
|
||||
DEFAULT_NETWORK_NO);
|
||||
if (i >= 0) {
|
||||
fail("unexpected NetworkStats entry at " + i);
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertStatsEntry(NetworkStats stats, String iface, int uid, int set,
|
||||
int tag, long rxBytes, long rxPackets, long txBytes, long txPackets) {
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO,
|
||||
|
||||
Reference in New Issue
Block a user