]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add BPF_SOCK_OPS_TCP_LISTEN_CB
authorAndrey Ignatov <rdna@fb.com>
Thu, 12 Jul 2018 00:33:32 +0000 (17:33 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 14 Jul 2018 22:08:41 +0000 (00:08 +0200)
commitaa85813112b3c4c98c1f7bd9061b05d0d049908e
tree25adc31f92c445a646f096add42655410e784b9d
parentf7582acb7c409afee698f4c1ce1155d57b5a0822
bpf: Add BPF_SOCK_OPS_TCP_LISTEN_CB

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: Andrey Ignatov <rdna@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/uapi/linux/bpf.h
net/ipv4/af_inet.c