Skip to content

bpf: allow any port in bpf_bind helper

Stanislav Fomichev bpf netdev 5 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 1 replyApplied
  2. v44 patches 3 repliesSuperseded
  3. v35 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v25 patches8 repliesSuperseded
v14 patches11 repliesSuperseded

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/4selftests/bpf: generalize helpers to control background listenertools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/network_helpers.c tools/testing/selftests/bpf/network_helpers.h +1 more+108 -1130 replies
2/4selftests/bpf: move existing common networking parts into network_helperstools/testing/selftests/bpf/network_helpers.c tools/testing/selftests/bpf/network_helpers.h tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c +19 more+90 -530 replies
3/4net: refactor arguments of inet{,6}_bindinclude/net/inet_common.h include/net/ipv6_stubs.h net/core/filter.c +2 more+20 -140 replies
4/4bpf: allow any port in bpf_bind helperinclude/net/inet_common.h include/uapi/linux/bpf.h net/core/filter.c +6 more+203 -280 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndrey IgnatovMartin KaFai Lau
SeriesA-b A-b
1/4A-b A-b
2/4A-b A-b
3/4A-b A-b
4/4A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH bpf-next v5 0/4] bpf: allow any port in bpf_bind helper

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: move some common functionality into network_helpers
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

Stanislav Fomichev (4):
selftests/bpf: generalize helpers to control background listener selftests/bpf: move existing common networking parts into
network_helpers
net: refactor arguments of inet{,6}_bind
bpf: allow any port in bpf_bind helper

 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 | 110 +++++++++++++++++
 tools/testing/selftests/bpf/network_helpers.h |  39 ++++++
 .../bpf/prog_tests/connect_force_port.c       | 115 +++++++++++++++++
 .../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/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 ----
 34 files changed, 417 insertions(+), 204 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
Signature · 1 line
2.26.2.645.ge9eca65c58-goog