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