summaryrefslogtreecommitdiff
path: root/bpfloader/BpfLoader.cpp
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2022-12-10 10:24:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-12-10 10:24:43 +0000
commitb909fed62affbc89ce5d98065d3144de319c102a (patch)
tree678719ba07d2398993e43c6472cf6d184f94073b /bpfloader/BpfLoader.cpp
parenta9b54078f4d98b2d738b9e9221e637471db870d9 (diff)
parent6c0ce9f17a1f3a3fb0ed4123d123a01abd30a239 (diff)
downloadbpf-b909fed62affbc89ce5d98065d3144de319c102a.tar.gz
Merge "bpfloader: pass whole struct Location to loadProg()"
Diffstat (limited to 'bpfloader/BpfLoader.cpp')
-rw-r--r--bpfloader/BpfLoader.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index ea074fa..313b097 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -118,15 +118,8 @@ constexpr bpf_prog_type kVendorAllowedProgTypes[] = {
BPF_PROG_TYPE_SOCKET_FILTER,
};
-struct Location {
- const char* const dir;
- const char* const prefix;
- unsigned long long allowedDomainBitmask;
- const bpf_prog_type* allowedProgTypes = nullptr;
- size_t allowedProgTypesLength = 0;
-};
-const Location locations[] = {
+const android::bpf::Location locations[] = {
// S+ Tethering mainline module (network_stack): tether offload
{
.dir = "/apex/com.android.tethering/etc/bpf/",
@@ -187,7 +180,7 @@ const Location locations[] = {
},
};
-int loadAllElfObjects(const Location& location) {
+int loadAllElfObjects(const android::bpf::Location& location) {
int retVal = 0;
DIR* dir;
struct dirent* ent;
@@ -201,11 +194,7 @@ int loadAllElfObjects(const Location& location) {
progPath += s;
bool critical;
- int ret = android::bpf::loadProg(progPath.c_str(), &critical,
- location.prefix,
- location.allowedDomainBitmask,
- location.allowedProgTypes,
- location.allowedProgTypesLength);
+ int ret = android::bpf::loadProg(progPath.c_str(), &critical, location);
if (ret) {
if (critical) retVal = ret;
ALOGE("Failed to load object: %s, ret: %s", progPath.c_str(), std::strerror(-ret));