[CRIU] [PATCH 1/2] zdtm: check SO_REUSEADDR is restored
Andrew Vagin
avagin at parallels.com
Mon Jan 14 07:26:26 EST 2013
This series may fix the bug
https://bugzilla.openvz.org/show_bug.cgi?id=2485
On Mon, Jan 14, 2013 at 02:49:02PM +0400, Andrey Vagin wrote:
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> test/zdtm/live/static/socket-tcp.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/test/zdtm/live/static/socket-tcp.c b/test/zdtm/live/static/socket-tcp.c
> index b37f012..ca5939e 100644
> --- a/test/zdtm/live/static/socket-tcp.c
> +++ b/test/zdtm/live/static/socket-tcp.c
> @@ -58,6 +58,8 @@ int main(int argc, char **argv)
> pid_t extpid;
> uint32_t crc;
> int pfd[2];
> + int val;
> + socklen_t optlen;
>
> if (pipe(pfd)) {
> err("pipe() failed");
> @@ -136,6 +138,12 @@ int main(int argc, char **argv)
> return 1;
> }
>
> + val = 1;
> + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val))) {
> + err("setsockopt");
> + return 1;
> + }
> +
> test_daemon();
> #ifdef STREAM
> while (test_go()) {
> @@ -169,6 +177,16 @@ int main(int argc, char **argv)
> if (datachk(buf, BUF_SIZE, &crc))
> return 2;
> #endif
> + optlen = sizeof(val);
> + if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, &optlen)) {
> + err("getsockopt");
> + return 1;
> + }
> + if (val != 1) {
> + fail("SO_REUSEADDR are not set for %d\n", fd);
> + return 1;
> + }
> +
> pass();
> return 0;
> }
> --
> 1.7.11.7
>
More information about the CRIU
mailing list