Make the test to leave one connection on the incomplete queue

before exiting.  This examines some race conditions in kernel.
This commit is contained in:
Gleb Smirnoff 2017-06-08 06:13:53 +00:00
parent f7ff0c669e
commit 62b2dd31af

View File

@ -233,6 +233,20 @@ main(void)
errx(-1, "not ok 11 - accept #2 %s", strerror(errno));
printf("ok 11 - accept\n");
#if 1
/*
* XXXGL: this doesn't belong to the test itself, but is known
* to examine rarely examined paths in the kernel. Intentionally
* leave a socket on the incomplete queue, before the program
* exits.
*/
so = socket(PF_INET, SOCK_STREAM, 0);
if (so == -1)
errx(-1, "not ok 12 - socket: %s", strerror(errno));
if (connect(so, (struct sockaddr *)&sin, sizeof(sin)) < 0)
errx(-1, "not ok 12 - connect %s", strerror(errno));
#endif
/*
* Step 11: Remove accept filter. After removing the accept filter
* getsockopt() should fail with EINVAL.