From c7828900531d702366ab0cd4f8c314eb494db16e Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Thu, 19 Nov 2026 13:05:30 +0100 Subject: [PATCH] net/vsock: Fail connect() with ECONNREFUSED when the peer resets it. A RST reply to a connection request means that no socket listens on the destination port, but connect() failed with ECONNRESET. POSIX connect(): "[ECONNREFUSED] The target address was not listening for connections or refused the connection request." Assisted-by: Claude:claude-opus-5-5 Signed-off-by: raiden00pl --- net/vsock/vsock_sockif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vsock/vsock_sockif.c b/net/vsock/vsock_sockif.c index bf60bd5c24a2b..14bafb341934e 100644 --- a/net/vsock/vsock_sockif.c +++ b/net/vsock/vsock_sockif.c @@ -1148,7 +1148,7 @@ static int vsock_recv_connecting(FAR struct vsock_conn_s *conn, return 0; case VIRTIO_VSOCK_OP_RST: vrterr("conn=%p, VSOCK_RST\n", conn); - ret = -ECONNRESET; + ret = -ECONNREFUSED; break; default: vrterr("conn=%p, VSOCK_ERROR, op=%u\n", conn, hdr->op);