aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock_map.c
diff options
context:
space:
mode:
authorCong Wang <cong.wang@bytedance.com>2021-03-30 19:32:35 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-04-01 10:56:14 -0700
commit122e6c79efe1c25816118aca9cfabe54e99c2432 (patch)
tree2d50fcd9ed58ad416e631f573c357ad1480264e9 /net/core/sock_map.c
parentudp: Implement udp_bpf_recvmsg() for sockmap (diff)
downloadlinux-dev-122e6c79efe1c25816118aca9cfabe54e99c2432.tar.xz
linux-dev-122e6c79efe1c25816118aca9cfabe54e99c2432.zip
sock_map: Update sock type checks for UDP
Now UDP supports sockmap and redirection, we can safely update the sock type checks for it accordingly. Signed-off-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20210331023237.41094-15-xiyou.wangcong@gmail.com
Diffstat (limited to 'net/core/sock_map.c')
-rw-r--r--net/core/sock_map.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 2915c7c8778b..3d190d22b0d8 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -535,7 +535,10 @@ static bool sk_is_udp(const struct sock *sk)
static bool sock_map_redirect_allowed(const struct sock *sk)
{
- return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN;
+ if (sk_is_tcp(sk))
+ return sk->sk_state != TCP_LISTEN;
+ else
+ return sk->sk_state == TCP_ESTABLISHED;
}
static bool sock_map_sk_is_suitable(const struct sock *sk)