linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/8] selftests/bpf: Test sockmap/sockhash redirection
@ 2025-05-14 22:15 Michal Luczaj
  2025-05-14 22:15 ` [PATCH bpf-next v3 1/8] selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation Michal Luczaj
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Michal Luczaj @ 2025-05-14 22:15 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
  Cc: bpf, linux-kselftest, linux-kernel, Jakub Sitnicki, Michal Luczaj,
	Jiayuan Chen

John, this revision introduces one more patch: "selftests/bpf: Introduce
verdict programs for sockmap_redir". I've kept you cross-series Acked-by. I
hope it's ok.

Jiayuan, I haven't heard back from you regarding [*], so I've kept things
unchanged for now. Please let me know what you think.

[*] https://lore.kernel.org/bpf/66bf942f-dfdb-4ce9-bd95-8b734e7afa53@rbox.co/

--

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 v3:
- Drop unrelated changes; sockmap_listen, test_sockmap_listen, doc
- Collect tags [Jakub, John]
- Introduce BPF verdict programs especially for sockmap_redir [Jiayuan]
- Link to v2: https://lore.kernel.org/r/20250411-selftests-sockmap-redir-v2-0-5f9b018d6704@rbox.co

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 (8):
      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: Introduce verdict programs for sockmap_redir
      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

 .../selftests/bpf/prog_tests/socket_helpers.h      |  84 +++-
 .../selftests/bpf/prog_tests/sockmap_helpers.h     |  25 +-
 .../selftests/bpf/prog_tests/sockmap_listen.c      | 457 --------------------
 .../selftests/bpf/prog_tests/sockmap_redir.c       | 465 +++++++++++++++++++++
 .../selftests/bpf/progs/test_sockmap_redir.c       |  68 +++
 5 files changed, 623 insertions(+), 476 deletions(-)
---
base-commit: d0445d7dd3fd9b15af7564c38d7aa3cbc29778ee
change-id: 20240922-selftests-sockmap-redir-5d839396c75e

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


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

end of thread, other threads:[~2025-05-22 22:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 22:15 [PATCH bpf-next v3 0/8] selftests/bpf: Test sockmap/sockhash redirection Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 1/8] selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 2/8] selftests/bpf: Add socket_kind_to_str() to socket_helpers Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 3/8] selftests/bpf: Add u32()/u64() to sockmap_helpers Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 4/8] selftests/bpf: Introduce verdict programs for sockmap_redir Michal Luczaj
2025-05-15  4:29   ` John Fastabend
2025-05-15 10:49     ` Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 5/8] selftests/bpf: Add selftest for sockmap/hashmap redirection Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 6/8] selftests/bpf: sockmap_listen cleanup: Drop af_vsock redir tests Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 7/8] selftests/bpf: sockmap_listen cleanup: Drop af_unix " Michal Luczaj
2025-05-14 22:15 ` [PATCH bpf-next v3 8/8] selftests/bpf: sockmap_listen cleanup: Drop af_inet SOCK_DGRAM " Michal Luczaj
2025-05-22 22:20 ` [PATCH bpf-next v3 0/8] selftests/bpf: Test sockmap/sockhash redirection patchwork-bot+netdevbpf

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