enforce 4.14+ instead of program being present
These two checks are theoretically equivalent, since netd.o marks the program as requiring 4.14+. Thus unless netd.o bpf program is broken, or bpfloader is misbehaving, this change is a no-op. Bug: 270276754 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I2c6982e7476c2fa56b67532c80d97d7389030d32
This commit is contained in:
@@ -93,7 +93,7 @@ static Status initPrograms(const char* cg2_path) {
|
|||||||
// cgroup if the program is pinned properly.
|
// cgroup if the program is pinned properly.
|
||||||
// TODO: delete the if statement once all devices should support cgroup
|
// TODO: delete the if statement once all devices should support cgroup
|
||||||
// socket filter (ie. the minimum kernel version required is 4.14).
|
// 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(
|
RETURN_IF_NOT_OK(
|
||||||
attachProgramToCgroup(CGROUP_SOCKET_PROG_PATH, cg_fd, BPF_CGROUP_INET_SOCK_CREATE));
|
attachProgramToCgroup(CGROUP_SOCKET_PROG_PATH, cg_fd, BPF_CGROUP_INET_SOCK_CREATE));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user