From: Stanislav Fomichev <sdf@google.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net,
Stanislav Fomichev <sdf@google.com>, Andrey Ignatov <rdna@fb.com>
Subject: [PATCH bpf-next v2 0/5] bpf: allow any port in bpf_bind helper
Date: Tue, 5 May 2020 13:27:25 -0700 [thread overview]
Message-ID: <20200505202730.70489-1-sdf@google.com> (raw)
We want to have a tighter control on what ports we bind to in
the BPF_CGROUP_INET{4,6}_CONNECT hooks even if it means
connect() becomes slightly more expensive.
The series goes like this:
1. selftests: move existing helpers that make it easy to create
listener threads into common test_progs part
2. selftests: make sure the helpers above don't get stuck forever
in case the tests fails
3. do small refactoring of __inet{,6}_bind() flags to make it easy
to extend them with the additional flags
4. remove the restriction on port being zero in bpf_bind() helper;
add new bind flag to prevent POST_BIND hook from being called
5. selftests: move some common functionality into network_helpers
Cc: Andrey Ignatov <rdna@fb.com>
Stanislav Fomichev (5):
selftests/bpf: generalize helpers to control background listener
selftests/bpf: adopt accept_timeout from sockmap_listen
net: refactor arguments of inet{,6}_bind
bpf: allow any port in bpf_bind helper
selftests/bpf: move existing common networking parts into
network_helpers
include/net/inet_common.h | 8 +-
include/net/ipv6_stubs.h | 2 +-
include/uapi/linux/bpf.h | 9 +-
net/core/filter.c | 16 +-
net/ipv4/af_inet.c | 20 +-
net/ipv6/af_inet6.c | 22 +-
tools/include/uapi/linux/bpf.h | 9 +-
tools/testing/selftests/bpf/Makefile | 2 +-
tools/testing/selftests/bpf/network_helpers.c | 208 ++++++++++++++++++
tools/testing/selftests/bpf/network_helpers.h | 44 ++++
.../bpf/prog_tests/connect_force_port.c | 104 +++++++++
.../selftests/bpf/prog_tests/fexit_bpf2bpf.c | 1 +
.../selftests/bpf/prog_tests/flow_dissector.c | 1 +
.../prog_tests/flow_dissector_load_bytes.c | 1 +
.../selftests/bpf/prog_tests/global_data.c | 1 +
.../selftests/bpf/prog_tests/kfree_skb.c | 1 +
.../selftests/bpf/prog_tests/l4lb_all.c | 1 +
.../selftests/bpf/prog_tests/map_lock.c | 14 ++
.../selftests/bpf/prog_tests/pkt_access.c | 1 +
.../selftests/bpf/prog_tests/pkt_md_access.c | 1 +
.../selftests/bpf/prog_tests/prog_run_xattr.c | 1 +
.../bpf/prog_tests/queue_stack_map.c | 1 +
.../selftests/bpf/prog_tests/signal_pending.c | 1 +
.../selftests/bpf/prog_tests/skb_ctx.c | 1 +
.../selftests/bpf/prog_tests/sockmap_listen.c | 35 +--
.../selftests/bpf/prog_tests/spinlock.c | 14 ++
.../selftests/bpf/prog_tests/tcp_rtt.c | 116 +---------
tools/testing/selftests/bpf/prog_tests/xdp.c | 1 +
.../bpf/prog_tests/xdp_adjust_tail.c | 1 +
.../selftests/bpf/prog_tests/xdp_bpf2bpf.c | 1 +
.../selftests/bpf/prog_tests/xdp_noinline.c | 1 +
.../selftests/bpf/progs/connect_force_port4.c | 28 +++
.../selftests/bpf/progs/connect_force_port6.c | 28 +++
tools/testing/selftests/bpf/test_progs.c | 30 ---
tools/testing/selftests/bpf/test_progs.h | 23 --
35 files changed, 510 insertions(+), 238 deletions(-)
create mode 100644 tools/testing/selftests/bpf/network_helpers.c
create mode 100644 tools/testing/selftests/bpf/network_helpers.h
create mode 100644 tools/testing/selftests/bpf/prog_tests/connect_force_port.c
create mode 100644 tools/testing/selftests/bpf/progs/connect_force_port4.c
create mode 100644 tools/testing/selftests/bpf/progs/connect_force_port6.c
--
2.26.2.526.g744177e7f7-goog
next reply other threads:[~2020-05-05 20:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 20:27 Stanislav Fomichev [this message]
2020-05-05 20:27 ` [PATCH bpf-next v2 1/5] selftests/bpf: generalize helpers to control background listener Stanislav Fomichev
2020-05-06 7:00 ` Martin KaFai Lau
2020-05-06 16:28 ` sdf
2020-05-06 17:48 ` Martin KaFai Lau
2020-05-06 18:09 ` sdf
2020-05-05 20:27 ` [PATCH bpf-next v2 2/5] selftests/bpf: adopt accept_timeout from sockmap_listen Stanislav Fomichev
2020-05-05 20:27 ` [PATCH bpf-next v2 3/5] net: refactor arguments of inet{,6}_bind Stanislav Fomichev
2020-05-05 20:27 ` [PATCH bpf-next v2 4/5] bpf: allow any port in bpf_bind helper Stanislav Fomichev
2020-05-05 20:33 ` Andrey Ignatov
2020-05-06 6:23 ` Martin KaFai Lau
2020-05-06 16:22 ` sdf
2020-05-06 18:09 ` Martin KaFai Lau
2020-05-05 20:27 ` [PATCH bpf-next v2 5/5] selftests/bpf: move existing common networking parts into network_helpers Stanislav Fomichev
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=20200505202730.70489-1-sdf@google.com \
--to=sdf@google.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=rdna@fb.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).