From nobody Wed Feb 28 22:33:11 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TlTdh3Mz2z5CXk2; Wed, 28 Feb 2024 22:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TlTdh09hvz4q5G; Wed, 28 Feb 2024 22:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709159592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gE0sllV4oSPoPbMQmj8+2+pnAQcYMMOgzxa2Cdt0Qk4=; b=onVmYMKvhQHBkxdvYE9DKv6B3aktlebtPy0vWVZJysxkltXbSwtu5qSMNprLJTS0nc1ZwM m5pC+bTaNXazTCgkPJAFE97cXFlPcK+EEq361iGwUtiHnmCu7qDgyHm+USqrenXZ7Pzpm/ sAfIG+uM9JcYtZdtvvOhJf9XLj6SxplV64wk+8U6lioHf3vJTdYd6ayM9mT1+jO64uWeFD vg1JQgGzJvm20jseUctI31BsPeYi6IOcagINYBgJrymMGuafHFgST5XBvPdqox0gX0Zz3X UIl2BQHaluvQzsWanj0galfe0i5ydGU8VOA3N1WYO9emxmMSLa3DUKkBlCKsAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709159592; a=rsa-sha256; cv=none; b=hkAwaf9LNBlfRZMv2t08U5s3vzB5qN1KZ1OdrUZZZ9Ku41LTizC6uiAWRHvPjVcPCdq0B+ CzDVTBtNi2IBMJFJO0LtOwu01FHs9mS4IdgZdTcBxXGLkjbvFPZjjNaV+yaTcDmyV2Vj2W +YGB5RwVBl0mvxvFdHcyld7Vn5y16W3AO2tPeHe1CycpxOh2YxhYSL3kEzzxC3VnkTBo9k V32YYKGQlvmhO8GkBYieLKAlOCgGXNZPnf2NcFLr9+HqAEyEGFLHBc/XqAQEkULNQFNZzU zfhjW9jt7qHkJYihZmpSC94RjSugI7FZvayQfrtRHchtEwsG2uYK6XMk5RQr0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709159592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gE0sllV4oSPoPbMQmj8+2+pnAQcYMMOgzxa2Cdt0Qk4=; b=s9dKzbEiHqSOzQFxVRzAUHmcBorwx0KXhu4ERqNeDqItV72pPOkzLtQXLFg3GidwX2EK4r G+JITlwvmHDJ60YbXh4x+D5JuakoKW68k/pnTalkBuWz6vLBEP8sjfOwkNazTAjDkYzQCK sadiQO5c7COXabGCF7dfdLzlN8hWMmAFwSWkKndyYKRTW9v1JVy8FuRsA7cCw8LqAzI6RJ /cqkXeZK5g0PHru5e0AKeszhIZ4rZw0Zqwu1hpuQatj4wHfL5lCrkZF281jrYOsQjdcvRo AzvgmQnsfKpdeiYJd+Cnf1CPDFue8WiQqYQJWpm8AK0g//bAqtbmaAAoiPNmKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TlTdg6ht9zGDr; Wed, 28 Feb 2024 22:33:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41SMXBOQ011058; Wed, 28 Feb 2024 22:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41SMXB26011055; Wed, 28 Feb 2024 22:33:11 GMT (envelope-from git) Date: Wed, 28 Feb 2024 22:33:11 GMT Message-Id: <202402282233.41SMXB26011055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 253d8a1f8a24 - main - tests/unix_seqpacket: test that implied connect doesn't work List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 253d8a1f8a247fc363ab6bad6ed0fa9c7cc25060 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=253d8a1f8a247fc363ab6bad6ed0fa9c7cc25060 commit 253d8a1f8a247fc363ab6bad6ed0fa9c7cc25060 Author: Gleb Smirnoff AuthorDate: 2024-02-28 22:32:47 +0000 Commit: Gleb Smirnoff CommitDate: 2024-02-28 22:32:47 +0000 tests/unix_seqpacket: test that implied connect doesn't work Applies both to SOCK_STREAM and SOCK_SEQPACKET. Put the test in this file as it is most advanced one. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D43854 --- tests/sys/kern/unix_seqpacket_test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/sys/kern/unix_seqpacket_test.c b/tests/sys/kern/unix_seqpacket_test.c index cde427401970..e93bdfe7e0b1 100644 --- a/tests/sys/kern/unix_seqpacket_test.c +++ b/tests/sys/kern/unix_seqpacket_test.c @@ -527,6 +527,23 @@ ATF_TC_BODY(send_before_accept, tc) close(a); } +/* Implied connect is unix/dgram only feature. Fails on stream or seqpacket. */ +ATF_TC_WITHOUT_HEAD(implied_connect); +ATF_TC_BODY(implied_connect, tc) +{ + const struct sockaddr_un *sun; + int l, s; + + sun = mk_listening_socket(&l); + + ATF_REQUIRE((s = socket(PF_LOCAL, SOCK_SEQPACKET, 0)) > 0); + ATF_REQUIRE(sendto(s, &s, sizeof(s), 0, (struct sockaddr *)sun, + sizeof(*sun)) == -1); + ATF_REQUIRE(errno == ENOTCONN); + close(l); + close(s); +} + /* accept(2) can receive a connection */ ATF_TC_WITHOUT_HEAD(accept); ATF_TC_BODY(accept, tc) @@ -1099,6 +1116,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, send_recv_with_connect); ATF_TP_ADD_TC(tp, sendto_recvfrom); ATF_TP_ADD_TC(tp, send_before_accept); + ATF_TP_ADD_TC(tp, implied_connect); ATF_TP_ADD_TC(tp, shutdown_send); ATF_TP_ADD_TC(tp, shutdown_send_sigpipe); ATF_TP_ADD_TC(tp, eagain_8k_8k);