Ignore ipv6 tx traffic on clat uid.

Currently, 464xlat counts its ipv6 tx traffic into root uid.
When user is making ipv4 upload over ipv6-only network, ipv4
tx traffic may sometimes be counted faster then ipv6 tx
traffic.

Thus, NetworkStatsService may detect non-monotonic values due
to 464xlat adjustment.

So the solution is that: for clatd, make ipv6 tx traffic counts
into clat uid, and then ignore it in the framework side.

Bug: 118602783
Test: 1. manually verify clatd traffic on clat uid.
      2. runtest frameworks-net

Change-Id: Ifb478b79e3e281918c70e16d1f90682c78f33db1
This commit is contained in:
junyulai
2018-10-30 21:49:38 +08:00
parent 12924cb23b
commit 879dbfa624
6 changed files with 31 additions and 15 deletions

View File

@@ -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(