All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramesh Chhetri <rameshch@linux.ibm.com>
To: ltp@lists.linux.it
Cc: rameshch@linux.ibm.com
Subject: [LTP] [PATCH v1] syscalls/connect02: Handle IPV6_ADDRFORM removal and listen() EINVAL
Date: Wed, 14 Oct 2026 09:56:16 +0200	[thread overview]
Message-ID: <20261014075616.5050-1-rameshch@linux.ibm.com> (raw)

Upstream kernel commit 31c5ea8a3296 ("ipv6: Remove IPV6_ADDRFORM.") completely
removed IPV6_ADDRFORM socket option support from the Linux kernel, causing
setsockopt(SOL_IPV6, IPV6_ADDRFORM, ...) to return -ENOPROTOOPT.

In addition, commit 8cc3aef0cb19 ("tcp: Do not allow buggy transitions between
ehash and lhash2.") intentionally disallows converting an unhashed established
socket into a listening socket by returning -EINVAL from listen().

Update connect02 to:
1. Skip the test with TCONF when IPV6_ADDRFORM returns ENOPROTOOPT or EOPNOTSUPP.
2. Accept EINVAL from listen() on kernels with the TCP transition restriction.

Signed-off-by: Ramesh Chhetri <rameshch@linux.ibm.com>
---
 testcases/kernel/syscalls/connect/connect02.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/connect/connect02.c b/testcases/kernel/syscalls/connect/connect02.c
index 079bc5bca..0b7e7df90 100644
--- a/testcases/kernel/syscalls/connect/connect02.c
+++ b/testcases/kernel/syscalls/connect/connect02.c
@@ -91,6 +91,14 @@ static void run(void)
 			sizeof(optval)));
 
 		if (TST_RET == -1) {
+			SAFE_CLOSE(confd1);
+			SAFE_CLOSE(fd);
+
+			if (TST_ERR == ENOPROTOOPT || TST_ERR == EOPNOTSUPP) {
+				tst_brk(TCONF | TTERRNO,
+					"IPV6_ADDRFORM is removed/unsupported by this kernel");
+			}
+
 			tst_res(TFAIL | TTERRNO,
 				"setsockopt(IPV6_ADDRFORM) failed");
 			return;
@@ -104,7 +112,15 @@ static void run(void)
 			sizeof(reset_addr));
 		SAFE_BIND(fd, (struct sockaddr *)&bind_addr4,
 			sizeof(bind_addr4));
-		SAFE_LISTEN(fd, 5);
+		TEST(listen(fd, 5));
+		if (TST_RET == -1) {
+			if (TST_ERR == EINVAL) {
+				SAFE_CLOSE(fd);
+				SAFE_CLOSE(confd1);
+				continue;
+			}
+			tst_brk(TBROK | TTERRNO, "listen(fd,5) failed unexpectedly");
+		}
 
 		addrlen = tst_get_connect_address(fd, &client_addr2);
 		confd2 = SAFE_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-- 
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-10-14  7:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  7:56 Ramesh Chhetri [this message]
2026-10-14 11:22 ` [LTP] syscalls/connect02: Handle IPV6_ADDRFORM removal and listen() EINVAL linuxtestproject.agent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261014075616.5050-1-rameshch@linux.ibm.com \
    --to=rameshch@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.