2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

test: check ipv6 sockets which handle ipv4 connections

A server socket is created with AF_INET6, but a client
socket is create with AF_INET.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Andrei Vagin
2017-11-02 00:40:35 +03:00
parent 6e770e50b8
commit 00413cb5a7
28 changed files with 99 additions and 20 deletions

View File

@@ -26,6 +26,7 @@ TST_NOFILE := \
sched_policy00 \
socket_listen \
socket_listen6 \
socket_listen4v6 \
socket_udp \
socket6_udp \
socket_udp_shutdown \
@@ -65,27 +66,35 @@ TST_NOFILE := \
socket-tcp \
socket-tcp-reseted \
socket-tcp6 \
socket-tcp4v6 \
socket-tcp-local \
socket-tcp-reuseport \
socket-tcp-nfconntrack \
socket-tcp6-local \
socket-tcp4v6-local \
socket-tcpbuf \
socket-tcpbuf-local \
socket-tcpbuf6-local \
socket-tcpbuf6 \
socket-tcp-fin-wait1 \
socket-tcp6-fin-wait1 \
socket-tcp4v6-fin-wait1 \
socket-tcp-fin-wait2 \
socket-tcp6-fin-wait2 \
socket-tcp4v6-fin-wait2 \
socket-tcp-close-wait \
socket-tcp6-close-wait \
socket-tcp4v6-close-wait \
socket-tcp-last-ack \
socket-tcp6-last-ack \
socket-tcp4v6-last-ack \
socket-tcp-closing \
socket-tcp6-closing \
socket-tcp4v6-closing \
socket-tcp-closed \
socket-tcp-closed-last-ack \
socket-tcp6-closed \
socket-tcp4v6-closed \
socket-tcp-close0 \
socket-tcp-close1 \
socket-tcp-unconn \
@@ -435,14 +444,18 @@ sem: CFLAGS += -DNEW_IPC_NS
posix_timers: LDLIBS += -lrt -pthread
remap_dead_pid_root: CFLAGS += -DREMAP_PID_ROOT
socket-tcp6: CFLAGS += -D ZDTM_IPV6
socket-tcp4v6: CFLAGS += -D ZDTM_IPV4V6
socket-tcpbuf6: CFLAGS += -D ZDTM_IPV6
socket-tcpbuf-local: CFLAGS += -D ZDTM_TCP_LOCAL
socket-tcpbuf6-local: CFLAGS += -D ZDTM_TCP_LOCAL -D ZDTM_IPV6
socket-tcp6-local: CFLAGS += -D ZDTM_TCP_LOCAL -D ZDTM_IPV6
socket-tcp4v6-local: CFLAGS += -D ZDTM_TCP_LOCAL -D ZDTM_IPV4V6
socket-tcp-local: CFLAGS += -D ZDTM_TCP_LOCAL
socket-tcp-nfconntrack: CFLAGS += -D ZDTM_TCP_LOCAL -DZDTM_CONNTRACK
socket_listen6: CFLAGS += -D ZDTM_IPV6
socket_listen4v6: CFLAGS += -D ZDTM_IPV4V6
socket-tcp6-closed: CFLAGS += -D ZDTM_IPV6
socket-tcp6-closed: CFLAGS += -D ZDTM_IPV4V6
socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK
mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL
sigpending: LDLIBS += -lrt
@@ -474,12 +487,17 @@ socket-tcp-fin-wait1: CFLAGS += -D ZDTM_TCP_FIN_WAIT1
socket-tcp-fin-wait2: CFLAGS += -D ZDTM_TCP_FIN_WAIT2
socket-tcp6-fin-wait1: CFLAGS += -D ZDTM_TCP_FIN_WAIT1 -D ZDTM_IPV6
socket-tcp6-fin-wait2: CFLAGS += -D ZDTM_TCP_FIN_WAIT2 -D ZDTM_IPV6
socket-tcp4v6-fin-wait1: CFLAGS += -D ZDTM_TCP_FIN_WAIT1 -D ZDTM_IPV4V6
socket-tcp4v6-fin-wait2: CFLAGS += -D ZDTM_TCP_FIN_WAIT2 -D ZDTM_IPV4V6
socket-tcp-close-wait: CFLAGS += -D ZDTM_TCP_CLOSE_WAIT
socket-tcp6-close-wait: CFLAGS += -D ZDTM_TCP_CLOSE_WAIT -D ZDTM_IPV6
socket-tcp4v6-close-wait: CFLAGS += -D ZDTM_TCP_CLOSE_WAIT -D ZDTM_IPV4V6
socket-tcp-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK
socket-tcp6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV6
socket-tcp6-closing: CFLAGS += -D ZDTM_IPV6
socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6
socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6
socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6
pty-console: CFLAGS += -D ZDTM_DEV_CONSOLE

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check sockets in TCP_WAIT_STOP and TCP_LAST_ACK states\n";
@@ -186,7 +191,7 @@ int main(int argc, char **argv)
if (!newns)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check closed tcp sockets\n";
@@ -45,7 +50,7 @@ int main(int argc, char **argv)
return 1;
}
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check sockets in the TCP_CLOSING state\n";
@@ -160,7 +165,7 @@ int main(int argc, char **argv)
if (!newns)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check sockets in TCP_FIN_WAIT* states\n";
@@ -159,7 +164,7 @@ int main(int argc, char **argv)
if (!newns)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed");
return 1;
}

View File

@@ -1 +1 @@
{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens', 'feature' : 'tcp_half_closed'}
{'flavor': 'h ns uns', 'opts': '--tcp-established', 'flags': 'nouser samens', 'feature' : 'tcp_half_closed'}

View File

@@ -6,11 +6,15 @@
#include <stdlib.h>
#include <sys/wait.h>
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check, that a reseted TCP connection can be restored\n";
@@ -35,7 +39,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check unconnected tcp sockets\n";
@@ -42,7 +47,7 @@ int main(int argc, char **argv)
return 1;
}
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check unconnected tcp sockets\n";
@@ -41,7 +46,7 @@ int main(int argc, char **argv)
return 1;
}
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "Check, that a TCP connection can be restored\n";
@@ -135,7 +140,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
#endif
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -0,0 +1 @@
socket-tcp-close-wait.c

View File

@@ -0,0 +1 @@
socket-tcp6-close-wait.desc

View File

@@ -0,0 +1 @@
socket-tcp-closed.c

View File

@@ -0,0 +1 @@
socket-tcp6-closed.desc

View File

@@ -0,0 +1 @@
socket-tcp-closing.c

View File

@@ -0,0 +1 @@
socket-tcp6-closing.desc

View File

@@ -0,0 +1 @@
socket-tcp-fin-wait1.c

View File

@@ -0,0 +1 @@
socket-tcp6-fin-wait1.desc

View File

@@ -0,0 +1 @@
socket-tcp-fin-wait2.c

View File

@@ -0,0 +1 @@
socket-tcp6-fin-wait2.desc

View File

@@ -0,0 +1 @@
socket-tcp-last-ack.c

View File

@@ -0,0 +1 @@
socket-tcp6-last-ack.desc

View File

@@ -0,0 +1 @@
socket-tcp.c

View File

@@ -0,0 +1 @@
socket-tcp6-local.desc

View File

@@ -0,0 +1 @@
socket-tcp.c

View File

@@ -0,0 +1 @@
socket-tcp6.desc

View File

@@ -1,9 +1,14 @@
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#ifdef ZDTM_IPV4V6
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET6
#elif defined(ZDTM_IPV6)
#define ZDTM_FAMILY AF_INET6
#define ZDTM_SRV_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#define ZDTM_SRV_FAMILY AF_INET
#endif
const char *test_doc = "static test for listening socket\n";
@@ -43,7 +48,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
pr_err("initializing server failed\n");
return 1;
}

View File

@@ -0,0 +1 @@
socket_listen.c