diff options
author | Michal Luczaj <mhal@rbox.co> | 2024-10-13 18:26:39 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2024-10-17 13:02:54 +0200 |
commit | 9c5bd93edf7b8834aecaa7c340b852d5990d7c78 (patch) | |
tree | be4c3e2466140f00e09796450377d10a6439f043 /include | |
parent | selftests/bpf: Add asserts for netfilter link info (diff) | |
download | linux-9c5bd93edf7b8834aecaa7c340b852d5990d7c78.tar.xz linux-9c5bd93edf7b8834aecaa7c340b852d5990d7c78.zip |
bpf, sockmap: SK_DROP on attempted redirects of unsupported af_vsock
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
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index c58ca8dd561b..c87295f3476d 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 |