.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "BPFTOOL-NET" 8 "" "" .SH NAME bpftool-net \- tool for inspection of networking related bpf prog attachments .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 \fBbpftool\fP [\fIOPTIONS\fP] \fBnet\fP \fICOMMAND\fP .sp \fIOPTIONS\fP := { { \fB\-j\fP | \fB\-\-json\fP } [{ \fB\-p\fP | \fB\-\-pretty\fP }] | { \fB\-d\fP | \fB\-\-debug\fP } } .sp \fICOMMANDS\fP := { \fBshow\fP | \fBlist\fP | \fBattach\fP | \fBdetach\fP | \fBhelp\fP } .UNINDENT .UNINDENT .SH NET COMMANDS .nf \fBbpftool\fP \fBnet\fP { \fBshow\fP | \fBlist\fP } [ \fBdev\fP \fINAME\fP ] \fBbpftool\fP \fBnet attach\fP \fIATTACH_TYPE\fP \fIPROG\fP \fBdev\fP \fINAME\fP [ \fBoverwrite\fP ] \fBbpftool\fP \fBnet detach\fP \fIATTACH_TYPE\fP \fBdev\fP \fINAME\fP \fBbpftool\fP \fBnet help\fP \fIPROG\fP := { \fBid\fP \fIPROG_ID\fP | \fBpinned\fP \fIFILE\fP | \fBtag\fP \fIPROG_TAG\fP } \fIATTACH_TYPE\fP := { \fBxdp\fP | \fBxdpgeneric\fP | \fBxdpdrv\fP | \fBxdpoffload\fP } .fi .sp .SH DESCRIPTION .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBbpftool net { show | list }\fP [ \fBdev\fP \fINAME\fP ] List bpf program attachments in the kernel networking subsystem. .sp Currently, device driver xdp attachments, tcx, netkit and old\-style tc classifier/action attachments, flow_dissector as well as netfilter attachments are implemented, i.e., for program types \fBBPF_PROG_TYPE_XDP\fP, \fBBPF_PROG_TYPE_SCHED_CLS\fP, \fBBPF_PROG_TYPE_SCHED_ACT\fP, \fBBPF_PROG_TYPE_FLOW_DISSECTOR\fP, \fBBPF_PROG_TYPE_NETFILTER\fP\&. .sp For programs attached to a particular cgroup, e.g., \fBBPF_PROG_TYPE_CGROUP_SKB\fP, \fBBPF_PROG_TYPE_CGROUP_SOCK\fP, \fBBPF_PROG_TYPE_SOCK_OPS\fP and \fBBPF_PROG_TYPE_CGROUP_SOCK_ADDR\fP, users can use \fBbpftool cgroup\fP to dump cgroup attachments. For sk_{filter, skb, msg, reuseport} and lwt/seg6 bpf programs, users should consult other tools, e.g., iproute2. .sp The current output will start with all xdp program attachments, followed by all tcx, netkit, then tc class/qdisc bpf program attachments, then flow_dissector and finally netfilter programs. Both xdp programs and tcx/netkit/tc programs are ordered based on ifindex number. If multiple bpf programs attached to the same networking device through \fBtc\fP, the order will be first all bpf programs attached to tcx, netkit, then tc classes, then all bpf programs attached to non clsact qdiscs, and finally all bpf programs attached to root and clsact qdisc. .TP .B \fBbpftool\fP \fBnet attach\fP \fIATTACH_TYPE\fP \fIPROG\fP \fBdev\fP \fINAME\fP [ \fBoverwrite\fP ] Attach bpf program \fIPROG\fP to network interface \fINAME\fP with type specified by \fIATTACH_TYPE\fP\&. Previously attached bpf program can be replaced by the command used with \fBoverwrite\fP option. Currently, only XDP\-related modes are supported for \fIATTACH_TYPE\fP\&. .sp \fIATTACH_TYPE\fP can be of: \fBxdp\fP \- try native XDP and fallback to generic XDP if NIC driver does not support it; \fBxdpgeneric\fP \- Generic XDP. runs at generic XDP hook when packet already enters receive path as skb; \fBxdpdrv\fP \- Native XDP. runs earliest point in driver\(aqs receive path; \fBxdpoffload\fP \- Offload XDP. runs directly on NIC on each packet reception; .TP .B \fBbpftool\fP \fBnet detach\fP \fIATTACH_TYPE\fP \fBdev\fP \fINAME\fP Detach bpf program attached to network interface \fINAME\fP with type specified by \fIATTACH_TYPE\fP\&. To detach bpf program, same \fIATTACH_TYPE\fP previously used for attach must be specified. Currently, only XDP\-related modes are supported for \fIATTACH_TYPE\fP\&. .TP .B \fBbpftool net help\fP Print short help message. .UNINDENT .UNINDENT .UNINDENT .SH OPTIONS .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \-h\fP,\fB \-\-help Print short help message (similar to \fBbpftool help\fP). .TP .B \-V\fP,\fB \-\-version Print bpftool\(aqs version number (similar to \fBbpftool version\fP), the number of the libbpf version in use, and optional features that were included when bpftool was compiled. Optional features include linking against LLVM or libbfd to provide the disassembler for JIT\-ted programs (\fBbpftool prog dump jited\fP) and usage of BPF skeletons (some features like \fBbpftool prog profile\fP or showing pids associated to BPF objects may rely on it). .TP .B \-j\fP,\fB \-\-json Generate JSON output. For commands that cannot produce JSON, this option has no effect. .TP .B \-p\fP,\fB \-\-pretty Generate human\-readable JSON output. Implies \fB\-j\fP\&. .TP .B \-d\fP,\fB \-\-debug Print all logs available, even debug\-level information. This includes logs from libbpf as well as from the verifier, when attempting to load programs. .UNINDENT .UNINDENT .UNINDENT .SH EXAMPLES .nf \fB# bpftool net\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX xdp: eth0(2) driver id 198 tc: eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act [] eth0(2) clsact/ingress fbflow_icmp id 130246 act [] eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726 eth0(2) clsact/egress cls_fg_dscp id 108619 act [] eth0(2) clsact/egress fbflow_egress id 130245 .EE .UNINDENT .UNINDENT .nf \fB# bpftool \-jp net\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX [{ \(dqxdp\(dq: [{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqmode\(dq: \(dqdriver\(dq, \(dqid\(dq: 198 } ], \(dqtc\(dq: [{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqkind\(dq: \(dqhtb\(dq, \(dqname\(dq: \(dqprefix_matcher.o:[cls_prefix_matcher_htb]\(dq, \(dqid\(dq: 111727, \(dqact\(dq: [] },{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqkind\(dq: \(dqclsact/ingress\(dq, \(dqname\(dq: \(dqfbflow_icmp\(dq, \(dqid\(dq: 130246, \(dqact\(dq: [] },{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqkind\(dq: \(dqclsact/egress\(dq, \(dqname\(dq: \(dqprefix_matcher.o:[cls_prefix_matcher_clsact]\(dq, \(dqid\(dq: 111726, },{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqkind\(dq: \(dqclsact/egress\(dq, \(dqname\(dq: \(dqcls_fg_dscp\(dq, \(dqid\(dq: 108619, \(dqact\(dq: [] },{ \(dqdevname\(dq: \(dqeth0\(dq, \(dqifindex\(dq: 2, \(dqkind\(dq: \(dqclsact/egress\(dq, \(dqname\(dq: \(dqfbflow_egress\(dq, \(dqid\(dq: 130245, } ] } ] .EE .UNINDENT .UNINDENT .nf \fB# bpftool net attach xdpdrv id 16 dev enp6s0np0\fP \fB# bpftool net\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX xdp: enp6s0np0(4) driver id 16 .EE .UNINDENT .UNINDENT .nf \fB# bpftool net attach xdpdrv id 16 dev enp6s0np0\fP \fB# bpftool net attach xdpdrv id 20 dev enp6s0np0 overwrite\fP \fB# bpftool net\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX xdp: enp6s0np0(4) driver id 20 .EE .UNINDENT .UNINDENT .nf \fB# bpftool net attach xdpdrv id 16 dev enp6s0np0\fP \fB# bpftool net detach xdpdrv dev enp6s0np0\fP \fB# bpftool net\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX xdp: .EE .UNINDENT .UNINDENT .SH SEE ALSO .INDENT 0.0 .INDENT 3.5 \fBbpf\fP(2), \fBbpf\-helpers\fP(7), \fBbpftool\fP(8), \fBbpftool\-btf\fP(8), \fBbpftool\-cgroup\fP(8), \fBbpftool\-feature\fP(8), \fBbpftool\-gen\fP(8), \fBbpftool\-iter\fP(8), \fBbpftool\-link\fP(8), \fBbpftool\-map\fP(8), \fBbpftool\-perf\fP(8), \fBbpftool\-prog\fP(8), \fBbpftool\-struct_ops\fP(8) .UNINDENT .UNINDENT .\" Generated by docutils manpage writer. .