linux/tools/bpf/bpftool
Quentin Monnet 39c9f10639 tools: bpftool: reset errno for "bpftool cgroup tree"
When trying to dump the tree of all cgroups under a given root node,
bpftool attempts to query programs of all available attach types. Some
of those attach types do not support queries, therefore several of the
calls are actually expected to fail.

Those calls set errno to EINVAL, which has no consequence for dumping
the rest of the tree. It does have consequences however if errno is
inspected at a later time. For example, bpftool batch mode relies on
errno to determine whether a command has succeeded, and whether it
should carry on with the next command. Setting errno to EINVAL when
everything worked as expected would therefore make such command fail:

        # echo 'cgroup tree \n net show' | \
                bpftool batch file -

To improve this, reset errno when its value is EINVAL after attempting
to show programs for all existing attach types in do_show_tree_fn().

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-04-16 10:13:21 +02:00
..
bash-completion bpf: bpftool, fix documentation for attach types 2019-02-19 17:23:18 +01:00
Documentation tools/bpftool: recognize bpf_prog_info run_time_ns and run_cnt 2019-02-27 17:22:51 +01:00
.gitignore
btf_dumper.c bpf: bpftool support for dumping data/bss/rodata sections 2019-04-09 17:05:47 -07:00
cfg.c
cfg.h
cgroup.c tools: bpftool: reset errno for "bpftool cgroup tree" 2019-04-16 10:13:21 +02:00
common.c
feature.c
jit_disasm.c
json_writer.c
json_writer.h
main.c
main.h
Makefile
map.c bpf: bpftool support for dumping data/bss/rodata sections 2019-04-09 17:05:47 -07:00
map_perf_ring.c
net.c
netlink_dumper.c
netlink_dumper.h
perf.c
prog.c tools: bpftool: remove blank line after btf_id when listing programs 2019-04-16 10:13:12 +02:00
tracelog.c
xlated_dumper.c bpf: implement lookup-free direct value access for maps 2019-04-09 17:05:46 -07:00
xlated_dumper.h