From: Brian Grech via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] landlock08: Skip IPv6 variant if not supported
Date: Wed, 17 Dec 2025 13:06:37 -0600 [thread overview]
Message-ID: <20251217190637.60929-1-bgrech@redhat.com> (raw)
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.
Signed-off-by: Brian Grech <bgrech@redhat.com>
---
testcases/kernel/syscalls/landlock/landlock08.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/testcases/kernel/syscalls/landlock/landlock08.c b/testcases/kernel/syscalls/landlock/landlock08.c
index 7c498e6d5..7e7d8470b 100644
--- a/testcases/kernel/syscalls/landlock/landlock08.c
+++ b/testcases/kernel/syscalls/landlock/landlock08.c
@@ -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);
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2025-12-17 19:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 19:06 Brian Grech via ltp [this message]
2025-12-18 7:28 ` [LTP] [PATCH] landlock08: Skip IPv6 variant if not supported Andrea Cervesato via ltp
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=20251217190637.60929-1-bgrech@redhat.com \
--to=ltp@lists.linux.it \
--cc=bgrech@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox