• A
    bpf: Support bpf_get_socket_cookie in more prog types · d692f113
    Andrey Ignatov 提交于
    bpf_get_socket_cookie() helper can be used to identify skb that
    correspond to the same socket.
    
    Though socket cookie can be useful in many other use-cases where socket is
    available in program context. Specifically BPF_PROG_TYPE_CGROUP_SOCK_ADDR
    and BPF_PROG_TYPE_SOCK_OPS programs can benefit from it so that one of
    them can augment a value in a map prepared earlier by other program for
    the same socket.
    
    The patch adds support to call bpf_get_socket_cookie() from
    BPF_PROG_TYPE_CGROUP_SOCK_ADDR and BPF_PROG_TYPE_SOCK_OPS.
    
    It doesn't introduce new helpers. Instead it reuses same helper name
    bpf_get_socket_cookie() but adds support to this helper to accept
    `struct bpf_sock_addr` and `struct bpf_sock_ops`.
    
    Documentation in bpf.h is changed in a way that should not break
    automatic generation of markdown.
    Signed-off-by: NAndrey Ignatov <rdna@fb.com>
    Acked-by: NYonghong Song <yhs@fb.com>
    Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
    d692f113
bpf.h 102.2 KB