diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -1893,7 +1893,13 @@ 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);