linux/tools/testing/selftests/net/af_unix
Soichiro Ueda 34c0378b15 selftests: af_unix: validate SO_PEEK_OFF advancement and reset
Extend the so_peek_off selftest to ensure the socket peek offset is handled
correctly after both MSG_PEEK and actual data consumption.

Verify that the peek offset advances by the same amount as the number of
bytes read when performing a read with MSG_PEEK.

After exercising SO_PEEK_OFF via MSG_PEEK, drain the receive queue with a
non-peek recv() and verify that it can receive all the content in the
buffer and SO_PEEK_OFF returns back to 0.

The verification after actual data consumption was suggested by Miao Wang
when the original so_peek_off selftest was introduced.

Link: https://lore.kernel.org/all/7B657CC7-B5CA-46D2-8A4B-8AB5FB83C6DA@gmail.com/
Suggested-by: Miao Wang <shankerwangmiao@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Soichiro Ueda <the.latticeheart@gmail.com>
Link: https://patch.msgid.link/20260310072832.127848-1-the.latticeheart@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-11 18:20:17 -07:00
..
.gitignore selftest: af_unix: Create its own .gitignore. 2025-11-25 19:52:28 -08:00
config selftests: net: sort configs 2025-10-06 13:12:59 -07:00
diag_uid.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
Makefile selftest: af_unix: Support compilers without flex-array-member-not-at-end support 2025-12-10 01:08:51 -08:00
msg_oob.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
scm_inq.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
scm_pidfd.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
scm_rights.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
so_peek_off.c selftests: af_unix: validate SO_PEEK_OFF advancement and reset 2026-03-11 18:20:17 -07:00
unix_connect.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
unix_connreset.c selftests: af_unix: remove unused stdlib.h include 2025-11-27 12:42:51 +01:00