Libbpf userspace function bpf_program__attach_sockmap
Attach a BPF_PROG_TYPE_SK_SKB or BPF_PROG_TYPE_SK_MSG program to a BPF_MAP_TYPE_SOCKMAP or BPF_MAP_TYPE_SOCKHASH map.
Definition
struct bpf_link * bpf_program__attach_sockmap(const struct bpf_program *prog, int map_fd);
Parameters
prog: BPF program to attachmap_fd: file descriptor of theBPF_MAP_TYPE_SOCKMAPorBPF_MAP_TYPE_SOCKHASHmap.
Return
Reference to the newly created BPF link; or NULL is returned on error, error code is stored in errno
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome