[CRIU] [PATCH] Make socket_udp-corked use different port
Andrei Vagin
avagin at virtuozzo.com
Thu Mar 29 10:20:00 MSK 2018
On Mon, Mar 26, 2018 at 12:31:21PM +0300, Vitaly Ostrosablin wrote:
> If test is run simultaneously with socket_udp - then one of tests would
> be unable to bind same port.
Why do you need to run these tests together?
The socket_udp-corked test can't be dumped, and we check that criu dump
fails on it:
$ cat test/zdtm/static/socket_udp-corked.desc
{'flags': 'crfail'}
>
> Signed-off-by: Vitaly Ostrosablin <vostrosablin at virtuozzo.com>
> ---
> test/zdtm/static/socket_udp-corked.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/zdtm/static/socket_udp-corked.c b/test/zdtm/static/socket_udp-corked.c
> index 30cfac5ec..490f27895 100644
> --- a/test/zdtm/static/socket_udp-corked.c
> +++ b/test/zdtm/static/socket_udp-corked.c
> @@ -21,7 +21,7 @@ const char *test_author = "Pavel Emelyanov <xemul at parallels.com<>\n";
> #include <sys/wait.h>
> #include <netinet/udp.h>
>
> -static int port = 8880;
> +static int port = 8882;
This port can be used too. Look in tcp_init_server_with_opts:
ret = bind(sock, (struct sockaddr *) &addr, sizeof(addr));
/* criu doesn't restore sock opts, so we need this hack */
if (ret == -1 && errno == EADDRINUSE) {
test_msg("The port %d is already in use.\n", *port);
(*port)++;
so each tcp test chooses a first unused port starting with 8880.
If you set port to zero, the kernel will choose an unused port:
@@ -43,7 +41,7 @@ int main(int argc, char **argv)
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);
+ addr1.sin_port = 0;
ret = bind(sk1, (struct sockaddr *)&addr1, len);
>
> #define MSG1 "msg1"
>
> --
> 2.16.2
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list