mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 09:46:19 +00:00
36 lines
1.5 KiB
Diff
36 lines
1.5 KiB
Diff
From 3fea90120a6b30b977596b8af8646a97a29c570e Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Wed, 26 Oct 2022 18:10:04 -0400
|
|
Subject: [PATCH 01/13] Allow failing to load bpf programs, for BPF-less
|
|
devices
|
|
|
|
Change-Id: I68ba3be2e15c188e56e32a6ecf844e1ca64d560f
|
|
---
|
|
netd/BpfHandler.cpp | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/netd/BpfHandler.cpp b/netd/BpfHandler.cpp
|
|
index a00c363254..aaaa41c6d7 100644
|
|
--- a/netd/BpfHandler.cpp
|
|
+++ b/netd/BpfHandler.cpp
|
|
@@ -125,8 +125,14 @@ static Status initPrograms(const char* cg2_path) {
|
|
RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_DENYLIST_PROG_PATH));
|
|
RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_EGRESS_PROG_PATH));
|
|
RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_INGRESS_PROG_PATH));
|
|
- RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS));
|
|
- RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS));
|
|
+ auto ret = attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS);
|
|
+ if (!isOk(ret)) {
|
|
+ ALOGE("Failed loading egress program");
|
|
+ }
|
|
+ auto ret2 = attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS);
|
|
+ if (!isOk(ret)) {
|
|
+ ALOGE("Failed loading ingress program");
|
|
+ }
|
|
|
|
// For the devices that support cgroup socket filter, the socket filter
|
|
// should be loaded successfully by bpfloader. So we attach the filter to
|
|
--
|
|
2.25.1
|
|
|