]> git.baikalelectronics.ru Git - kernel.git/commit
tools: bpftool: Keep errors for map-of-map dumps if distinct from ENOENT
authorQuentin Monnet <quentin@isovalent.com>
Thu, 10 Sep 2020 10:26:51 +0000 (11:26 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Sep 2020 00:29:20 +0000 (17:29 -0700)
commit587f2e865fbbab3a43730d7cef23146b0657741c
tree196906206ab42c5c2e70f4eb4f5023962638a150
parent22c83c5b6869f56e98b7f755a6a978f32c419298
tools: bpftool: Keep errors for map-of-map dumps if distinct from ENOENT

When dumping outer maps or prog_array maps, and on lookup failure,
bpftool simply skips the entry with no error message. This is because
the kernel returns non-zero when no value is found for the provided key,
which frequently happen for those maps if they have not been filled.

When such a case occurs, errno is set to ENOENT. It seems unlikely we
could receive other error codes at this stage (we successfully retrieved
map info just before), but to be on the safe side, let's skip the entry
only if errno was ENOENT, and not for the other errors.

v3: New patch

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200910102652.10509-3-quentin@isovalent.com
tools/bpf/bpftool/map.c