From 7a031e81e4b4c04b76a8a2b35877c01393b3e5bb Mon Sep 17 00:00:00 2001 From: nyyu Date: Fri, 2 Dec 2022 21:47:38 +0100 Subject: [PATCH] NetworkStats: disable BPF --- fix-NetworkStats-disable-BPF.patch | 62 ++++++++++++++++++++++++++++++ sync.sh | 5 +++ 2 files changed, 67 insertions(+) create mode 100644 fix-NetworkStats-disable-BPF.patch diff --git a/fix-NetworkStats-disable-BPF.patch b/fix-NetworkStats-disable-BPF.patch new file mode 100644 index 0000000..d39917a --- /dev/null +++ b/fix-NetworkStats-disable-BPF.patch @@ -0,0 +1,62 @@ +From b6eea3c624f846b90d1befa92604cddac1671be4 Mon Sep 17 00:00:00 2001 +From: nyyu +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 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 \ No newline at end of file diff --git a/sync.sh b/sync.sh index 4cfa5c8..3570e44 100644 --- a/sync.sh +++ b/sync.sh @@ -66,6 +66,11 @@ git am $DRONE_WORKSPACE_BASE/fix-bt-3.patch || git am --abort git am $DRONE_WORKSPACE_BASE/fix-bt-le.patch || git am --abort cd $TOPDIR +#connectivity +cd packages/modules/Connectivity +git am $DRONE_WORKSPACE_BASE/fix-NetworkStats-disable-BPF.patch || git am --abort +cd $TOPDIR + #safetynet repopick -f 334348 -P system/core repopick -f 334343 334344 -P frameworks/base \ No newline at end of file