diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index 6852e97e14..02258e7a50 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -1650,11 +1650,11 @@ static bool exists(const char* const path) { #define APEXROOT "/apex/com.android.tethering" #define BPFROOT APEXROOT "/etc/bpf/mainline/" -static int loadObject(const unsigned int bpfloader_ver, const char* const prefix, +static int loadObject(const unsigned int bpfloader_ver, const char* const fname, const bool useLibbpf = false) { string progPath = string(BPFROOT) + fname; - int ret = useLibbpf ? loadProgByLibbpf(progPath.c_str(), bpfloader_ver, prefix) : - loadProg(progPath.c_str(), bpfloader_ver, prefix); + int ret = useLibbpf ? loadProgByLibbpf(progPath.c_str(), bpfloader_ver, "") : + loadProg(progPath.c_str(), bpfloader_ver, ""); if (ret) { ALOGE("Failed to load object: %s, ret: %s, libbpf: %d", progPath.c_str(), std::strerror(-ret), useLibbpf); @@ -1667,20 +1667,20 @@ static int loadObject(const unsigned int bpfloader_ver, const char* const prefix static int loadAllObjects(const unsigned int bpfloader_ver) { // S+ Tethering mainline module (network_stack): tether offload // loads under /sys/fs/bpf/tethering: - if (loadObject(bpfloader_ver, "", "offload.o")) return 1; - if (loadObject(bpfloader_ver, "", "test.o")) return 1; + if (loadObject(bpfloader_ver, "offload.o")) return 1; + if (loadObject(bpfloader_ver, "test.o")) return 1; if (isAtLeastT) { // T+ Tethering mainline module loads under: // /sys/fs/bpf/net_shared: shared with netd & system server - if (loadObject(bpfloader_ver, "", "clatd.o")) return 1; - if (loadObject(bpfloader_ver, "", "dscpPolicy.o")) return 1; + if (loadObject(bpfloader_ver, "clatd.o")) return 1; + if (loadObject(bpfloader_ver, "dscpPolicy.o")) return 1; // /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, "", "netd.o")) return 1; + if (loadObject(bpfloader_ver, "netd.o")) return 1; // /sys/fs/bpf/netd_readonly: shared with netd & system server // - netutils_wrapper has no access, netd has read only access