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
64 # bpftool net
65
66
67 xdp:
68 eth0(2) driver id 198
69
70 tc:
71 eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act []
72 eth0(2) clsact/ingress fbflow_icmp id 130246 act []
73 eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726
74 eth0(2) clsact/egress cls_fg_dscp id 108619 act []
75 eth0(2) clsact/egress fbflow_egress id 130245
76
77 # bpftool -jp net
78
79
80 [{
81 "xdp": [{
82 "devname": "eth0",
83 "ifindex": 2,
84 "mode": "driver",
85 "id": 198
86 }
87 ],
88 "tc": [{
89 "devname": "eth0",
90 "ifindex": 2,
91 "kind": "htb",
92 "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
93 "id": 111727,
94 "act": []
95 },{
96 "devname": "eth0",
97 "ifindex": 2,
98 "kind": "clsact/ingress",
99 "name": "fbflow_icmp",
100 "id": 130246,
101 "act": []
102 },{
103 "devname": "eth0",
104 "ifindex": 2,
105 "kind": "clsact/egress",
106 "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
107 "id": 111726,
108 },{
109 "devname": "eth0",
110 "ifindex": 2,
111 "kind": "clsact/egress",
112 "name": "cls_fg_dscp",
113 "id": 108619,
114 "act": []
115 },{
116 "devname": "eth0",
117 "ifindex": 2,
118 "kind": "clsact/egress",
119 "name": "fbflow_egress",
120 "id": 130245,
121 }
122 ]
123 }
124 ]
125
127 bpf(2), bpf-helpers(7), bpftool(8), bpftool-prog(8), bpftool-map(8),
128 bpftool-cgroup(8), bpftool-feature(8), bpftool-perf(8)
129
130
131
132
133 BPFTOOL-NET(8)