Libbpf userspace function bpf_prog_detach_opts
Detaches the BPF program corresponding to prog_fd
from a target
which can represent a file descriptor or netdevice ifindex.
Definition
int bpf_prog_detach_opts(int prog_fd, int target, enum bpf_attach_type type, const struct bpf_prog_detach_opts *opts);
Parameters
prog_fd
: BPF program file descriptortarget
: detach location file descriptor or ifindextype
: detach type for the BPF programopts
: options for configuring the detachment
struct bpf_prog_detach_opts
struct bpf_prog_detach_opts {
size_t sz; /* size of this struct for forward/backward compatibility */
__u32 flags;
int relative_fd;
__u32 relative_id;
__u64 expected_revision;
size_t :0;
};
flags
relative_fd
relative_id
expected_revision
Return
0
, on success; negative error code, otherwise (errno
is also set to the error code)
Usage
This function should only be used for specific program types that need to be detached via the BPF_PROG_DETACH
syscall command and you need specific control over this process. In most cases, the bpf_link__detach
or bpf_link__destroy
function should be used.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome