summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2018-11-21 02:11:21 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2018-11-21 23:26:14 +0100
commit5b32a23e1d879b78ee72144311314eccf7581bf4 (patch)
tree495e4f551a51d726483bb5aa77ff7ed621faf574 /tools/lib
parentbpf: libbpf: remove map name retry from bpf_create_map_xattr (diff)
downloadlinux-5b32a23e1d879b78ee72144311314eccf7581bf4.tar.xz
linux-5b32a23e1d879b78ee72144311314eccf7581bf4.zip
bpf: libbpf: don't specify prog name if kernel doesn't support it
Use recently added capability check. See commit 23499442c319 ("bpf: libbpf: retry map creation without the name") for rationale. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/libbpf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index f28e64dd8b5a..edbae2b1b046 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1439,7 +1439,8 @@ load_program(struct bpf_program *prog, struct bpf_insn *insns, int insns_cnt,
memset(&load_attr, 0, sizeof(struct bpf_load_program_attr));
load_attr.prog_type = prog->type;
load_attr.expected_attach_type = prog->expected_attach_type;
- load_attr.name = prog->name;
+ if (prog->caps->name)
+ load_attr.name = prog->name;
load_attr.insns = insns;
load_attr.insns_cnt = insns_cnt;
load_attr.license = license;