sock: Introduce sk->sk_prot->psock_update_sk_prot()
authorCong Wang <cong.wang@bytedance.com>
Wed, 31 Mar 2021 02:32:31 +0000 (19:32 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 1 Apr 2021 17:56:14 +0000 (10:56 -0700)
commit8a59f9d1e3d4340659fdfee8879dc09a6f2546e1
tree22d59950e745c697e01c05b82ed67d7a9536bd88
parenta7ba4558e69a3c2ae4ca521f015832ef44799538
sock: Introduce sk->sk_prot->psock_update_sk_prot()

Currently sockmap calls into each protocol to update the struct
proto and replace it. This certainly won't work when the protocol
is implemented as a module, for example, AF_UNIX.

Introduce a new ops sk->sk_prot->psock_update_sk_prot(), so each
protocol can implement its own way to replace the struct proto.
This also helps get rid of symbol dependencies on CONFIG_INET.

Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210331023237.41094-11-xiyou.wangcong@gmail.com
12 files changed:
include/linux/skmsg.h
include/net/sock.h
include/net/tcp.h
include/net/udp.h
net/core/skmsg.c
net/core/sock_map.c
net/ipv4/tcp_bpf.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv4/udp_bpf.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c