linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/9] selftests/bpf: Test sockmap/sockhash redirection
@ 2025-04-11 11:32 Michal Luczaj
  2025-04-11 11:32 ` [PATCH bpf-next v2 1/9] selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation Michal Luczaj
                   ` (10 more replies)
  0 siblings, 11 replies; 22+ messages in thread
From: Michal Luczaj @ 2025-04-11 11:32 UTC (permalink / raw)
  To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Shuah Khan, Jonathan Corbet
  Cc: bpf, linux-kselftest, linux-kernel, linux-doc, Jakub Sitnicki,
	Michal Luczaj

The idea behind this series is to comprehensively test the BPF redirection:

BPF_MAP_TYPE_SOCKMAP,
BPF_MAP_TYPE_SOCKHASH
	x
sk_msg-to-egress,
sk_msg-to-ingress,
sk_skb-to-egress,
sk_skb-to-ingress
	x
AF_INET, SOCK_STREAM,
AF_INET6, SOCK_STREAM,
AF_INET, SOCK_DGRAM,
AF_INET6, SOCK_DGRAM,
AF_UNIX, SOCK_STREAM,
AF_UNIX, SOCK_DGRAM,
AF_VSOCK, SOCK_STREAM,
AF_VSOCK, SOCK_SEQPACKET

New module is introduced, sockmap_redir: all supported and unsupported
redirect combinations are tested for success and failure respectively. Code
is pretty much stolen/adapted from Jakub Sitnicki's sockmap_redir_matrix.c
[1].

Usage:
$ cd tools/testing/selftests/bpf
$ make
$ sudo ./test_progs -t sockmap_redir
...
Summary: 1/576 PASSED, 0 SKIPPED, 0 FAILED

[1]: https://github.com/jsitnicki/sockmap-redir-matrix/blob/main/sockmap_redir_matrix.c

Changes in v2:
- Verify that the unsupported redirect combos do fail [Jakub]
- Dedup tests in sockmap_listen
- Cosmetic changes and code reordering
- Link to v1: https://lore.kernel.org/bpf/42939687-20f9-4a45-b7c2-342a0e11a014@rbox.co/

Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Michal Luczaj (9):
      selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation
      selftests/bpf: Add socket_kind_to_str() to socket_helpers
      selftests/bpf: Add u32()/u64() to sockmap_helpers
      selftests/bpf: Allow setting BPF_F_INGRESS in prog_msg_verdict()
      selftests/bpf: Add selftest for sockmap/hashmap redirection
      selftests/bpf: sockmap_listen cleanup: Drop af_vsock redir tests
      selftests/bpf: sockmap_listen cleanup: Drop af_unix redir tests
      selftests/bpf: sockmap_listen cleanup: Drop af_inet SOCK_DGRAM redir tests
      docs/bpf: sockmap: Add a missing comma

 Documentation/bpf/map_sockmap.rst                  |   2 +-
 .../selftests/bpf/prog_tests/socket_helpers.h      |  84 +++-
 .../selftests/bpf/prog_tests/sockmap_helpers.h     |  25 +-
 .../selftests/bpf/prog_tests/sockmap_listen.c      | 459 +-------------------
 .../selftests/bpf/prog_tests/sockmap_redir.c       | 461 +++++++++++++++++++++
 .../selftests/bpf/progs/test_sockmap_listen.c      |   6 +-
 6 files changed, 558 insertions(+), 479 deletions(-)
---
base-commit: a27a97f713947b20ba91b23a3ef77fa92d74171b
change-id: 20240922-selftests-sockmap-redir-5d839396c75e

Best regards,
-- 
Michal Luczaj <mhal@rbox.co>


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-04-21  4:21 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 11:32 [PATCH bpf-next v2 0/9] selftests/bpf: Test sockmap/sockhash redirection Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 1/9] selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation Michal Luczaj
2025-04-18 16:07   ` Jakub Sitnicki
2025-04-11 11:32 ` [PATCH bpf-next v2 2/9] selftests/bpf: Add socket_kind_to_str() to socket_helpers Michal Luczaj
2025-04-18 16:08   ` Jakub Sitnicki
2025-04-11 11:32 ` [PATCH bpf-next v2 3/9] selftests/bpf: Add u32()/u64() to sockmap_helpers Michal Luczaj
2025-04-18 16:13   ` Jakub Sitnicki
2025-04-11 11:32 ` [PATCH bpf-next v2 4/9] selftests/bpf: Allow setting BPF_F_INGRESS in prog_msg_verdict() Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 5/9] selftests/bpf: Add selftest for sockmap/hashmap redirection Michal Luczaj
2025-04-11 13:09   ` Jiayuan Chen
2025-04-11 17:54     ` Jakub Sitnicki
2025-04-16 12:33       ` Michal Luczaj
2025-04-11 13:17   ` Jiayuan Chen
2025-04-16 12:32     ` Michal Luczaj
2025-04-11 14:31   ` Jiayuan Chen
2025-04-16 12:33     ` Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 6/9] selftests/bpf: sockmap_listen cleanup: Drop af_vsock redir tests Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 7/9] selftests/bpf: sockmap_listen cleanup: Drop af_unix " Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 8/9] selftests/bpf: sockmap_listen cleanup: Drop af_inet SOCK_DGRAM " Michal Luczaj
2025-04-11 11:32 ` [PATCH bpf-next v2 9/9] docs/bpf: sockmap: Add a missing comma Michal Luczaj
2025-04-11 13:06 ` [PATCH bpf-next v2 0/9] selftests/bpf: Test sockmap/sockhash redirection Jiayuan Chen
2025-04-21  4:20 ` John Fastabend

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).