1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 09:46:19 +00:00
treble_evolution/patches/platform_packages_modules_Connectivity/0011-netbpfload-Support-4.14-kernels.patch
2024-04-24 15:13:17 +00:00

35 lines
1.5 KiB
Diff

From cfcbe08fa8b4da3ce29da8537fd9e4103d2996de Mon Sep 17 00:00:00 2001
From: Michael Bestas <mkbestas@gmail.com>
Date: Mon, 11 Mar 2024 01:52:21 +0200
Subject: [PATCH 11/13] netbpfload: Support <4.14 kernels
Change-Id: I3d6573c102c1d64a64209bf61ecb8ed0c4ecb64c
---
netbpfload/NetBpfLoad.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/netbpfload/NetBpfLoad.cpp b/netbpfload/NetBpfLoad.cpp
index ed5193dab7..236adde3da 100644
--- a/netbpfload/NetBpfLoad.cpp
+++ b/netbpfload/NetBpfLoad.cpp
@@ -225,12 +225,14 @@ int main(int argc, char** argv, char * const envp[]) {
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n") &&
+ android::bpf::isAtLeastKernelVersion(4, 14, 0)) return 1;
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n") &&
+ android::bpf::isAtLeastKernelVersion(4, 14, 0)) return 1;
}
// Create all the pin subdirectories
--
2.25.1