ktls tests: Relax error checking for shutdown(2) a bit

In my test suite runs I occasionally see shutdown(2) fail with
ECONNRESET rather than ENOTCONN.  soshutdown(2) will return ENOTCONN if
the socket has been disconnected (synchronized by the socket lock), and
tcp_usr_shutdown() will return ECONNRESET if the inpcb has been dropped
(synchronized by the inpcb lock).  I think it's possible to pass the
first check in soshutdown() but fail the second check in
tcp_usr_shutdown(), so modify the KTLS tests to permit this.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42277
This commit is contained in:
Mark Johnston 2023-11-17 09:29:28 -05:00
parent 1965dd85c3
commit b08a9b86f5

View File

@ -1904,10 +1904,13 @@ test_ktls_receive_bad_size(const atf_tc_t *tc, struct tls_enable *en,
/*
* The other end may notice the error and drop the connection
* before this executes resulting in shutdown() failing with
* ENOTCONN. Ignore this error if it occurs.
* either ENOTCONN or ECONNRESET. Ignore this error if it
* occurs.
*/
if (shutdown(sockets[1], SHUT_WR) != 0)
ATF_REQUIRE_ERRNO(ENOTCONN, true);
if (shutdown(sockets[1], SHUT_WR) != 0) {
ATF_REQUIRE_MSG(errno == ENOTCONN || errno == ECONNRESET,
"shutdown() failed: %s", strerror(errno));
}
ktls_receive_tls_error(sockets[0], EMSGSIZE);