summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichal Luczaj <mhal@rbox.co>2024-10-13 19:26:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-01 04:02:31 +0300
commit25784f48c549d93116946cc732306a733dff62c9 (patch)
tree48c8426ae6240559a17611b99f3262249919a9b4 /include
parent3955b77494c3c7d14873b1db67e7e00c46a714db (diff)
downloadlinux-25784f48c549d93116946cc732306a733dff62c9.tar.xz
bpf, sockmap: SK_DROP on attempted redirects of unsupported af_vsock
[ Upstream commit 9c5bd93edf7b8834aecaa7c340b852d5990d7c78 ] Don't mislead the callers of bpf_{sk,msg}_redirect_{map,hash}(): make sure to immediately and visibly fail the forwarding of unsupported af_vsock packets. Fixes: 634f1a7110b4 ("vsock: support sockmap") Signed-off-by: Michal Luczaj <mhal@rbox.co> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20241013-vsock-fixes-for-redir-v2-1-d6577bbfe742@rbox.co Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/sock.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 2d4149075091..f127fc268a5e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2715,6 +2715,11 @@ static inline bool sk_is_stream_unix(const struct sock *sk)
return sk->sk_family == AF_UNIX && sk->sk_type == SOCK_STREAM;
}
+static inline bool sk_is_vsock(const struct sock *sk)
+{
+ return sk->sk_family == AF_VSOCK;
+}
+
/**
* sk_eat_skb - Release a skb if it is no longer needed
* @sk: socket to eat this skb from