selftests/bpf: Add tests for cgroup unix socket address hooks
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 11 Oct 2023 18:51:11 +0000 (20:51 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 12 Oct 2023 00:27:55 +0000 (17:27 -0700)
commit82ab6b505e8199cc4537f00025a7391973c3847e
tree6d8e18abf80ef20cdea6a941fc05c032b19190a9
parentaf2752ed450e71fc0bd596d0b4b9b805a64ae2c1
selftests/bpf: Add tests for cgroup unix socket address hooks

These selftests are written in prog_tests style instead of adding
them to the existing test_sock_addr tests. Migrating the existing
sock addr tests to prog_tests style is left for future work. This
commit adds support for testing bind() sockaddr hooks, even though
there's no unix socket sockaddr hook for bind(). We leave this code
intact for when the INET and INET6 tests are migrated in the future
which do support intercepting bind().

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Link: https://lore.kernel.org/r/20231011185113.140426-10-daan.j.demeyer@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/bpf_kfuncs.h
tools/testing/selftests/bpf/network_helpers.c
tools/testing/selftests/bpf/network_helpers.h
tools/testing/selftests/bpf/prog_tests/section_names.c
tools/testing/selftests/bpf/prog_tests/sock_addr.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/connect_unix_prog.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/getpeername_unix_prog.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/getsockname_unix_prog.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/recvmsg_unix_prog.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/sendmsg_unix_prog.c [new file with mode: 0644]