bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>, Lorenz Bauer <lmb@cloudflare.com>
Cc: John Fastabend <john.fastabend@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	kernel-team@cloudflare.com, netdev@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: sockmap: don't attach programs to UDP sockets
Date: Fri, 12 Jun 2020 15:54:48 -0700	[thread overview]
Message-ID: <5ee407b8ab7d6_489d2af902f845b4f5@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20200612121750.0004c74d@toad>

Jakub Sitnicki wrote:
> On Thu, 11 Jun 2020 18:25:20 +0100
> Lorenz Bauer <lmb@cloudflare.com> wrote:
> 
> > The stream parser infrastructure isn't set up to deal with UDP
> > sockets, so we mustn't try to attach programs to them.
> > 
> > I remember making this change at some point, but I must have lost
> > it while rebasing or something similar.
> > 
> > Fixes: 7b98cd42b049 ("bpf: sockmap: Add UDP support")
> > Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
> > ---
> >  net/core/sock_map.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> > index 00a26cf2cfe9..35cea36f3892 100644
> > --- a/net/core/sock_map.c
> > +++ b/net/core/sock_map.c
> > @@ -424,10 +424,7 @@ static int sock_map_get_next_key(struct bpf_map *map, void *key, void *next)
> >  	return 0;
> >  }
> >  
> > -static bool sock_map_redirect_allowed(const struct sock *sk)
> > -{
> > -	return sk->sk_state != TCP_LISTEN;
> > -}
> > +static bool sock_map_redirect_allowed(const struct sock *sk);
> >  
> >  static int sock_map_update_common(struct bpf_map *map, u32 idx,
> >  				  struct sock *sk, u64 flags)
> > @@ -508,6 +505,11 @@ static bool sk_is_udp(const struct sock *sk)
> >  	       sk->sk_protocol == IPPROTO_UDP;
> >  }
> >  
> > +static bool sock_map_redirect_allowed(const struct sock *sk)
> > +{
> > +	return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN;
> > +}
> > +
> >  static bool sock_map_sk_is_suitable(const struct sock *sk)
> >  {
> >  	return sk_is_tcp(sk) || sk_is_udp(sk);
> 
> Acked-by: Jakub Sitnicki <jakub@cloudflare.com>

Thanks.

Acked-by: John Fastabend <john.fastabend@gmail.com>

      reply	other threads:[~2020-06-12 22:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 17:25 [PATCH bpf] bpf: sockmap: don't attach programs to UDP sockets Lorenz Bauer
2020-06-12 10:17 ` Jakub Sitnicki
2020-06-12 22:54   ` John Fastabend [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ee407b8ab7d6_489d2af902f845b4f5@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jakub@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).