Skip to content

Commit 122e6c7

Browse files
Cong WangAlexei Starovoitov
authored andcommitted
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
1 parent 1f5be6b commit 122e6c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/core/sock_map.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,10 @@ static bool sk_is_udp(const struct sock *sk)
535535

536536
static bool sock_map_redirect_allowed(const struct sock *sk)
537537
{
538-
return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN;
538+
if (sk_is_tcp(sk))
539+
return sk->sk_state != TCP_LISTEN;
540+
else
541+
return sk->sk_state == TCP_ESTABLISHED;
539542
}
540543

541544
static bool sock_map_sk_is_suitable(const struct sock *sk)

0 commit comments

Comments
 (0)