build/fix-NetworkStats-disable-BPF.patch
2022-12-02 21:51:22 +01:00

62 lines
2.5 KiB
Diff

From b6eea3c624f846b90d1befa92604cddac1671be4 Mon Sep 17 00:00:00 2001
From: nyyu <mail@nyyu.dev>
Date: Fri, 2 Dec 2022 21:18:50 +0100
Subject: [PATCH] NetworkStats: disable BPF
---
service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp | 4 ++--
service-t/src/com/android/server/net/NetworkStatsFactory.java | 2 +-
service/src/com/android/server/BpfNetMaps.java | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
index 0948598df..0ee628bb8 100644
--- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
@@ -100,13 +100,13 @@ int bpfGetIfaceStats(const char* iface, Stats* stats) {
int ret;
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;
}
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;
}
return bpfGetIfaceStatsInternal(iface, stats, 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));
- }
+ }*/
}
/**
--
2.38.1