From a9209da8713a40f1a396162fc85533838c85a174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 29 Feb 2024 02:01:20 +0000 Subject: [PATCH] NetBpfLoader: create /sys/fs/bpf/loader dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (instead of in platform bpfloader) Better to do it earlier so we can use it for auto/permanently pinned/attached networking programs. Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I202e150e6d48e63ba643c1bd2247cefcdebc07a5 --- netbpfload/NetBpfLoad.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netbpfload/NetBpfLoad.cpp b/netbpfload/NetBpfLoad.cpp index 9dc7cdc4e6..ed7d048279 100644 --- a/netbpfload/NetBpfLoad.cpp +++ b/netbpfload/NetBpfLoad.cpp @@ -369,6 +369,13 @@ int main(int argc, char** argv, char * const envp[]) { if (createSysFsBpfSubDir(location.prefix)) return 1; } + // Note: there's no actual src dir for fs_bpf_loader .o's, + // so it is not listed in 'locations[].prefix'. + // This is because this is primarily meant for triggering genfscon rules, + // and as such this will likely always be the case. + // Thus we need to manually create the /sys/fs/bpf/loader subdirectory. + if (createSysFsBpfSubDir("loader")) return 1; + // Load all ELF objects, create programs and maps, and pin them for (const auto& location : locations) { if (loadAllElfObjects(location) != 0) {