build/fix-NetworkStats-disable-BPF.patch

87 lines
3.7 KiB
Diff
Raw Normal View History

2022-12-25 22:36:46 +01:00
From 50173432aab792769a56d2a7d451d1a65e831532 Mon Sep 17 00:00:00 2001
2022-12-02 21:47:38 +01:00
From: nyyu <mail@nyyu.dev>
2022-12-25 22:36:46 +01:00
Date: Sun, 25 Dec 2022 22:35:09 +0100
2023-05-28 08:47:33 +02:00
Subject: [PATCH] XXXHIDEXXX NetworkStats: disable BPF
2022-12-02 21:47:38 +01:00
---
2022-12-25 22:36:46 +01:00
.../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(-)
2022-12-02 21:47:38 +01:00
diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
2022-12-25 22:36:46 +01:00
index ee30f3db3..a68407044 100644
2022-12-02 21:47:38 +01:00
--- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
2022-12-25 22:36:46 +01:00
@@ -104,13 +104,13 @@ int bpfGetIfaceStats(const char* iface, Stats* stats) {
2022-12-02 21:47:38 +01:00
int ret;
2022-12-25 22:36:46 +01:00
if (!ifaceStatsMap.isValid() || !ifaceStatsMap.isOk()) {
2022-12-02 21:47:38 +01:00
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);
2022-12-25 22:36:46 +01:00
if (!ifaceIndexNameMap.isValid() || !ifaceStatsMap.isOk()) {
2022-12-02 21:47:38 +01:00
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);
2022-12-25 22:36:46 +01:00
@@ -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);
2022-12-02 21:47:38 +01:00
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));
- }
+ }*/
}
/**