[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60625e778b72_401fb2084b@john-XPS-13-9370.notmuch>
Date: Mon, 29 Mar 2021 16:10:47 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>, netdev@...r.kernel.org
Cc: bpf@...r.kernel.org, duanxiongchun@...edance.com,
wangdongdong.6@...edance.com, jiang.wang@...edance.com,
Cong Wang <cong.wang@...edance.com>,
John Fastabend <john.fastabend@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
Jakub Sitnicki <jakub@...udflare.com>,
Lorenz Bauer <lmb@...udflare.com>
Subject: RE: [Patch bpf-next v7 12/13] sock_map: update sock type checks for
UDP
Cong Wang wrote:
> From: Cong Wang <cong.wang@...edance.com>
>
> Now UDP supports sockmap and redirection, we can safely update
> the sock type checks for it accordingly.
>
> Cc: John Fastabend <john.fastabend@...il.com>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Cc: Jakub Sitnicki <jakub@...udflare.com>
> Cc: Lorenz Bauer <lmb@...udflare.com>
> Signed-off-by: Cong Wang <cong.wang@...edance.com>
> ---
> net/core/sock_map.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> index d04b98fc8104..9ed040c7d9e7 100644
> --- a/net/core/sock_map.c
> +++ b/net/core/sock_map.c
> @@ -549,7 +549,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)
> --
> 2.25.1
>
I think its a bit odd for TCP_ESTABLISHED to work with !tcp, but
thats not your invention so LGTM.
Acked-by: John Fastabend <john.fastabend@...il.com>
Powered by blists - more mailing lists