bpf: libbpf: retry map creation without the name
authorStanislav Fomichev <sdf@google.com>
Mon, 19 Nov 2018 22:49:01 +0000 (14:49 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 19 Nov 2018 23:49:32 +0000 (00:49 +0100)
commit23499442c319412aa8e54e7a939e2eb531bdd77d
tree6bfd2e191914a24c538ed5d6b850cf05bd4dd836
parent592ee43faf860c1f2c0a4c11838db6fdb974bb78
bpf: libbpf: retry map creation without the name

Since commit 88cda1c9da02 ("bpf: libbpf: Provide basic API support
to specify BPF obj name"), libbpf unconditionally sets bpf_attr->name
for maps. Pre v4.14 kernels don't know about map names and return an
error about unexpected non-zero data. Retry sys_bpf without a map
name to cover older kernels.

v2 changes:
* check for errno == EINVAL as suggested by Daniel Borkmann

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/bpf.c