Merge changes Ie73ba058,I4393afcb,Ifebd946e,Ib12ee882,Ia171b779

* changes:
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting100MBDownload
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccountingSimple
  fix android.net.NetworkStatsTest#testApply464xlatAdjustments
  NetworkStats - no need for xt_qtaguid clat bw fixups
This commit is contained in:
Maciej Żenczykowski
2020-05-28 09:04:42 +00:00
committed by Gerrit Code Review
5 changed files with 11 additions and 24 deletions

View File

@@ -909,8 +909,8 @@ public class NetworkStatsTest {
13805 /* txPackets */,
0 /* operations */);
// Traffic measured for the root uid on the base interface if eBPF is in use.
final NetworkStats.Entry ebpfRootUidEntry = new NetworkStats.Entry(
// Traffic measured for the root uid on the base interface.
final NetworkStats.Entry rootUidEntry = new NetworkStats.Entry(
baseIface, rootUid, SET_DEFAULT, TAG_NONE,
163577 /* rxBytes */,
187 /* rxPackets */,
@@ -918,17 +918,6 @@ public class NetworkStatsTest {
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 rx direction.
final NetworkStats.Entry xtRootUidEntry = new NetworkStats.Entry(
baseIface, rootUid, SET_DEFAULT, TAG_NONE,
31113087 /* rxBytes */,
22588 /* rxPackets */,
17607 /* txBytes */,
97 /* txPackets */,
0 /* operations */);
final NetworkStats.Entry otherEntry = new NetworkStats.Entry(
otherIface, appUid, SET_DEFAULT, TAG_NONE,
2600 /* rxBytes */,
@@ -939,12 +928,12 @@ public class NetworkStatsTest {
final NetworkStats statsXt = new NetworkStats(TEST_START, 3)
.insertEntry(appEntry)
.insertEntry(xtRootUidEntry)
.insertEntry(rootUidEntry)
.insertEntry(otherEntry);
final NetworkStats statsEbpf = new NetworkStats(TEST_START, 3)
.insertEntry(appEntry)
.insertEntry(ebpfRootUidEntry)
.insertEntry(rootUidEntry)
.insertEntry(otherEntry);
statsXt.apply464xlatAdjustments(stackedIface, false);

View File

@@ -446,7 +446,7 @@ public class NetworkStatsFactoryTest extends NetworkStatsBaseTest {
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, 0L);
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, 0L, 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);
@@ -468,9 +468,7 @@ public class NetworkStatsFactoryTest extends NetworkStatsBaseTest {
long appRxBytesAfter = 439237478L;
assertEquals("App traffic should be ~100MB", 110553449, appRxBytesAfter - appRxBytesBefore);
long rootRxBytesBefore = 1394011L;
long rootRxBytesAfter = 1398634L;
assertEquals("UID 0 traffic should be ~0", 4623, rootRxBytesAfter - rootRxBytesBefore);
long rootRxBytes = 330187296L;
mFactory.noteStackedIface("v4-wlan0", "wlan0");
NetworkStats stats;
@@ -478,12 +476,12 @@ public class NetworkStatsFactoryTest extends NetworkStatsBaseTest {
// 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, 0L);
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytes, 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, 0L);
assertStatsEntry(stats, "wlan0", 0, SET_DEFAULT, 0x0, rootRxBytes, 0L);
}
/**