linux-stable/tools/bpf/bpftool/Documentation
Paul Chaignon ec2025095c bpftool: Match several programs with same tag
When several BPF programs have the same tag, bpftool matches only the
first (in ID order).  This patch changes that behavior such that dump and
show commands return all matched programs.  Commands that require a single
program (e.g., pin and attach) will error out if given a tag that matches
several.  bpftool prog dump will also error out if file or visual are
given and several programs have the given tag.

In the case of the dump command, a program header is added before each
dump only if the tag matches several programs; this patch doesn't change
the output if a single program matches.  The output when several
programs match thus looks as follows.

$ ./bpftool prog dump xlated tag 6deef7357e7b4530
3: cgroup_skb  tag 6deef7357e7b4530  gpl
   0: (bf) r6 = r1
   [...]
   7: (95) exit

4: cgroup_skb  tag 6deef7357e7b4530  gpl
   0: (bf) r6 = r1
   [...]
   7: (95) exit

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/fb1fe943202659a69cd21dd5b907c205af1e1e22.1576263640.git.paul.chaignon@gmail.com
2019-12-15 09:03:18 -08:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
bpftool-btf.rst tools: bpftool: implement "bpftool btf show|list" 2019-08-20 09:51:06 -07:00
bpftool-cgroup.rst tools: bpftool: add support for reporting the effective cgroup progs 2019-07-30 21:15:02 -07:00
bpftool-feature.rst tools: bpftool: add -d option to get debug output from libbpf 2019-05-28 11:02:21 +02:00
bpftool-map.rst tools: bpftool: add "bpftool map freeze" subcommand 2019-08-21 21:17:27 +02:00
bpftool-net.rst tools: bpftool: add documentation for net attach/detach 2019-08-15 17:00:33 -07:00
bpftool-perf.rst tools: bpftool: add -d option to get debug output from libbpf 2019-05-28 11:02:21 +02:00
bpftool-prog.rst bpftool: Match several programs with same tag 2019-12-15 09:03:18 -08:00
bpftool.rst tools: bpftool: make -d option print debug output from verifier 2019-05-28 11:03:26 +02:00