selftests/bpf: Return socket cookies from sock_iter_batch progs
authorJordan Rife <jordan@jrife.io>
Fri, 2 May 2025 16:15:25 +0000 (09:15 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Fri, 2 May 2025 19:07:53 +0000 (12:07 -0700)
commit4a0614e18c2d1f277a8dbd02c06f6a847e359eee
tree05175dd3163208004b6ca33f20b6ff0c9f748a01
parent5668f73f09aef16755da4453dc0b5b725469878a
selftests/bpf: Return socket cookies from sock_iter_batch progs

Extend the iter_udp_soreuse and iter_tcp_soreuse programs to write the
cookie of the current socket, so that we can track the identity of the
sockets that the iterator has seen so far. Update the existing do_test
function to account for this change to the iterator program output. At
the same time, teach both programs to work with AF_INET as well.

Signed-off-by: Jordan Rife <jordan@jrife.io>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
tools/testing/selftests/bpf/progs/bpf_tracing_net.h
tools/testing/selftests/bpf/progs/sock_iter_batch.c