From: Petar Penkov <ppenkov.kernel@gmail.com>
To: Lorenz Bauer <lmb@cloudflare.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
davem@davemloft.net, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eric Dumazet <edumazet@google.com>,
Stanislav Fomichev <sdf@google.com>,
Petar Penkov <ppenkov@google.com>
Subject: Re: [bpf-next RFC 3/6] bpf: add bpf_tcp_gen_syncookie helper
Date: Tue, 16 Jul 2019 17:27:02 -0700 [thread overview]
Message-ID: <CAGdtWsRWAYPedUQQbx1d6PF9sCj6bAXhvhez74ujQYJ8syMvZA@mail.gmail.com> (raw)
In-Reply-To: <CACAyw9_5+3cznRspLJ2ZDcK22keLVtQQHbQOypSs4sx-F=ajow@mail.gmail.com>
Thank you for the reviews!
On Tue, Jul 16, 2019 at 4:56 AM Lorenz Bauer <lmb@cloudflare.com> wrote:
>
> On Tue, 16 Jul 2019 at 08:59, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > > + return -EINVAL;
> > > +
> > > + if (sk->sk_protocol != IPPROTO_TCP || sk->sk_state != TCP_LISTEN)
> > > + return -EINVAL;
> > > +
> > > + if (!sock_net(sk)->ipv4.sysctl_tcp_syncookies)
> > > + return -EINVAL;
> > > +
> > > + if (!th->syn || th->ack || th->fin || th->rst)
> > > + return -EINVAL;
> > > +
> > > + switch (sk->sk_family) {
> >
> > This is strange, because a dual stack listener will have sk->sk_family set to AF_INET6.
> >
> > What really matters here is if the packet is IPv4 or IPv6.
> >
> > So you need to look at iph->version instead.
> >
> > Then look if the socket family allows this packet to be processed
> > (For example AF_INET6 sockets might prevent IPv4 packets, see sk->sk_ipv6only )
This makes a lot of sense, thanks Eric, will update!
>
> Does this apply for (the existing) tcp_check_syn_cookie as well?
I think we will probably have to update the check there, too.
>
> --
> Lorenz Bauer | Systems Engineer
> 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
>
> www.cloudflare.com
next prev parent reply other threads:[~2019-07-17 0:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 0:26 [bpf-next RFC 0/6] Introduce a BPF helper to generate SYN cookies Petar Penkov
2019-07-16 0:26 ` [bpf-next RFC 1/6] tcp: tcp_syn_flood_action read port from socket Petar Penkov
2019-07-16 0:26 ` [bpf-next RFC 2/6] tcp: add skb-less helpers to retrieve SYN cookie Petar Penkov
2019-07-16 11:34 ` Lorenz Bauer
2019-07-17 0:23 ` Petar Penkov
2019-07-16 0:26 ` [bpf-next RFC 3/6] bpf: add bpf_tcp_gen_syncookie helper Petar Penkov
2019-07-16 7:59 ` Eric Dumazet
2019-07-16 11:56 ` Lorenz Bauer
2019-07-17 0:27 ` Petar Penkov [this message]
2019-07-17 2:26 ` Alexei Starovoitov
2019-07-17 3:33 ` Petar Penkov
2019-07-16 11:54 ` Lorenz Bauer
2019-07-16 0:26 ` [bpf-next RFC 4/6] bpf: sync bpf.h to tools/ Petar Penkov
2019-07-16 0:26 ` [bpf-next RFC 5/6] selftests/bpf: bpf_tcp_gen_syncookie->bpf_helpers Petar Penkov
2019-07-16 0:26 ` [bpf-next RFC 6/6] selftests/bpf: add test for bpf_tcp_gen_syncookie Petar Penkov
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=CAGdtWsRWAYPedUQQbx1d6PF9sCj6bAXhvhez74ujQYJ8syMvZA@mail.gmail.com \
--to=ppenkov.kernel@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=lmb@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=ppenkov@google.com \
--cc=sdf@google.com \
/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).