From: Lorenz Bauer <lmb@cloudflare.com>
To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
bpf@vger.kernel.org
Cc: kafai@fb.com, theojulienne@github.com, Lorenz Bauer <lmb@cloudflare.com>
Subject: [PATCH v2 0/8] Allow checking SYN cookies from XDP and tc cls act
Date: Thu, 14 Mar 2019 11:39:46 +0000 [thread overview]
Message-ID: <20190314113954.10210-1-lmb@cloudflare.com> (raw)
In-Reply-To: <20190222095057.9442-1-lmb@cloudflare.com>
This series adds the necessary helpers to determine wheter a given
(encapsulated) TCP packet belongs to a connection known to the network stack.
* bpf_skc_lookup_tcp gives access to request and timewait sockets
* bpf_tcp_check_syncookie identifies the final 3WHS ACK when syncookies
are enabled
The goal is to be able to implement load-balancing approaches like
glb-director [1] or Beamer [2] in pure eBPF. Specifically, we'd like to replace
the functionality of the glb-redirect kernel module [3] by an XDP program or
tc classifier.
Thanks to Martin KaFai Lau for his review!
Changes in v2:
* Rename bpf_sk_check_syncookie to bpf_tcp_check_syncookie.
* Add bpf_skc_lookup_tcp. Without it bpf_tcp_check_syncookie doesn't make sense.
* Check tcp_synq_no_recent_overflow() in bpf_tcp_check_syncookie.
* Check th->syn in bpf_tcp_check_syncookie.
* Require CONFIG_IPV6 to be a built in.
1: https://github.com/github/glb-director
2: https://www.usenix.org/conference/nsdi18/presentation/olteanu
3: https://github.com/github/glb-director/tree/master/src/glb-redirect
Lorenz Bauer (8):
bpf: track references based on is_acquire_func
bpf: allow helpers to return PTR_TO_SOCK_COMMON
bpf: add skc_lookup_tcp helper
bpf: add helper to check for a valid SYN cookie
tools: update include/uapi/linux/bpf.h
selftests/bpf: allow specifying helper for BPF_SK_LOOKUP
selftests/bpf: test references to sock_common
selftests/bpf: add tests for bpf_tcp_check_syncookie and
bpf_skc_lookup_tcp
include/linux/bpf.h | 1 +
include/uapi/linux/bpf.h | 36 ++-
kernel/bpf/verifier.c | 33 +--
net/core/filter.c | 185 ++++++++++++++-
tools/include/uapi/linux/bpf.h | 36 ++-
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/Makefile | 5 +-
tools/testing/selftests/bpf/bpf_helpers.h | 8 +
.../bpf/progs/test_tcp_check_syncookie_kern.c | 126 +++++++++++
.../selftests/bpf/test_tcp_check_syncookie.sh | 81 +++++++
.../bpf/test_tcp_check_syncookie_user.c | 212 ++++++++++++++++++
tools/testing/selftests/bpf/test_verifier.c | 6 +-
.../selftests/bpf/verifier/ref_tracking.c | 126 +++++++----
tools/testing/selftests/bpf/verifier/unpriv.c | 8 +-
14 files changed, 789 insertions(+), 75 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/test_tcp_check_syncookie_kern.c
create mode 100755 tools/testing/selftests/bpf/test_tcp_check_syncookie.sh
create mode 100644 tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
--
2.19.1
next prev parent reply other threads:[~2019-03-14 11:40 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 9:50 [PATCH 0/3] Allow checking SYN cookies from XDP and tc cls act Lorenz Bauer
2019-02-22 9:50 ` Lorenz Bauer
2019-02-22 9:50 ` [PATCH 1/3] bpf: add helper to check for a valid SYN cookie Lorenz Bauer
2019-02-23 0:44 ` Martin Lau
2019-02-23 0:44 ` Martin Lau
2019-02-25 18:26 ` Lorenz Bauer
2019-02-26 5:37 ` Martin Lau
2019-02-28 15:11 ` Lorenz Bauer
2019-02-28 15:11 ` Lorenz Bauer
2019-02-28 17:37 ` Martin Lau
2019-02-24 11:21 ` kbuild test robot
2019-02-24 11:21 ` kbuild test robot
2019-02-24 11:37 ` kbuild test robot
2019-02-24 11:37 ` kbuild test robot
2019-02-22 9:50 ` [PATCH 2/3] tools: sync changes to uapi/linux/bpf.h Lorenz Bauer
2019-02-22 9:50 ` [PATCH 3/3] selftests/bpf: add tests for bpf_sk_check_syncookie Lorenz Bauer
2019-03-14 11:39 ` Lorenz Bauer [this message]
2019-03-14 11:39 ` [PATCH v2 1/8] bpf: track references based on is_acquire_func Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 2/8] bpf: allow helpers to return PTR_TO_SOCK_COMMON Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 3/8] bpf: add skc_lookup_tcp helper Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 4/8] bpf: add helper to check for a valid SYN cookie Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 5/8] tools: update include/uapi/linux/bpf.h Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 6/8] selftests/bpf: allow specifying helper for BPF_SK_LOOKUP Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 7/8] selftests/bpf: test references to sock_common Lorenz Bauer
2019-03-14 11:39 ` [PATCH v2 8/8] selftests/bpf: add tests for bpf_tcp_check_syncookie and bpf_skc_lookup_tcp Lorenz Bauer
2019-03-15 20:42 ` [PATCH v2 0/8] Allow checking SYN cookies from XDP and tc cls act Alexei Starovoitov
2019-03-19 10:20 ` Lorenz Bauer
2019-03-19 10:20 ` [PATCH v2 1/8] bpf: track references based on is_acquire_func Lorenz Bauer
2019-03-19 10:20 ` [PATCH v2 2/8] bpf: allow helpers to return PTR_TO_SOCK_COMMON Lorenz Bauer
2019-03-19 10:20 ` [PATCH v2 3/8] bpf: add skc_lookup_tcp helper Lorenz Bauer
2019-03-19 21:30 ` Alexei Starovoitov
2019-03-19 10:20 ` [PATCH v2 4/8] bpf: add helper to check for a valid SYN cookie Lorenz Bauer
2019-03-19 22:17 ` Alexei Starovoitov
2019-03-21 2:09 ` Lorenz Bauer
2019-03-21 3:03 ` Alexei Starovoitov
2019-03-21 4:53 ` Lorenz Bauer
2019-03-21 5:50 ` Alexei Starovoitov
2019-03-19 10:21 ` [PATCH v2 5/8] tools: update include/uapi/linux/bpf.h Lorenz Bauer
2019-03-19 10:21 ` [PATCH v2 6/8] selftests/bpf: allow specifying helper for BPF_SK_LOOKUP Lorenz Bauer
2019-03-19 10:21 ` [PATCH v2 7/8] selftests/bpf: test references to sock_common Lorenz Bauer
2019-03-19 10:21 ` [PATCH v2 8/8] selftests/bpf: add tests for bpf_tcp_check_syncookie and bpf_skc_lookup_tcp Lorenz Bauer
2019-03-22 1:53 ` [PATCH bpf-next v3 0/8] Allow checking SYN cookies from XDP and tc cls act Lorenz Bauer
2019-03-22 1:53 ` [PATCH bpf-next v3 1/8] bpf: track references based on is_acquire_func Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 2/8] bpf: allow helpers to return PTR_TO_SOCK_COMMON Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 3/8] bpf: add skc_lookup_tcp helper Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 4/8] bpf: add helper to check for a valid SYN cookie Lorenz Bauer
2019-03-22 2:06 ` Alexei Starovoitov
2019-03-22 2:52 ` Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 5/8] tools: update include/uapi/linux/bpf.h Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 6/8] selftests/bpf: allow specifying helper for BPF_SK_LOOKUP Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 7/8] selftests/bpf: test references to sock_common Lorenz Bauer
2019-03-22 1:54 ` [PATCH bpf-next v3 8/8] selftests/bpf: add tests for bpf_tcp_check_syncookie and bpf_skc_lookup_tcp Lorenz Bauer
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=20190314113954.10210-1-lmb@cloudflare.com \
--to=lmb@cloudflare.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=theojulienne@github.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.