diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-12-20 19:38:07 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-12-20 19:38:07 +0000 |
commit | f0c143b3565abdc53ee387429473d2df7c7716f7 (patch) | |
tree | 90c73c4672256542e7ad36899070c6454911ca44 | |
parent | 177034c44ed18d99e6cc85dfddd2bb04b41d38ac (diff) |
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
-rw-r--r-- | tests/sys/kern/ktls_test.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c index 9488ac24f4cc..85998fcbdf80 100644 --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -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); |