summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maciej Żenczykowski <maze@google.com> 2019-07-02 03:46:29 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-07-02 03:46:29 +0000
commite284b30c81796d91eb2b4b8263ca69695e76f1e2 (patch)
treebf01d222c3c975b049bb32b18509f1044776490a
parent1ca89a995b780a9f757166018aff330fc9673bab (diff)
parent669ef46c58916f09adf8a7cabcb9e8bfa2a2d81b (diff)
Merge "Fix mobile data usage didn't get increased for xlat464 traffic"
-rw-r--r--services/core/java/com/android/server/net/NetworkStatsService.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index 4f4377df0997..90dc700e7d84 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -1180,14 +1180,22 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
}
}
- // Traffic occurring on stacked interfaces is usually clatd,
- // which is already accounted against its final egress interface
- // by the kernel. Thus, we only need to collect stacked
- // interface stats at the UID level.
+ // Traffic occurring on stacked interfaces is usually clatd.
+ // UID stats are always counted on the stacked interface and never
+ // on the base interface, because the packets on the base interface
+ // do not actually match application sockets until they are translated.
+ //
+ // Interface stats are more complicated. Packets subject to BPF offload
+ // never appear on the base interface and only appear on the stacked
+ // interface, so to ensure those packets increment interface stats, interface
+ // stats from stacked interfaces must be collected.
final List<LinkProperties> stackedLinks = state.linkProperties.getStackedLinks();
for (LinkProperties stackedLink : stackedLinks) {
final String stackedIface = stackedLink.getInterfaceName();
if (stackedIface != null) {
+ if (mUseBpfTrafficStats) {
+ findOrCreateNetworkIdentitySet(mActiveIfaces, stackedIface).add(ident);
+ }
findOrCreateNetworkIdentitySet(mActiveUidIfaces, stackedIface).add(ident);
if (isMobile) {
mobileIfaces.add(stackedIface);