Skip to contentSkip to conversation

landlock08: Skip IPv6 variant if not supported

PATCH Applied Brian Grech via ltp 1 participant 2 messages Dec 17, 2025 – Dec 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 landlock08: Skip IPv6 variant if not supported

Check for IPv6 support before forking the server process to avoid checkpoint timeout issues. If IPv6 is not available (EAFNOSUPPORT), report TCONF and skip the variant gracefully.

This allows the landlock08 test to be executed on systems without IPv6 support.

---
 testcases/kernel/syscalls/landlock/landlock08.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
testcases/kernel/syscalls/landlock/landlock08.c +16 -0
index 7c498e6d5..7e7d8470b 100644
@@ -102,12 +102,28 @@ static void test_connect(const int addr_family, const in_port_t port,
 	SAFE_CLOSE(socket.fd);
 }
 
+static int check_ipv6_support(void)
+{
+	int fd;
+
+	fd = socket(AF_INET6, SOCK_STREAM, 0);
+	if (fd == -1 && errno == EAFNOSUPPORT) {
+		tst_res(TCONF, "IPv6 not supported in kernel");
+		return 0;
+	}
+	if (fd != -1)
+		close(fd);
+	return 1;
+}
+
 static void run(void)
 {
 	int addr_family = variants[tst_variant];
 
 	tst_res(TINFO, "Using %s protocol",
 		addr_family == AF_INET ? "IPV4" : "IPV6");
+	if (addr_family == AF_INET6 && !check_ipv6_support())
+		return;
 
 	if (!SAFE_FORK()) {
 		create_server(addr_family);
Signature · 5 lines
2.52.0


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