]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: af_unix: Add tests for ECONNRESET and EOF semantics
authorSunday Adelodun <adelodunolaoluwa@yahoo.com>
Thu, 13 Nov 2025 11:28:02 +0000 (12:28 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 18 Nov 2025 10:33:17 +0000 (11:33 +0100)
commit45a1cd8346ca245a1ca475b26eb6ceb9d8b7c6f0
tree4791107fa5e68f92aa72615ccf73dc91834b0e87
parent4e1b0afa61403a1c8e13fd475f9bedf97b5de8d9
selftests: af_unix: Add tests for ECONNRESET and EOF semantics

Add selftests to verify and document Linux’s intended behaviour for
UNIX domain sockets (SOCK_STREAM and SOCK_DGRAM) when a peer closes.
The tests verify that:

 1. SOCK_STREAM returns EOF when the peer closes normally.
 2. SOCK_STREAM returns ECONNRESET if the peer closes with unread data.
 3. SOCK_SEQPACKET returns EOF when the peer closes normally.
 4. SOCK_SEQPACKET returns ECONNRESET if the peer closes with unread data.
 5. SOCK_DGRAM does not return ECONNRESET when the peer closes.

This follows up on review feedback suggesting a selftest to clarify
Linux’s semantics.

Suggested-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Sunday Adelodun <adelodunolaoluwa@yahoo.com>
Link: https://patch.msgid.link/20251113112802.44657-1-adelodunolaoluwa@yahoo.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/.gitignore
tools/testing/selftests/net/af_unix/Makefile
tools/testing/selftests/net/af_unix/unix_connreset.c [new file with mode: 0644]