af_unix: Add unix_stream_proto for sockmap
Previously, sockmap for AF_UNIX protocol only supports dgram type. This patch add unix stream type support, which is similar to unix_dgram_proto. To support sockmap, dgram and stream cannot share the same unix_proto anymore, because they have different implementations, such as unhash for stream type (which will remove closed or disconnected sockets from the map), so rename unix_proto to unix_dgram_proto and add a new unix_stream_proto. Also implement stream related sockmap functions. And add dgram key words to those dgram specific functions. Signed-off-by: Jiang Wang <jiang.wang@bytedance.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Cong Wang <cong.wang@bytedance.com> Acked-by: Jakub Sitnicki <jakub@cloudflare.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20210816190327.2739291-3-jiang.wang@bytedance.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
77462de14a
commit
94531cfcbe
@@ -87,6 +87,8 @@ long unix_outq_len(struct sock *sk);
|
||||
|
||||
int __unix_dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t size,
|
||||
int flags);
|
||||
int __unix_stream_recvmsg(struct sock *sk, struct msghdr *msg, size_t size,
|
||||
int flags);
|
||||
#ifdef CONFIG_SYSCTL
|
||||
int unix_sysctl_register(struct net *net);
|
||||
void unix_sysctl_unregister(struct net *net);
|
||||
@@ -96,9 +98,11 @@ static inline void unix_sysctl_unregister(struct net *net) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BPF_SYSCALL
|
||||
extern struct proto unix_proto;
|
||||
extern struct proto unix_dgram_proto;
|
||||
extern struct proto unix_stream_proto;
|
||||
|
||||
int unix_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
|
||||
int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
|
||||
int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
|
||||
void __init unix_bpf_build_proto(void);
|
||||
#else
|
||||
static inline void __init unix_bpf_build_proto(void)
|
||||
|
||||
Reference in New Issue
Block a user