Lines Matching +full:reset +full:- +full:time +full:- +full:sec
1 .. SPDX-License-Identifier: GPL-2.0
10 * ``BPF_CGROUP_GETSOCKOPT`` - called every time process executes ``getsockopt``
12 * ``BPF_CGROUP_SETSOCKOPT`` - called every time process executes ``setsockopt``
26 If BPF program sets ``optlen`` to -1, the control will be returned
30 Note, that ``optlen`` can not be increased beyond the user-supplied
31 value. It can only be decreased or set to -1. Any other value will
35 -----------
37 * ``0`` - reject the syscall, ``EPERM`` will be returned to the userspace.
38 * ``1`` - success, continue with next BPF program in the cgroup chain.
46 the values above, adjust ``optlen`` and reset ``retval`` to 0. If ``optlen``
57 -----------
59 * ``0`` - reject the syscall, ``EPERM`` will be returned to the userspace.
60 * ``1`` - success: copy ``optval`` and ``optlen`` to userspace, return
78 adjust ``optval``, ``optlen`` and reset ``retval`` to 0. After that
110 .. code-block:: c
112 SEC("cgroup/getsockopt")
116 if (ctx->level == MY_SOL && ctx->optname == MY_OPTNAME) {
117 ctx->retval = 0;
119 ctx->optlen = 1;
124 if (ctx->level == SOL_IP && ctx->optname == IP_FREEBIND) {
125 ctx->retval = 0;
127 ctx->optlen = 1;
132 if (ctx->optlen > PAGE_SIZE)
133 ctx->optlen = 0;
138 SEC("cgroup/setsockopt")
142 if (ctx->level == MY_SOL && ctx->optname == MY_OPTNAME) {
144 ctx->optlen = -1;
149 if (ctx->level == SOL_IP && ctx->optname == IP_FREEBIND) {
155 if (ctx->optlen > PAGE_SIZE)
156 ctx->optlen = 0;