Commit 8720f1da authored by Andrei Vagin's avatar Andrei Vagin

test: check that corked udp sockets are not dumped

The kernel doesn't have an interface to get a sent queue for udp
sockets, so currently we can't dump them and criu dump has to fail in
such cases.
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 53211331
......@@ -28,6 +28,7 @@ TST_NOFILE := \
socket_listen6 \
socket_listen4v6 \
socket_udp \
socket_udp-corked \
socket6_udp \
socket_udp_shutdown \
sk-freebind \
......
#include "zdtmtst.h"
const char *test_doc = "static test for UDP socket\n";
const char *test_author = "Pavel Emelyanov <xemul@parallels.com<>\n";
/* Description:
* Create two tcp socket, server send asynchronous request on
* read data and clietn write data after migration
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
#include <sys/wait.h>
#include <netinet/udp.h>
static int port = 8880;
#define MSG1 "msg1"
int main(int argc, char **argv)
{
int ret, sk1;
socklen_t len = sizeof(struct sockaddr_in);
struct sockaddr_in addr1;
int opt;
test_init(argc, argv);
sk1 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sk1 < 0) {
pr_perror("Can't create socket");
return 1;
}
memset(&addr1, 0, sizeof(addr1));
addr1.sin_family = AF_INET;
addr1.sin_addr.s_addr = inet_addr("127.0.0.1");
addr1.sin_port = htons(port);
ret = bind(sk1, (struct sockaddr *)&addr1, len);
if (ret < 0) {
pr_perror("Can't bind socket");
return 1;
}
ret = connect(sk1, (struct sockaddr *)&addr1, len);
if (ret < 0) {
pr_perror("Can't connect");
return 1;
}
opt = 1;
if (setsockopt(sk1, SOL_UDP, UDP_CORK, &opt, sizeof(opt))) {
pr_perror("Unable to set UDP_CORK");
return 1;
}
if (write(sk1, MSG1, sizeof(MSG1)) != sizeof(MSG1)) {
pr_perror("write");
return 1;
}
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