Helper function bpf_getsockopt
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Emulate a call to getsockopt() on the socket associated to bpf_socket, which must be a full socket. The level at which the option resides and the name optname of the option must be specified, see getsockopt(2) for more information. The retrieved value is stored in the structure pointed by opval and of length optlen.
bpf_socket should be one of the following:
- struct bpf_sock_ops for BPF_PROG_TYPE_SOCK_OPS.
- struct bpf_sock_addr for BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT and BPF_CGROUP_UNIX_CONNECT.
This helper actually implements a subset of getsockopt(). It supports the same set of _optname_s that is supported by the bpf_setsockopt() helper. The exceptions are TCP_BPF_ is bpf_setsockopt() only and TCP_SAVED_SYN is bpf_getsockopt*() only.
Returns
0 on success, or a negative error in case of failure.
static long (* const bpf_getsockopt)(void *bpf_socket, int level, int optname, void *optval, int optlen) = (void *) 57;
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
This helper call can be used in the following program types:
BPF_PROG_TYPE_CGROUP_SOCKOPT
v5.15BPF_PROG_TYPE_CGROUP_SOCK_ADDR
v5.8BPF_PROG_TYPE_LSM
v6.0BPF_PROG_TYPE_SOCK_OPS
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome