]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap: Move generic sockmap hooks from BPF TCP
authorLorenz Bauer <lmb@cloudflare.com>
Mon, 9 Mar 2020 11:12:36 +0000 (11:12 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 9 Mar 2020 21:34:58 +0000 (22:34 +0100)
commitb20b81148dce4f71266206d8b21b9e31d7c01734
tree9cdce568e9a4fe81b8c4eb81513bb9690000e5f4
parentfe367fbb6c4755a30fde20e009cd0a08bdcd441b
bpf: sockmap: Move generic sockmap hooks from BPF TCP

The init, close and unhash handlers from TCP sockmap are generic,
and can be reused by UDP sockmap. Move the helpers into the sockmap code
base and expose them. This requires tcp_bpf_get_proto and tcp_bpf_clone to
be conditional on BPF_STREAM_PARSER.

The moved functions are unmodified, except that sk_psock_unlink is
renamed to sock_map_unlink to better match its behaviour.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200309111243.6982-6-lmb@cloudflare.com
include/linux/bpf.h
include/linux/skmsg.h
include/net/tcp.h
net/core/sock_map.c
net/ipv4/tcp_bpf.c