xref: /linux/tools/bpf/bpftool/Documentation/bpftool-net.rst (revision f6f3bac08ff9855d803081a353a1fafaa8845739)
1================
2bpftool-net
3================
4-------------------------------------------------------------------------------
5tool for inspection of netdev/tc related bpf prog attachments
6-------------------------------------------------------------------------------
7
8:Manual section: 8
9
10SYNOPSIS
11========
12
13	**bpftool** [*OPTIONS*] **net** *COMMAND*
14
15	*OPTIONS* := { [{ **-j** | **--json** }] [{ **-p** | **--pretty** }] }
16
17	*COMMANDS* :=
18	{ **show** | **list** } [ **dev** name ] | **help**
19
20NET COMMANDS
21============
22
23|	**bpftool** **net { show | list } [ dev name ]**
24|	**bpftool** **net help**
25
26DESCRIPTION
27===========
28	**bpftool net { show | list } [ dev name ]**
29		  List all networking device driver and tc attachment in the system.
30
31                  Output will start with all xdp program attachment, followed by
32                  all tc class/qdisc bpf program attachments. Both xdp programs and
33                  tc programs are ordered based on ifindex number. If multiple bpf
34                  programs attached to the same networking device through **tc filter**,
35                  the order will be first all bpf programs attached to tc classes, then
36                  all bpf programs attached to non clsact qdiscs, and finally all
37                  bpf programs attached to root and clsact qdisc.
38
39	**bpftool net help**
40		  Print short help message.
41
42OPTIONS
43=======
44	-h, --help
45		  Print short generic help message (similar to **bpftool help**).
46
47	-v, --version
48		  Print version number (similar to **bpftool version**).
49
50	-j, --json
51		  Generate JSON output. For commands that cannot produce JSON, this
52		  option has no effect.
53
54	-p, --pretty
55		  Generate human-readable JSON output. Implies **-j**.
56
57EXAMPLES
58========
59
60| **# bpftool net**
61
62::
63
64      xdp [
65      ifindex 2 devname eth0 prog_id 198
66      ]
67      tc_filters [
68      ifindex 2 kind qdisc_htb name prefix_matcher.o:[cls_prefix_matcher_htb]
69                prog_id 111727 tag d08fe3b4319bc2fd act []
70      ifindex 2 kind qdisc_clsact_ingress name fbflow_icmp
71                prog_id 130246 tag 3f265c7f26db62c9 act []
72      ifindex 2 kind qdisc_clsact_egress name prefix_matcher.o:[cls_prefix_matcher_clsact]
73                prog_id 111726 tag 99a197826974c876
74      ifindex 2 kind qdisc_clsact_egress name cls_fg_dscp
75                prog_id 108619 tag dc4630674fd72dcc act []
76      ifindex 2 kind qdisc_clsact_egress name fbflow_egress
77                prog_id 130245 tag 72d2d830d6888d2c
78      ]
79
80|
81| **# bpftool -jp net**
82
83::
84
85    [{
86            "xdp": [{
87                    "ifindex": 2,
88                    "devname": "eth0",
89                    "prog_id": 198
90                }
91            ],
92            "tc_filters": [{
93                    "ifindex": 2,
94                    "kind": "qdisc_htb",
95                    "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
96                    "prog_id": 111727,
97                    "tag": "d08fe3b4319bc2fd",
98                    "act": []
99                },{
100                    "ifindex": 2,
101                    "kind": "qdisc_clsact_ingress",
102                    "name": "fbflow_icmp",
103                    "prog_id": 130246,
104                    "tag": "3f265c7f26db62c9",
105                    "act": []
106                },{
107                    "ifindex": 2,
108                    "kind": "qdisc_clsact_egress",
109                    "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
110                    "prog_id": 111726,
111                    "tag": "99a197826974c876"
112                },{
113                    "ifindex": 2,
114                    "kind": "qdisc_clsact_egress",
115                    "name": "cls_fg_dscp",
116                    "prog_id": 108619,
117                    "tag": "dc4630674fd72dcc",
118                    "act": []
119                },{
120                    "ifindex": 2,
121                    "kind": "qdisc_clsact_egress",
122                    "name": "fbflow_egress",
123                    "prog_id": 130245,
124                    "tag": "72d2d830d6888d2c"
125                }
126            ]
127        }
128    ]
129
130
131SEE ALSO
132========
133	**bpftool**\ (8), **bpftool-prog**\ (8), **bpftool-map**\ (8)
134