landlock08: Skip IPv6 variant if not supported
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.
Signed-off-by Brian Grech <[email protected]>
--- testcases/kernel/syscalls/landlock/landlock08.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
testcases/kernel/syscalls/landlock/landlock08.c +16 -0
@@ -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
Andrea Cervesato via ltp
AppliedMerged, thanks!
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp