diff options
| author | Jordan Rife <[email protected]> | 2025-07-14 18:09:12 +0000 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2025-07-14 19:09:09 +0000 |
| commit | f00468124a08a7ecd6f2ed932c57d86a1fc249db (patch) | |
| tree | e2884355db8ab62c38a18d4755e2b4b3a7e48edf /tools/testing/selftests/bpf/prog_tests | |
| parent | selftests/bpf: Allow for iteration over multiple ports (diff) | |
| download | kernel-f00468124a08a7ecd6f2ed932c57d86a1fc249db.tar.gz kernel-f00468124a08a7ecd6f2ed932c57d86a1fc249db.zip | |
selftests/bpf: Allow for iteration over multiple states
Add parentheses around loopback address check to fix up logic and make
the socket state filter configurable for the TCP socket iterators.
Iterators can skip the socket state check by setting ss to 0.
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')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c | 3 |
1 files changed, 3 insertions, 0 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 0d0f1b4debff..4e15a0c2f237 100644 --- a/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c +++ b/tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c @@ -433,6 +433,7 @@ static void do_resume_test(struct test_case *tc) skel->rodata->ports[0] = 0; skel->rodata->ports[1] = 0; skel->rodata->sf = tc->family; + skel->rodata->ss = 0; err = sock_iter_batch__load(skel); if (!ASSERT_OK(err, "sock_iter_batch__load")) @@ -498,6 +499,8 @@ static void do_test(int sock_type, bool onebyone) skel->rodata->ports[i] = ntohs(local_port); } skel->rodata->sf = AF_INET6; + if (sock_type == SOCK_STREAM) + skel->rodata->ss = TCP_LISTEN; err = sock_iter_batch__load(skel); if (!ASSERT_OK(err, "sock_iter_batch__load")) |
