NetBpfLoad: make loadAllObjects() return a bool
Test: TreeHugger Flag: EXEMPT mainline/noop Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I7c89482e9a567f5f6587508b77f398d6e9873d27
This commit is contained in:
parent
c4f8517a7f
commit
e4a5161d63
1 changed files with 8 additions and 8 deletions
|
|
@ -1454,30 +1454,30 @@ static int loadObject(const unsigned int bpfloader_ver,
|
|||
#define APEXROOT "/apex/com.android.tethering"
|
||||
#define BPFROOT APEXROOT "/etc/bpf/mainline/"
|
||||
|
||||
static int loadAllObjects(const unsigned int bpfloader_ver) {
|
||||
static bool loadAllObjects(const unsigned int bpfloader_ver) {
|
||||
// S+ Tethering mainline module (network_stack): tether offload
|
||||
// loads under /sys/fs/bpf/tethering:
|
||||
if (loadObject(bpfloader_ver, BPFROOT "offload.o")) return 1;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "test.o", isAtLeast25Q3)) return 1;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "offload.o")) return false;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "test.o", isAtLeast25Q3)) return false;
|
||||
if (isAtLeastT) {
|
||||
// T+ Tethering mainline module loads under:
|
||||
// /sys/fs/bpf/net_shared: shared with netd & system server
|
||||
if (loadObject(bpfloader_ver, BPFROOT "clatd.o", isAtLeast25Q3)) return 1;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "dscpPolicy.o", isAtLeast25Q3)) return 1;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "clatd.o", isAtLeast25Q3)) return false;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "dscpPolicy.o", isAtLeast25Q3)) return false;
|
||||
|
||||
// /sys/fs/bpf/netd_shared: shared with netd & system server
|
||||
// - netutils_wrapper (for iptables xt_bpf) has access to programs
|
||||
|
||||
// WARNING: Android T+ non-updatable netd depends on both of the
|
||||
// 'netd_shared' & 'netd' strings for xt_bpf programs it loads
|
||||
if (loadObject(bpfloader_ver, BPFROOT "netd.o", isAtLeast25Q3)) return 1;
|
||||
if (loadObject(bpfloader_ver, BPFROOT "netd.o", isAtLeast25Q3)) return false;
|
||||
|
||||
// /sys/fs/bpf/netd_readonly: shared with netd & system server
|
||||
// - netutils_wrapper has no access, netd has read only access
|
||||
|
||||
// /sys/fs/bpf/net_private: not shared, just network_stack
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool createDir(const char* const dir) {
|
||||
|
|
@ -1963,7 +1963,7 @@ static int doLoad(char** argv, char * const envp[]) {
|
|||
}
|
||||
|
||||
// Load all ELF objects, create programs and maps, and pin them
|
||||
if (loadAllObjects(bpfloader_ver)) {
|
||||
if (!loadAllObjects(bpfloader_ver)) {
|
||||
ALOGE("=== CRITICAL FAILURE LOADING BPF PROGRAMS ===");
|
||||
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
|
||||
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
|
||||
|
|
|
|||
Loading…
Reference in a new issue