From d0bb172371c7df041b366010d3682f1bf458a7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 22 Apr 2024 23:30:42 +0000 Subject: [PATCH] NetBpfLoad: map names are only valid on 4.15+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $ git checkout v4.14 HEAD is now at bebc6082da0a Linux 4.14 $ git grep map_name | egrep -v '^(arch|drivers|fs|include|samples|tools)/' (nothing) $ git checkout v4.15 HEAD is now at d8a5b80568a9 Linux 4.15 $ git co remotes/linux-$ git grep map_name | egrep -v '^(arch|drivers|fs|include|samples|tools)/' kernel/bpf/syscall.c:381:#define BPF_MAP_CREATE_LAST_FIELD map_name kernel/bpf/syscall.c:408: err = bpf_obj_name_cpy(map->name, attr->map_name); commit ad5b177bd73f5107d97c36f56395c4281fb6f089 Author: Martin KaFai Lau Date: Wed Sep 27 14:37:53 2017 -0700 bpf: Add map_name to bpf_map_info $ git describe ad5b177bd73f5 v4.14-rc1-662-gad5b177bd73f Bug: 335390828 Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I74f8ac8bbf78184a06b3ce005d0bb520b1d1feeb --- netbpfload/loader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbpfload/loader.cpp b/netbpfload/loader.cpp index a2fa4b85d1..f5e45d6684 100644 --- a/netbpfload/loader.cpp +++ b/netbpfload/loader.cpp @@ -769,7 +769,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& .max_entries = max_entries, .map_flags = md[i].map_flags, }; - if (isAtLeastKernelVersion(4, 14, 0)) + if (isAtLeastKernelVersion(4, 15, 0)) strlcpy(req.map_name, mapNames[i].c_str(), sizeof(req.map_name)); fd.reset(bpf(BPF_MAP_CREATE, req)); saved_errno = errno;