Skip to content

bpf: expose bpf_{s,g}etsockopt helpers to bind{4,6} hooks

Stanislav Fomichev bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3selftests/bpf: rewrite test_sock_addr bind bpf into Ctools/testing/selftests/bpf/progs/bind4_prog.c tools/testing/selftests/bpf/progs/bind6_prog.c tools/testing/selftests/bpf/test_sock_addr.c+175 -1842 replies
2/3bpf: allow bpf_{s,g}etsockopt from cgroup bind{4,6} hooksinclude/linux/bpf-cgroup.h net/core/filter.c net/ipv4/af_inet.c +1 more+12 -87 replies
3/3selftests/bpf: extend bind{4,6} programs with a call to bpf_setsockopttools/testing/selftests/bpf/progs/bind4_prog.c tools/testing/selftests/bpf/progs/bind6_prog.c+62 -01 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAndrey IgnatovAndrii Nakryiko
1/3A-b
2/3A-b
3/3A-b

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] bpf: expose bpf_{s,g}etsockopt helpers to bind{4,6} hooks

This might be useful for the listener sockets to pre-populate some options. Since those helpers require locked sockets, I'm changing bind hooks to lock/unlock the sockets. This should not cause any performance overhead because at this point there shouldn't be any socket lock contention and the locking/unlocking should be cheap.

Also, as part of the series, I convert test_sock_addr bpf assembly into C (and preserve the narrow load tests) to make it easier to extend with th bpf_setsockopt later on.

Stanislav Fomichev (3):
selftests/bpf: rewrite test_sock_addr bind bpf into C
bpf: allow bpf_{s,g}etsockopt from cgroup bind{4,6} hooks selftests/bpf: extend bind{4,6} programs with a call to bpf_setsockopt

 include/linux/bpf-cgroup.h                    |  12 +-
 net/core/filter.c                             |   4 +
 net/ipv4/af_inet.c                            |   2 +-
 net/ipv6/af_inet6.c                           |   2 +-
 .../testing/selftests/bpf/progs/bind4_prog.c  | 104 ++++++++++
 .../testing/selftests/bpf/progs/bind6_prog.c  | 121 +++++++++++
 tools/testing/selftests/bpf/test_sock_addr.c  | 196 ++----------------
 7 files changed, 249 insertions(+), 192 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/bind4_prog.c
 create mode 100644 tools/testing/selftests/bpf/progs/bind6_prog.c
Signature · 1 line
2.29.2.299.gdc1121823c-goog