diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index fa0b6f1fec..3f117ce719 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -798,13 +798,11 @@ static bool isBtfSupported(enum bpf_map_type type) { return type != BPF_MAP_TYPE_DEVMAP_HASH && type != BPF_MAP_TYPE_RINGBUF; } -static int pinMap(const borrowed_fd& fd, const string& mapName, const struct bpf_map_def& mapDef, - const string& objName, const string& mapPinLoc) { +static int pinMap(const borrowed_fd& fd, const struct bpf_map_def& mapDef, const string& mapPinLoc) { int ret; if (mapDef.selinux_context[0]) { validatePinDir(mapDef.selinux_context); - string createLoc = string(BPF_FS_PATH) + mapDef.selinux_context + - "tmp_map_" + objName + "_" + mapName; + string createLoc = string(BPF_FS_PATH) + mapDef.selinux_context + "tmp_map"; ret = bpfFdPin(fd, createLoc.c_str()); if (ret) { const int err = errno; @@ -1040,7 +1038,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& // We assume failure is due to pinned map mismatch, hence the 'NOT UNIQUE' return code. if (!mapMatchesExpectations(fd, mapNames[i], md[i], type)) return -ENOTUNIQ; - ret = pinMap(fd, mapNames[i], md[i], objName, mapPinLoc); + ret = pinMap(fd, md[i], mapPinLoc); if (ret) return ret; mapFds.push_back(std::move(fd)); @@ -1102,13 +1100,12 @@ static void applyMapRelo(ifstream& elfFile, vector &mapFds, vector& cs, const if (!fd.ok()) return fd.get(); if (!reuse) { - ret = pinProg(fd, name, cs[i].prog_def.value(), objName, progPinLoc); + ret = pinProg(fd, cs[i].prog_def.value(), progPinLoc); if (ret) return ret; } ret = validateProg(fd, progPinLoc, bpfloader_ver); @@ -1402,7 +1399,7 @@ static int pinMaps(const char* const elfPath, const struct bpf_object* obj, return -1; } - ret = pinMap(bpf_map__fd(m), mapNames[i], md[i], objName, mapPinLoc); + ret = pinMap(bpf_map__fd(m), md[i], mapPinLoc); if (ret) return ret; } return 0; @@ -1433,7 +1430,7 @@ static int pinProgs(const char* const elfPath, const struct bpf_object * obj, } int fd = bpf_program__fd(prog); - ret = pinProg(fd, name, cs[i].prog_def.value(), objName, progPinLoc); + ret = pinProg(fd, cs[i].prog_def.value(), progPinLoc); if (ret) return ret; ret = validateProg(fd, progPinLoc, bpfloader_ver); if (ret) return ret;