Commit baed9dd9 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

zdtm: check restoring of sockets in the TCP_CLOSE state

(00.004456) Error (sk-inet.c:188): Name resolved on unconnected socket
(00.004466) Error (cr-dump.c:1255): Dump files (pid: 7944) failed with -1
(00.004680) Error (cr-dump.c:1617): Dumping FAILED.
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ee6fbf7c
......@@ -64,6 +64,7 @@ TST_NOFILE = \
socket-tcpbuf \
socket-tcpbuf-local \
socket-tcpbuf6 \
socket-closed-tcp \
sock_opts00 \
sock_opts01 \
sk-unix-unconn \
......
#include "zdtmtst.h"
#ifdef ZDTM_IPV6
#define ZDTM_FAMILY AF_INET6
#else
#define ZDTM_FAMILY AF_INET
#endif
const char *test_doc = "Check, that a TCP socket in the TCP_CLOSE state can be restored\n";
const char *test_author = "Andrey Vagin <avagin@openvz.org";
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
#include <netinet/tcp.h>
static int port = 8880;
int main(int argc, char **argv)
{
int fd, fd_s, clt;
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
err("initializing server failed");
return 1;
}
clt = tcp_init_client(ZDTM_FAMILY, "localhost", port);
if (clt < 0)
return 1;
/*
* parent is server of TCP connection
*/
fd = tcp_accept_server(fd_s);
if (fd < 0) {
err("can't accept client connection %m");
return 1;
}
close(fd_s);
shutdown(fd, SHUT_WR);
shutdown(clt, SHUT_WR);
close(fd);
test_daemon();
test_waitsig();
pass();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment