ktls_tests: Ignore spurious errors from shutdown(2).

For some of the "bad size" tests, the remote end can notice the error
and drop the connection before the test program returns from write to
call shutdown.  In that case, shutdown fails with ENOTCONN.  Permit
these ENOTCONN errors without failing the test.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37693
This commit is contained in:
John Baldwin 2022-12-20 11:38:07 -08:00
parent 177034c44e
commit f0c143b356

View File

@ -1893,7 +1893,13 @@ test_ktls_receive_bad_size(const atf_tc_t *tc, struct tls_enable *en,
rv = write(sockets[1], outbuf, outbuf_len);
ATF_REQUIRE_INTEQ((ssize_t)outbuf_len, rv);
ATF_REQUIRE(shutdown(sockets[1], SHUT_WR) == 0);
/*
* 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.
*/
if (shutdown(sockets[1], SHUT_WR) != 0)
ATF_REQUIRE_ERRNO(ENOTCONN, true);
ktls_receive_tls_error(sockets[0], EMSGSIZE);