summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests
diff options
context:
space:
mode:
authorJordan Rife <jordan@jrife.io>2025-07-14 21:09:11 +0300
committerMartin KaFai Lau <martin.lau@kernel.org>2025-07-14 22:09:09 +0300
commit346066c3278f3baa61b1abc8a03721ed2684efe7 (patch)
tree8c4a2de740d5215fdd6ceb72f5f0148ea4a3e7ef /tools/testing/selftests/bpf/prog_tests
parentda1d987d3b39a91e53be888c29610f57fb67bbe0 (diff)
downloadlinux-346066c3278f3baa61b1abc8a03721ed2684efe7.tar.xz
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 <jordan@jrife.io> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests')
-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);