1
0
Fork 0
alistair23-linux/tools/bpf/bpftool
Yonghong Song f6f3bac08f tools/bpf: bpftool: add net support
Add "bpftool net" support. Networking devices are enumerated
to dump device index/name associated with xdp progs.

For each networking device, tc classes and qdiscs are enumerated
in order to check their bpf filters.
In addition, root handle and clsact ingress/egress are also checked for
bpf filters.  Not all filter information is printed out. Only ifindex,
kind, filter name, prog_id and tag are printed out, which are good
enough to show attachment information. If the filter action
is a bpf action, its bpf program id, bpf name and tag will be
printed out as well.

For example,
  $ ./bpftool net
  xdp [
  ifindex 2 devname eth0 prog_id 198
  ]
  tc_filters [
  ifindex 2 kind qdisc_htb name prefix_matcher.o:[cls_prefix_matcher_htb]
            prog_id 111727 tag d08fe3b4319bc2fd act []
  ifindex 2 kind qdisc_clsact_ingress name fbflow_icmp
            prog_id 130246 tag 3f265c7f26db62c9 act []
  ifindex 2 kind qdisc_clsact_egress name prefix_matcher.o:[cls_prefix_matcher_clsact]
            prog_id 111726 tag 99a197826974c876
  ifindex 2 kind qdisc_clsact_egress name cls_fg_dscp
            prog_id 108619 tag dc4630674fd72dcc act []
  ifindex 2 kind qdisc_clsact_egress name fbflow_egress
            prog_id 130245 tag 72d2d830d6888d2c
  ]
  $ ./bpftool -jp net
  [{
        "xdp": [{
                "ifindex": 2,
                "devname": "eth0",
                "prog_id": 198
            }
        ],
        "tc_filters": [{
                "ifindex": 2,
                "kind": "qdisc_htb",
                "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
                "prog_id": 111727,
                "tag": "d08fe3b4319bc2fd",
                "act": []
            },{
                "ifindex": 2,
                "kind": "qdisc_clsact_ingress",
                "name": "fbflow_icmp",
                "prog_id": 130246,
                "tag": "3f265c7f26db62c9",
                "act": []
            },{
                "ifindex": 2,
                "kind": "qdisc_clsact_egress",
                "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
                "prog_id": 111726,
                "tag": "99a197826974c876"
            },{
                "ifindex": 2,
                "kind": "qdisc_clsact_egress",
                "name": "cls_fg_dscp",
                "prog_id": 108619,
                "tag": "dc4630674fd72dcc",
                "act": []
            },{
                "ifindex": 2,
                "kind": "qdisc_clsact_egress",
                "name": "fbflow_egress",
                "prog_id": 130245,
                "tag": "72d2d830d6888d2c"
            }
        ]
    }
  ]

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-09-06 22:34:08 -07:00
..
Documentation tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
bash-completion tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
.gitignore tools/bpftool: ignore build products 2018-07-26 02:50:26 +02:00
Makefile tools: bpftool: don't pass FEATURES_DUMP to libbpf 2018-07-16 16:36:57 -07:00
btf_dumper.c bpf: btf: add btf print functionality 2018-07-14 13:00:40 +02:00
cfg.c tools: bpftool: generate .dot graph from CFG information 2018-03-01 18:29:49 -08:00
cfg.h tools: bpftool: detect sub-programs from the eBPF sequence 2018-03-01 18:29:48 -08:00
cgroup.c bpftool: introduce cgroup tree command 2018-07-07 01:38:38 +02:00
common.c Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net 2018-07-24 19:21:58 -07:00
jit_disasm.c tools: bpftool: improve architecture detection by using ifindex 2018-01-18 01:26:15 +01:00
json_writer.c tools: bpftool: add JSON output for `bpftool prog dump xlated *` command 2017-10-24 01:25:08 +01:00
json_writer.h tools: bpftool: add JSON output for `bpftool prog dump xlated *` command 2017-10-24 01:25:08 +01:00
main.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
main.h tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
map.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-09-04 21:33:03 -07:00
map_perf_ring.c tools: bpftool: return from do_event_pipe() on bad arguments 2018-08-23 20:17:57 +02:00
net.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
netlink_dumper.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
netlink_dumper.h tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
perf.c tools/bpftool: fix a bug in bpftool perf 2018-06-13 02:03:17 +02:00
prog.c tools: bpftool: allow reuse of maps with bpftool prog load 2018-07-11 22:13:34 +02:00
xlated_dumper.c tools: bpf: make use of reallocarray 2018-07-11 22:13:34 +02:00
xlated_dumper.h tools: bpftool: add delimiters to multi-function JITed dumps 2018-05-24 09:20:50 +02:00