build/fix-NetworkStats-disable-BPF.patch
nyyu 893946fe33
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/deployment/woodpecker Pipeline was successful
upd patches
2022-12-25 22:36:46 +01:00

87 lines
3.7 KiB
Diff

From 50173432aab792769a56d2a7d451d1a65e831532 Mon Sep 17 00:00:00 2001
From: nyyu <mail@nyyu.dev>
Date: Sun, 25 Dec 2022 22:35:09 +0100
Subject: [PATCH] NetworkStats: disable BPF
---
.../native/libs/libnetworkstats/BpfNetworkStats.cpp | 10 +++++-----
.../com/android/server/net/NetworkStatsFactory.java | 2 +-
service/src/com/android/server/BpfNetMaps.java | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
index ee30f3db3..a68407044 100644
--- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
@@ -104,13 +104,13 @@ int bpfGetIfaceStats(const char* iface, Stats* stats) {
int ret;
if (!ifaceStatsMap.isValid() || !ifaceStatsMap.isOk()) {
ret = -errno;
- ALOGE("get ifaceStats map fd failed: %s", strerror(errno));
+ //ALOGE("get ifaceStats map fd failed: %s", strerror(errno));
return ret;
}
BpfMapRO<uint32_t, IfaceValue> ifaceIndexNameMap(IFACE_INDEX_NAME_MAP_PATH);
if (!ifaceIndexNameMap.isValid() || !ifaceStatsMap.isOk()) {
ret = -errno;
- ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
+ //ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
return ret;
}
return bpfGetIfaceStatsInternal(iface, stats, ifaceStatsMap, ifaceIndexNameMap);
@@ -189,7 +189,7 @@ int parseBpfNetworkStatsDetail(std::vector<stats_line>* lines,
BpfMapRO<uint32_t, IfaceValue> ifaceIndexNameMap(IFACE_INDEX_NAME_MAP_PATH);
if (!ifaceIndexNameMap.isValid()) {
int ret = -errno;
- ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
+ //ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
return ret;
}
@@ -266,14 +266,14 @@ int parseBpfNetworkStatsDev(std::vector<stats_line>* lines) {
BpfMapRO<uint32_t, IfaceValue> ifaceIndexNameMap(IFACE_INDEX_NAME_MAP_PATH);
if (!ifaceIndexNameMap.isValid()) {
ret = -errno;
- ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
+ //ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno));
return ret;
}
BpfMapRO<uint32_t, StatsValue> ifaceStatsMap(IFACE_STATS_MAP_PATH);
if (!ifaceStatsMap.isValid()) {
ret = -errno;
- ALOGE("get ifaceStats map fd failed: %s", strerror(errno));
+ //ALOGE("get ifaceStats map fd failed: %s", strerror(errno));
return ret;
}
return parseBpfNetworkStatsDevInternal(lines, ifaceStatsMap, ifaceIndexNameMap);
diff --git a/service-t/src/com/android/server/net/NetworkStatsFactory.java b/service-t/src/com/android/server/net/NetworkStatsFactory.java
index 3b93f1a19..191400841 100644
--- a/service-t/src/com/android/server/net/NetworkStatsFactory.java
+++ b/service-t/src/com/android/server/net/NetworkStatsFactory.java
@@ -164,7 +164,7 @@ public class NetworkStatsFactory {
}
public NetworkStatsFactory(@NonNull Context ctx) {
- this(ctx, new File("/proc/"), true);
+ this(ctx, new File("/proc/"), false);
}
@VisibleForTesting
diff --git a/service/src/com/android/server/BpfNetMaps.java b/service/src/com/android/server/BpfNetMaps.java
index c006bc605..3d1fc9b71 100644
--- a/service/src/com/android/server/BpfNetMaps.java
+++ b/service/src/com/android/server/BpfNetMaps.java
@@ -67,9 +67,9 @@ public class BpfNetMaps {
}
private void maybeThrow(final int err, final String msg) {
- if (err != 0) {
+ /*if (err != 0) {
throw new ServiceSpecificException(err, msg + ": " + Os.strerror(err));
- }
+ }*/
}
/**