• Andrey Ignatov's avatar
    bpf: Add BPF_SOCK_OPS_TCP_LISTEN_CB · f333ee0c
    Andrey Ignatov authored
    Add new TCP-BPF callback that is called on listen(2) right after socket
    transition to TCP_LISTEN state.
    
    It fills the gap for listening sockets in TCP-BPF. For example BPF
    program can set BPF_SOCK_OPS_STATE_CB_FLAG when socket becomes listening
    and track later transition from TCP_LISTEN to TCP_CLOSE with
    BPF_SOCK_OPS_STATE_CB callback.
    
    Before there was no way to do it with TCP-BPF and other options were
    much harder to work with. E.g. socket state tracking can be done with
    tracepoints (either raw or regular) but they can't be attached to cgroup
    and their lifetime has to be managed separately.
    Signed-off-by: default avatarAndrey Ignatov <rdna@fb.com>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    f333ee0c
af_inet.c 50.1 KB