diff options
author | Cong Wang <cong.wang@bytedance.com> | 2021-03-31 04:32:31 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-04-01 19:56:14 +0200 |
commit | 8a59f9d1e3d4340659fdfee8879dc09a6f2546e1 (patch) | |
tree | 22d59950e745c697e01c05b82ed67d7a9536bd88 /net/ipv4/udp.c | |
parent | sock_map: Introduce BPF_SK_SKB_VERDICT (diff) | |
download | linux-8a59f9d1e3d4340659fdfee8879dc09a6f2546e1.tar.xz linux-8a59f9d1e3d4340659fdfee8879dc09a6f2546e1.zip |
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
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4a0478b17243..38952aaee3a1 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2849,6 +2849,9 @@ struct proto udp_prot = { .unhash = udp_lib_unhash, .rehash = udp_v4_rehash, .get_port = udp_v4_get_port, +#ifdef CONFIG_BPF_SYSCALL + .psock_update_sk_prot = udp_bpf_update_proto, +#endif .memory_allocated = &udp_memory_allocated, .sysctl_mem = sysctl_udp_mem, .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), |