Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) bpftool-cgroup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) -------------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) tool for inspection and simple manipulation of eBPF progs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) -------------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) :Manual section: 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	**bpftool** [*OPTIONS*] **cgroup** *COMMAND*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	*COMMANDS* :=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	{ **show** | **list** | **tree** | **attach** | **detach** | **help** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) CGROUP COMMANDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) |	**bpftool** **cgroup** { **show** | **list** } *CGROUP* [**effective**]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) |	**bpftool** **cgroup tree** [*CGROUP_ROOT*] [**effective**]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) |	**bpftool** **cgroup attach** *CGROUP* *ATTACH_TYPE* *PROG* [*ATTACH_FLAGS*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) |	**bpftool** **cgroup detach** *CGROUP* *ATTACH_TYPE* *PROG*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) |	**bpftool** **cgroup help**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) |	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) |	*ATTACH_TYPE* := { **ingress** | **egress** | **sock_create** | **sock_ops** | **device** |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) |		**bind4** | **bind6** | **post_bind4** | **post_bind6** | **connect4** | **connect6** |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) |               **getpeername4** | **getpeername6** | **getsockname4** | **getsockname6** | **sendmsg4** |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) |               **sendmsg6** | **recvmsg4** | **recvmsg6** | **sysctl** | **getsockopt** | **setsockopt** |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) |               **sock_release** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) |	*ATTACH_FLAGS* := { **multi** | **override** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	**bpftool cgroup { show | list }** *CGROUP* [**effective**]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		  List all programs attached to the cgroup *CGROUP*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		  Output will start with program ID followed by attach type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		  attach flags and program name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		  If **effective** is specified retrieve effective programs that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		  will execute for events within a cgroup. This includes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		  inherited along with attached ones.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	**bpftool cgroup tree** [*CGROUP_ROOT*] [**effective**]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		  Iterate over all cgroups in *CGROUP_ROOT* and list all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		  attached programs. If *CGROUP_ROOT* is not specified,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		  bpftool uses cgroup v2 mountpoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		  The output is similar to the output of cgroup show/list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		  commands: it starts with absolute cgroup path, followed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		  program ID, attach type, attach flags and program name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		  If **effective** is specified retrieve effective programs that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		  will execute for events within a cgroup. This includes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		  inherited along with attached ones.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	**bpftool cgroup attach** *CGROUP* *ATTACH_TYPE* *PROG* [*ATTACH_FLAGS*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		  Attach program *PROG* to the cgroup *CGROUP* with attach type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		  *ATTACH_TYPE* and optional *ATTACH_FLAGS*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		  *ATTACH_FLAGS* can be one of: **override** if a sub-cgroup installs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		  some bpf program, the program in this cgroup yields to sub-cgroup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		  program; **multi** if a sub-cgroup installs some bpf program,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		  that cgroup program gets run in addition to the program in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		  cgroup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		  Only one program is allowed to be attached to a cgroup with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		  no attach flags or the **override** flag. Attaching another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		  program will release old program and attach the new one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		  Multiple programs are allowed to be attached to a cgroup with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		  **multi**. They are executed in FIFO order (those that were
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		  attached first, run first).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		  Non-default *ATTACH_FLAGS* are supported by kernel version 4.14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		  and later.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		  *ATTACH_TYPE* can be on of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		  **ingress** ingress path of the inet socket (since 4.10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		  **egress** egress path of the inet socket (since 4.10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		  **sock_create** opening of an inet socket (since 4.10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		  **sock_ops** various socket operations (since 4.12);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		  **device** device access (since 4.15);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		  **bind4** call to bind(2) for an inet4 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		  **bind6** call to bind(2) for an inet6 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		  **post_bind4** return from bind(2) for an inet4 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		  **post_bind6** return from bind(2) for an inet6 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		  **connect4** call to connect(2) for an inet4 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		  **connect6** call to connect(2) for an inet6 socket (since 4.17);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		  **sendmsg4** call to sendto(2), sendmsg(2), sendmmsg(2) for an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		  unconnected udp4 socket (since 4.18);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		  **sendmsg6** call to sendto(2), sendmsg(2), sendmmsg(2) for an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		  unconnected udp6 socket (since 4.18);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		  **recvmsg4** call to recvfrom(2), recvmsg(2), recvmmsg(2) for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)                   an unconnected udp4 socket (since 5.2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		  **recvmsg6** call to recvfrom(2), recvmsg(2), recvmmsg(2) for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)                   an unconnected udp6 socket (since 5.2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		  **sysctl** sysctl access (since 5.2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		  **getsockopt** call to getsockopt (since 5.3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		  **setsockopt** call to setsockopt (since 5.3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		  **getpeername4** call to getpeername(2) for an inet4 socket (since 5.8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		  **getpeername6** call to getpeername(2) for an inet6 socket (since 5.8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		  **getsockname4** call to getsockname(2) for an inet4 socket (since 5.8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		  **getsockname6** call to getsockname(2) for an inet6 socket (since 5.8).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		  **sock_release** closing an userspace inet socket (since 5.9).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	**bpftool cgroup detach** *CGROUP* *ATTACH_TYPE* *PROG*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		  Detach *PROG* from the cgroup *CGROUP* and attach type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		  *ATTACH_TYPE*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	**bpftool prog help**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		  Print short help message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.. include:: common_options.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	-f, --bpffs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		  Show file names of pinned programs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) EXAMPLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) | **# mount -t bpf none /sys/fs/bpf/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) | **# mkdir /sys/fs/cgroup/test.slice**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) | **# bpftool prog load ./device_cgroup.o /sys/fs/bpf/prog**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) | **# bpftool cgroup attach /sys/fs/cgroup/test.slice/ device id 1 allow_multi**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) **# bpftool cgroup list /sys/fs/cgroup/test.slice/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)     ID       AttachType      AttachFlags     Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)     1        device          allow_multi     bpf_prog1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) | **# bpftool cgroup detach /sys/fs/cgroup/test.slice/ device id 1**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) | **# bpftool cgroup list /sys/fs/cgroup/test.slice/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)     ID       AttachType      AttachFlags     Name