1BPFTOOL-NET(8) BPFTOOL-NET(8)
2
3
4
6 bpftool-net - tool for inspection of netdev/tc related bpf prog attach‐
7 ments
8
10 bpftool [OPTIONS] net COMMAND
11
12 OPTIONS := { [{ -j | --json }] [{ -p | --pretty }] }
13
14 COMMANDS := { show | list } [ dev name ] | help
15
17 bpftool net { show | list } [ dev name ]
18 bpftool net help
19
20
22 bpftool net { show | list } [ dev name ]
23 List bpf program attachments in the kernel networking subsys‐
24 tem.
25
26 Currently, only device driver xdp attachments and tc filter
27 classification/action attachments are implemented, i.e., for
28 program types BPF_PROG_TYPE_SCHED_CLS,
29 BPF_PROG_TYPE_SCHED_ACT and BPF_PROG_TYPE_XDP. For programs
30 attached to a particular cgroup, e.g.,
31 BPF_PROG_TYPE_CGROUP_SKB, BPF_PROG_TYPE_CGROUP_SOCK,
32 BPF_PROG_TYPE_SOCK_OPS and BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
33 users can use bpftool cgroup to dump cgroup attachments. For
34 sk_{filter, skb, msg, reuseport} and lwt/seg6 bpf programs,
35 users should consult other tools, e.g., iproute2.
36
37 The current output will start with all xdp program attach‐
38 ments, followed by all tc class/qdisc bpf program attach‐
39 ments. Both xdp programs and tc programs are ordered based on
40 ifindex number. If multiple bpf programs attached to the same
41 networking device through tc filter, the order will be first
42 all bpf programs attached to tc classes, then all bpf pro‐
43 grams attached to non clsact qdiscs, and finally all bpf pro‐
44 grams attached to root and clsact qdisc.
45
46 bpftool net help
47 Print short help message.
48
50 -h, --help
51 Print short generic help message (similar to bpftool help).
52
53 -V, --version
54 Print version number (similar to bpftool version).
55
56 -j, --json
57 Generate JSON output. For commands that cannot produce JSON,
58 this option has no effect.
59
60 -p, --pretty
61 Generate human-readable JSON output. Implies -j.
62
63 -d, --debug
64 Print all logs available from libbpf, including debug-level
65 information.
66
68 # bpftool net
69
70
71 xdp:
72 eth0(2) driver id 198
73
74 tc:
75 eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act []
76 eth0(2) clsact/ingress fbflow_icmp id 130246 act []
77 eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726
78 eth0(2) clsact/egress cls_fg_dscp id 108619 act []
79 eth0(2) clsact/egress fbflow_egress id 130245
80
81 # bpftool -jp net
82
83
84 [{
85 "xdp": [{
86 "devname": "eth0",
87 "ifindex": 2,
88 "mode": "driver",
89 "id": 198
90 }
91 ],
92 "tc": [{
93 "devname": "eth0",
94 "ifindex": 2,
95 "kind": "htb",
96 "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
97 "id": 111727,
98 "act": []
99 },{
100 "devname": "eth0",
101 "ifindex": 2,
102 "kind": "clsact/ingress",
103 "name": "fbflow_icmp",
104 "id": 130246,
105 "act": []
106 },{
107 "devname": "eth0",
108 "ifindex": 2,
109 "kind": "clsact/egress",
110 "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
111 "id": 111726,
112 },{
113 "devname": "eth0",
114 "ifindex": 2,
115 "kind": "clsact/egress",
116 "name": "cls_fg_dscp",
117 "id": 108619,
118 "act": []
119 },{
120 "devname": "eth0",
121 "ifindex": 2,
122 "kind": "clsact/egress",
123 "name": "fbflow_egress",
124 "id": 130245,
125 }
126 ]
127 }
128 ]
129
131 bpf(2), bpf-helpers(7), bpftool(8), bpftool-prog(8), bpftool-map(8),
132 bpftool-cgroup(8), bpftool-feature(8), bpftool-perf(8),
133 bpftool-btf(8)
134
135
136
137
138 BPFTOOL-NET(8)