From nobody Tue Jun 14 17:35:32 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D1B728413A4; Tue, 14 Jun 2022 17:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LMwZD5YQfz3QDJ; Tue, 14 Jun 2022 17:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655228132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0wjmU8UniUh5S+onu4OBYzO33B1u2zAYf7NO3HFQIig=; b=F+KE2l0oWdIbo4AwPKr/TjFPoK43VHV06pNqfxIr/lRUSpjJY6aSrX+kwjXp/hh+8o6qyd j0gItRRBMukINYmKbDurKTO9rUz5USFjtCbyXSP45QRgHDe8Qjb+9IYYmP60yXsqMp0lc5 9ynbfGYxOguCcSLKXQpvkadSWP4IMeBu1/vlipf6iceTz4Tf4l01w29HUhLrTBEPL8ofnb wI/8RpbZJMmvwircNxs2LrSkAIz8gBeNYH8MW5NB6+Sr1gGpLa6j2LEd2zIy+7aUAoBeMU BfBEiwGpM9aFmGAiUdh79H87gZpvFzELwvsFvyJn5OzYDTlvX8Phi38xqL3MEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F13B655B; Tue, 14 Jun 2022 17:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25EHZWfl005633; Tue, 14 Jun 2022 17:35:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25EHZWVe005632; Tue, 14 Jun 2022 17:35:32 GMT (envelope-from git) Date: Tue, 14 Jun 2022 17:35:32 GMT Message-Id: <202206141735.25EHZWVe005632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2c1052053340 - main - ktls_test: Add a helper function to close sockets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c1052053340af562e3121a41545419fa71e65f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655228132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0wjmU8UniUh5S+onu4OBYzO33B1u2zAYf7NO3HFQIig=; b=aKWCzb4maLKw0Nzqm8upKe2jk7PZKwnbyQfpNk6AEJJ/YGfKM/VlzJlfjIMa9QiAjxRvfX CwPOmI84Hoe9Jp+6tt0KcilQqviYVGoCCKDAcS2sUhunKHJGApLRFji9WtXNl/K6tzYOCM Nk9s+E356UFkmptdG0hi8Ca3kJB6drE+rvkGdoOMdIAfv9eF6isSiph8Ug1DeaVDs1tpEM mSnAUGQigHF/Wb4PxApIZbYn6HRa5t54JC89eIK5reLRssLkmSDmkXM0KG9yML6J5H/9dY EZ+G/Aq+Vmsw5lIHpCoWWpRBnrwfj45AMMnl6xgkVjdGcU/7IPH8sgJOUZ77YA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655228132; a=rsa-sha256; cv=none; b=GpWAq8l7CYJff1+/JQR/Lr7vKxXYRYJRS2S2pHdURttLY8MIbo0++7+JEucuMbsUZJC/KN d9ivcIAnHHkNP5mbBc4eMjjYdKDxKhLbX8n9qD1k4bFiyonzdcVWd/29lxb+lxUni4B6kz ysVhxa0Gs6o9+qrAs8HbHrepxN4t9zjR/voTaXOpumItiKEtfb/USVOsfgW9dQtP49TPRw dTPh7ZvmENcXBDTCi/mDpZ0tnjuC2261/zRSy+cYJwFwVcTOg6oSyQmhAluzxmagnZWlTi 04fnrEljUfIeoBe0oy0PMPHmI29OL2xJoqaO7Voz0cS9yw7Y5ISl8hROkjFPOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2c1052053340af562e3121a41545419fa71e65f7 commit 2c1052053340af562e3121a41545419fa71e65f7 Author: John Baldwin AuthorDate: 2022-06-14 17:34:38 +0000 Commit: John Baldwin CommitDate: 2022-06-14 17:34:38 +0000 ktls_test: Add a helper function to close sockets. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D35425 --- tests/sys/kern/ktls_test.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c index 759a23455f25..d5cbc727734a 100644 --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -88,7 +88,7 @@ alloc_buffer(size_t len) } static bool -socketpair_tcp(int *sv) +socketpair_tcp(int sv[2]) { struct pollfd pfd; struct sockaddr_in sin; @@ -161,6 +161,13 @@ socketpair_tcp(int *sv) return (true); } +static void +close_sockets(int sv[2]) +{ + ATF_REQUIRE(close(sv[1]) == 0); + ATF_REQUIRE(close(sv[0]) == 0); +} + static void fd_set_blocking(int fd) { @@ -993,8 +1000,7 @@ test_ktls_transmit_app_data(struct tls_enable *en, uint64_t seqno, size_t len) free(decrypted); free(plaintext); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); ATF_REQUIRE(close(kq) == 0); } @@ -1079,8 +1085,7 @@ test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type, free(decrypted); free(plaintext); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); } static void @@ -1142,8 +1147,7 @@ test_ktls_transmit_empty_fragment(struct tls_enable *en, uint64_t seqno) out: free(outbuf); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); } static size_t @@ -1282,8 +1286,7 @@ test_ktls_receive_app_data(struct tls_enable *en, uint64_t seqno, size_t len, free(received); free(plaintext); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); ATF_REQUIRE(close(kq) == 0); } @@ -1532,8 +1535,7 @@ test_ktls_invalid_transmit_cipher_suite(struct tls_enable *en) sizeof(*en)) == -1); ATF_REQUIRE(errno == EINVAL); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); } #define GEN_INVALID_TRANSMIT_TEST(name, cipher_alg, key_size, auth_alg, \ @@ -1665,8 +1667,7 @@ test_ktls_invalid_receive_cipher_suite(struct tls_enable *en) sizeof(*en)) == -1); ATF_REQUIRE(errno == EINVAL); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); } #define GEN_INVALID_RECEIVE_TEST(name, cipher_alg, key_size, auth_alg, \ @@ -1705,8 +1706,7 @@ test_ktls_unsupported_receive_cipher_suite(struct tls_enable *en) sizeof(*en)) == -1); ATF_REQUIRE(errno == EPROTONOSUPPORT); - ATF_REQUIRE(close(sockets[1]) == 0); - ATF_REQUIRE(close(sockets[0]) == 0); + close_sockets(sockets); } #define GEN_UNSUPPORTED_RECEIVE_TEST(name, cipher_alg, key_size, \