aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
diff options
context:
space:
mode:
authorJordan Rife <[email protected]>2025-07-14 18:09:11 +0000
committerMartin KaFai Lau <[email protected]>2025-07-14 19:09:09 +0000
commit346066c3278f3baa61b1abc8a03721ed2684efe7 (patch)
tree8c4a2de740d5215fdd6ceb72f5f0148ea4a3e7ef /tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
parentselftests/bpf: Add tests for bucket resume logic in listening sockets (diff)
downloadkernel-346066c3278f3baa61b1abc8a03721ed2684efe7.tar.gz
kernel-346066c3278f3baa61b1abc8a03721ed2684efe7.zip
selftests/bpf: Allow for iteration over multiple ports
Prepare to test TCP socket iteration over both listening and established sockets by allowing the BPF iterator programs to skip the port check. Signed-off-by: Jordan Rife <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Stanislav Fomichev <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c b/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
index 2adacd91fdf8..0d0f1b4debff 100644
--- a/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
+++ b/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
@@ -416,7 +416,6 @@ static void do_resume_test(struct test_case *tc)
int err, iter_fd = -1;
const char *addr;
int *fds = NULL;
- int local_port;
counts = calloc(tc->max_socks, sizeof(*counts));
if (!ASSERT_OK_PTR(counts, "counts"))
@@ -431,10 +430,8 @@ static void do_resume_test(struct test_case *tc)
tc->init_socks);
if (!ASSERT_OK_PTR(fds, "start_reuseport_server"))
goto done;
- local_port = get_socket_local_port(*fds);
- if (!ASSERT_GE(local_port, 0, "get_socket_local_port"))
- goto done;
- skel->rodata->ports[0] = ntohs(local_port);
+ skel->rodata->ports[0] = 0;
+ skel->rodata->ports[1] = 0;
skel->rodata->sf = tc->family;
err = sock_iter_batch__load(skel);