mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 21:07:43 +00:00
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: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
776782fe20
commit
c767b11c54
@ -28,6 +28,7 @@ TST_NOFILE := \
|
||||
socket_listen6 \
|
||||
socket_listen4v6 \
|
||||
socket_udp \
|
||||
socket_udp-corked \
|
||||
socket6_udp \
|
||||
socket_udp_shutdown \
|
||||
sk-freebind \
|
||||
|
76
test/zdtm/static/socket_udp-corked.c
Normal file
76
test/zdtm/static/socket_udp-corked.c
Normal file
@ -0,0 +1,76 @@
|
||||
#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;
|
||||
}
|
1
test/zdtm/static/socket_udp-corked.desc
Normal file
1
test/zdtm/static/socket_udp-corked.desc
Normal file
@ -0,0 +1 @@
|
||||
{'flags': 'crfail'}
|
Loading…
x
Reference in New Issue
Block a user