From 16a2448bd8262a8ff03c23f6c3ebdd8564e7e4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 28 Jul 2025 15:32:09 -0700 Subject: [PATCH] NetBpfLoad: remove 'prefix' from lookupPinSubDir() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: TreeHugger Flag: EXEMPT mainline/noop Signed-off-by: Maciej Żenczykowski Change-Id: Ief8e0d44efc5b1bc235ba70d78875c0ef0e9ed76 --- bpf/loader/NetBpfLoad.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index 89269b1812..ed3507ac38 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -172,9 +172,9 @@ domain getDomainFromSelinuxContext(const char s[BPF_PIN_SUBDIR_CHAR_ARRAY_SIZE]) abort(); } -constexpr const char* lookupPinSubdir(const domain d, const char* const unspecified = "") { +constexpr const char* lookupPinSubdir(const domain d) { switch (d) { - case domain::unspecified: return unspecified; + case domain::unspecified: return ""; case domain::tethering: return "tethering/"; case domain::net_private: return "net_private/"; case domain::net_shared: return "net_shared/"; @@ -983,7 +983,7 @@ static enum bpf_map_type sanitizeMapType(enum bpf_map_type type) { static string buildMapPinLoc(const domain pin_subdir, const string& objName, const string& mapName) { // Format of pin location is /sys/fs/bpf/map__ // Note: refers to the extension-less basename of the .o file (without @ suffix). - return string(BPF_FS_PATH) + lookupPinSubdir(pin_subdir, "") + "map_" + + return string(BPF_FS_PATH) + lookupPinSubdir(pin_subdir) + "map_" + objName + "_" + mapName; } @@ -1268,7 +1268,7 @@ static int validateProg(const borrowed_fd& fd, string& progPinLoc, static string buildProgPinLoc(const domain pin_subdir, const string& objName, const string& name) { // Format of pin location is // /sys/fs/bpf/prog__ - return string(BPF_FS_PATH) + lookupPinSubdir(pin_subdir, "") + "prog_" + + return string(BPF_FS_PATH) + lookupPinSubdir(pin_subdir) + "prog_" + objName + '_' + string(name); }