On Sat, 2024-07-06 at 22:45 +0800, Geliang Tang wrote:
From: Geliang Tang tanggeliang@kylinos.cn
v9: - new patches 5-7, new struct member expect_errno for network_helper_opts. - patches 1-4, 8-9 unchanged. - update patches 10-11 to make sure all tests pass.
Superseded, v10 is sent.
Thanks, -Geliang
v8: - only patch 8 updated, to fix errors reported by CI.
v7: - address Martin's comments in v6. (thanks) - use MAX(opts->backlog, 0) instead of opts->backlog. - use connect_to_fd_opts instead connect_to_fd. - more ASSERT_* to check errors.
v6: - update patch 6 as Daniel suggested. (thanks)
v5: - keep make_server and make_client as Eduard suggested.
v4: - a new patch to use make_sockaddr in sockmap_ktls. - a new patch to close fd in error path in drop_on_reuseport. - drop make_server() in patch 7. - drop make_client() too in patch 9.
v3: - a new patch to add backlog for network_helper_opts. - use start_server_str in sockmap_ktls now, not start_server.
v2: - address Eduard's comments in v1. (thanks) - fix errors reported by CI.
This patch set uses network helpers in sockmap_ktls and sk_lookup, and drop three local helpers tcp_server(), inetaddr_len() and make_socket() in them.
Geliang Tang (11): selftests/bpf: Add backlog for network_helper_opts selftests/bpf: Use start_server_str in sockmap_ktls selftests/bpf: Use connect_to_fd_opts in sockmap_ktls selftests/bpf: Use make_sockaddr in sockmap_ktls selftests/bpf: Add network_helper_opts for connect_fd_to_fd selftests/bpf: Add expect_errno for network_helper_opts selftests/bpf: Set expect_errno for cgroup_skb_sk_lookup selftests/bpf: Close fd in error path in drop_on_reuseport selftests/bpf: Use start_server_str in sk_lookup selftests/bpf: Use connect_to_addr in sk_lookup selftests/bpf: Drop make_socket in sk_lookup
tools/testing/selftests/bpf/network_helpers.c | 23 ++- tools/testing/selftests/bpf/network_helpers.h | 8 +- .../testing/selftests/bpf/prog_tests/bpf_nf.c | 5 +- .../bpf/prog_tests/cgroup_skb_sk_lookup.c | 8 +- .../selftests/bpf/prog_tests/cgroup_tcp_skb.c | 4 +- .../selftests/bpf/prog_tests/cgroup_v1v2.c | 1 + .../selftests/bpf/prog_tests/sk_lookup.c | 152 +++++++--------- -- .../selftests/bpf/prog_tests/sockmap_ktls.c | 53 ++---- 8 files changed, 106 insertions(+), 148 deletions(-)