Merge "enforce 4.14+ instead of program being present" am: d2b8991b27 am: da3add63a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2450307
Change-Id: Ia01ed3db38268e6f7ae79ee3bdd5a4f01a61ad31
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/netd/BpfHandler.cpp b/netd/BpfHandler.cpp
index 7950ff7..2b773c9 100644
--- a/netd/BpfHandler.cpp
+++ b/netd/BpfHandler.cpp
@@ -93,7 +93,7 @@
// cgroup if the program is pinned properly.
// TODO: delete the if statement once all devices should support cgroup
// socket filter (ie. the minimum kernel version required is 4.14).
- if (!access(CGROUP_SOCKET_PROG_PATH, F_OK)) {
+ if (bpf::isAtLeastKernelVersion(4, 14, 0)) {
RETURN_IF_NOT_OK(
attachProgramToCgroup(CGROUP_SOCKET_PROG_PATH, cg_fd, BPF_CGROUP_INET_SOCK_CREATE));
}