From patchwork Fri Feb 23 20:17:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775636 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EDAD12883B; Fri, 23 Feb 2024 20:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719541; cv=none; b=kn9sfnCGBzXsPuxQivDyxzeaJXIoMbvgL2wAUuo0oOBMQm4bxWBzt9qYUJjzSiFG7//sGr8miu9imTfPvBz9RVzbw4XEpNkNvvE+hEdaNAY3XazlpmGUluBXytXopkqA/c3Dh3/ZfabTWKlZjo9whV3l+cct78u0CUypXThNYDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719541; c=relaxed/simple; bh=z+O5DtTWdH0ZKK/rzyO8SbI2hdiB5u9quPFzJzLc4tI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CMerL/rocs7Mt53IZ+B8+cY28Knijz70b7ZKjinMSvRp/evspvCEsoLdS56RCG9x/2vu7351Adv6mNNUtn8RZCxLy6yM46n5JCHNLEZLFTppy1JBiLj9H1e13kEaxqKKjwdtfQQ+LCTFpcZ25zcAG9yuEcomYPRtOUkcbl4WYls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gKIQCYw6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gKIQCYw6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD45C433B1; Fri, 23 Feb 2024 20:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719540; bh=z+O5DtTWdH0ZKK/rzyO8SbI2hdiB5u9quPFzJzLc4tI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gKIQCYw6N2s6DxzUOudonCL7QgrcZqvtqXzOPUFOH+VxLOtrysHPu7XL+NlloZvEc M70+tduBaCIt8No+omhZblUa/Mzl7oYvjMnnAzfu5RD3DDLd9Um3poxca4lj4KTyL3 hCNAj5bHlC1/CP32tnejlZN/ZKK6CSKe6uywv6P/S8EzyCX19tDNkk/XSonkjmu2Dx QEgz0zMPsc+/0PHhLXLpTtqiu9x/jGG7slM4aKlk+KZL/iEIFzp84RojCd8X80b5/Y 69A8cdQEYiKy6PtW40M4LrEqtRz9cV3LnwunUGH82BBDidB0dkzipTgIvK8vS7ATtX 1KSUPM5CQ8zuw== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:53 +0100 Subject: [PATCH net-next 1/8] selftests: mptcp: lib: catch duplicated subtest entries Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-1-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2321; i=matttbe@kernel.org; h=from:subject:message-id; bh=z+O5DtTWdH0ZKK/rzyO8SbI2hdiB5u9quPFzJzLc4tI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qSO3J+Sp8+XgiWWduwESPxAdtI98A3QFLW tTkm2+0VqWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c4i/D/9+Wl4OazvQpjJdSwVqTdj9zFoIfpK+clG8/d5OEyq56TGiLr/+bIjT5hreS2Z35QP+F3H WmOeTKVDA5NKwBuXDUzPnn/BaLSLqS93PsSktND9EI7ME/FNnyPHJOcVyhWnJDA4SmkT1cg2p4l YPA7AaYMc26/Qw6fwjCPnK0xYwGwZnYmG/lF6wvRv0gs298uJtAN/A1QTvYDkcBlOSuy8brXliA ia+L68IoF8vKIg0RM1OTOHQqDai5/QmcnXUlKN/iylrG4zIUdYWwLlCFxJCpN4jNvQET3g+WsYm 6QW1CCV/lNFDiR28G/Ce9DI3QUGa0fqVPAZy4D9/uJ4Tou/Yb5k3n9Kn/kLgRDxVWBzqngC+5qh cYsEl2j1fedeHR+TNX586VQbU2zeXXRgcUSUJvbhFVtFvYZWBytI3c89IZkmUSk7lhpHqtohVpw 2Gr+yC/dwG5c2FuNn8H480LryzeCZKvc/d/fot2OYU1yBXQe0MIq4fYWqTcbdDGoTrgENp0pNk4 OFEgIH7OkxAjXUYeJaMLkyCWWo+NVzC165nAbLs9Qxxp4nqOhm86WMWxDe8ef1NMsS1okqDAmPz nT3OmpKRp5vuVxG0onZYh2yUFCj97sZfWV7I77cmMxvMoUBt/cl9o5qKJMsK5dtXMbjRUi3McFG UXB0wgxRodV9cvQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It is important to have a unique (sub)test name in TAP, because some CI environments drop tests with duplicated name. When adding a new subtest entry, an error message is printed in case of duplicated entries. If there were duplicated entries and if all features were expected to work, the script exits with an error at the end, after having printed all subtests in the TAP format. Thanks to that, the MPTCP CI will catch such issues early. Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 3a2abae5993e..037cb3e84330 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -9,6 +9,7 @@ readonly KSFT_SKIP=4 readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}" MPTCP_LIB_SUBTESTS=() +MPTCP_LIB_SUBTESTS_DUPLICATED=0 # only if supported (or forced) and not disabled, see no-color.org if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } && @@ -146,12 +147,26 @@ mptcp_lib_kversion_ge() { mptcp_lib_fail_if_expected_feature "kernel version ${1} lower than ${v}" } +__mptcp_lib_result_check_duplicated() { + local subtest + + for subtest in "${MPTCP_LIB_SUBTESTS[@]}"; do + if [[ "${subtest}" == *" - ${KSFT_TEST}: ${*%% #*}" ]]; then + MPTCP_LIB_SUBTESTS_DUPLICATED=1 + mptcp_lib_print_err "Duplicated entry: ${*}" + break + fi + done +} + __mptcp_lib_result_add() { local result="${1}" shift local id=$((${#MPTCP_LIB_SUBTESTS[@]} + 1)) + __mptcp_lib_result_check_duplicated "${*}" + MPTCP_LIB_SUBTESTS+=("${result} ${id} - ${KSFT_TEST}: ${*}") } @@ -206,6 +221,12 @@ mptcp_lib_result_print_all_tap() { for subtest in "${MPTCP_LIB_SUBTESTS[@]}"; do printf "%s\n" "${subtest}" done + + if [ "${MPTCP_LIB_SUBTESTS_DUPLICATED}" = 1 ] && + mptcp_lib_expect_all_features; then + mptcp_lib_print_err "Duplicated test entries" + exit ${KSFT_FAIL} + fi } # get the value of keyword $1 in the line marked by keyword $2 From patchwork Fri Feb 23 20:17:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775381 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 319FE14938A; Fri, 23 Feb 2024 20:19:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719545; cv=none; b=syCak26xb6FpjUhuJtnXi8BNJWBrE9Z63iUTOXf4d/kZd4n7uz05630NSSS64z4Q/mS0Jl6/C41NoLPOPHtJQW2uLUB+kOjiIJGj0tiOlmwrC7ViMhwdhblYo5J0cLZ5pu9ffr58j40dwPtOWuBU2Rqqlx9KSRhfxzQaKbNr0wg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719545; c=relaxed/simple; bh=Dm6ZdORui82/8VoYa4bD5q/6VoXige1uFQXuWG3HMks=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SrnqrAdN52uY3DbnkMG6uqxP003ynq7onolVinf8nIJolnGdLWhiGKaWjouppeAbQ5RIXnyuxsNb68/+nxu6kNk0w54jHy75Nt+/UmyQbBewP8eOBgHBP/jXySeHL5OxtBcqMhmlUwiXQlCqLvV9YPfEWE/S1dY5rfdkS2DNzBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sBpChH4u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sBpChH4u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AED8C433C7; Fri, 23 Feb 2024 20:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719544; bh=Dm6ZdORui82/8VoYa4bD5q/6VoXige1uFQXuWG3HMks=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sBpChH4ubXj9H2Rq6Zjdq1N8SM3jKzp/2P5UcRMCsk+oNWuTfWTikoN32ya4NJxvN waNiAHkJsQJeAOSPtWISoAmE4U4SixqmrRJpj2yltbcOFlpXtijD8IvuhE6hWEoj3J ZKI0lQlDEVGuKU7NzaiITE+7UwkqFhnK1nFHU8Xt7GhK5Z5CJ6lb15uaPid6c+Yiwp iz4Iz6wq4bDcAchlR4CSbkzGW04c/7f9fAVsw9o9EOT0YONSyooThTGssr13bv8Odn Vl8wXRrwk2BJtE5NelQZ3ZCtysYE8rbs1XURb72/jDu03hQLqRLX9GK+0gePih3s2u SBc+gQsId5SkA== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:54 +0100 Subject: [PATCH net-next 2/8] mptcp: token kunit: set protocol Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-2-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1235; i=matttbe@kernel.org; h=from:subject:message-id; bh=Dm6ZdORui82/8VoYa4bD5q/6VoXige1uFQXuWG3HMks=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2q2eS9x43GC5y4A1Ev0Db4KVnezwT0MGWbc R/lDEWzoIKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c7jnD/4jD0nW63U92fD3F/Fzyx81Zku0ZzjDDRDfwaZC5/HajMUrJmOWRY24NV0oHlkMYa2J6kY jpLpuJyu7+Y8J9L5wTpdKKGIGi7pOSuB9JZQBgjYRBlWsK2nVPbgSJ756oHJPekgEM7nXsCElfO mOoq8VG1Qm4vWDxIqxUdBp9/8oiOKN4U3OwQUFxJvMBjxtgH3PxEEV6C2x49oPkfyVWW4bMGFt9 yVJNcDiZn79hgc+N0Zl0fG0XLNrR99IOCydPxrQKzdwkqRrhGtG7OnAkoBJSQAcrUSrka/WnXC/ oU7h6RJXdPVb3y8jccAGdgJ/KBhkGIlF6w2bqmQe+9jgrlvY1dp+gAs56Ivgy11kyNKr6kShrzh eTgR8KiFg397D/U8YNtVfgWkln52tW+ve0DGUGAgaWBiAtEkP9Lm3xv3RTt5m85JJmyXWVbZ5Jc /dzLFX7X3gOUDCZ0Bq/cGJnm98DEMTStHCfAQwP0cFQSgwlmWjDomyw5WnkLsZ/EzX5MFn2ywMf ynE0SSyY5b5+tP64CauPOky8+cLM5Dl8mj+foz6KJDOKvZrB577STwUK0XsgQ/ZSbo0PbpTt7u4 aPqvTj8fyvVtKmVWq8xxNb/7KhwtzsjM+PTr9Tvv0oPvrNVhA0YNQWGgq/4ulnLcoS2Z3Bil1Z6 OXcc9tkgFMzHwqw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 As it would be done when initiating an MPTCP sock. This is not strictly needed for this test, but it will be when a later patch will check if the right protocol is being used when calling mptcp_sk(). Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/token_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c index bfff53e668da..4fc39fa2e262 100644 --- a/net/mptcp/token_test.c +++ b/net/mptcp/token_test.c @@ -52,14 +52,19 @@ static struct mptcp_subflow_context *build_ctx(struct kunit *test) static struct mptcp_sock *build_msk(struct kunit *test) { struct mptcp_sock *msk; + struct sock *sk; msk = kunit_kzalloc(test, sizeof(struct mptcp_sock), GFP_USER); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk); refcount_set(&((struct sock *)msk)->sk_refcnt, 1); sock_net_set((struct sock *)msk, &init_net); + sk = (struct sock *)msk; + /* be sure the token helpers can dereference sk->sk_prot */ - ((struct sock *)msk)->sk_prot = &tcp_prot; + sk->sk_prot = &tcp_prot; + sk->sk_protocol = IPPROTO_MPTCP; + return msk; } From patchwork Fri Feb 23 20:17:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775635 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A8701482E5; Fri, 23 Feb 2024 20:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719549; cv=none; b=LUFrrrSSP7oq6UiB2BsES0Uk4UBC7QujyXYYzsMaO+bayq7M6h3LBDF0XQLRC/nLk/eFTpkffDswS6HlGLT7Gti6U6c3b6nO/AlVmoxKqN/ZrlFMEgP28z27MA2Tb/QqBAo4dsEommAMlPnB2vThlp8voZl3Wg7S+cU4xjuKNjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719549; c=relaxed/simple; bh=5XbSbQcot76vzj51X+whLVWkOCVpbJ7qUINfOKnN9hg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GZSVm+NF/ImYSnhHS39+ltwVxRPef1zdecZwrJ8xbO1upc1bJ13pQWe5hSDML+D+WuyCdoVQbf/maEkZFVj+2oAz0+0jN+0ZYV5Wb6FbHmpgFNyIpZqO2mukySDz/7ZZ5qdNt+y9PPc6gBP0lPpVYMnu3Bq4Y7UjGlzEi8+XYbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hfZNbvzd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hfZNbvzd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2733C43394; Fri, 23 Feb 2024 20:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719547; bh=5XbSbQcot76vzj51X+whLVWkOCVpbJ7qUINfOKnN9hg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hfZNbvzdZgvLZ1tTNkjehvObdDMPeXJRgHniT0Lqqs0HcJCJjHcC+Ue9kSe3l0X1j CrD32wlNKoh2540oQLVpVPpAoOIQtlBYfDph/eRH4HCqzuZ/CHlILT4vzIobaoehu7 T3ycpDbWI4QOrmV5n9dU/ns0s+l+ZiL8Ys4xycG+Br6IfZ3ST8rLNrb1ojbF8MJBnu Ave7Ny4Mu+YmVyyyfxi2Mb/7mD6sUnTp80+7QE2AiGszZjRuoOoJUL1rTxCGmSRCST 3tBY2IBeyXSZSDKACt8Z/z2qLuuzSYAGN2yeUaBGFSCeLzzf617lP4aXmO1cTR1ExY IQ/+5NAeHgIvg== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:55 +0100 Subject: [PATCH net-next 3/8] mptcp: check the protocol in tcp_sk() with DEBUG_NET Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-3-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1728; i=matttbe@kernel.org; h=from:subject:message-id; bh=5XbSbQcot76vzj51X+whLVWkOCVpbJ7qUINfOKnN9hg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qqgyGZmRgipL2S8fnVMnKdCwOJ6MnG75o0 IF3dBDDlmaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c7p8D/4/9mO6jOvdkRSma6O/NWv4g3f+bULreS5iFD32UZeJOVBRE4DmnSyRfcSzG0BmOmnMl3/ 6myuP1ffuXtLyGF91dzbHHPFzO205edTjX94iNQhR+p3PHygYwDQ+pFongXYnBvKnbgcnnZIARp mLjA1TP6uo6wLs00TpzCT44S/Nsiw2lrIdGAGGu+3nnh2BtLY2oh0TJxQy6wS1EGdp/PX6PoMhU bmnFbgaT2xSXVmVZcrtTt7fk9FBxhltIMRAam0dVEN+8TIW4swCDGjiB9uOK/4z4qvwVmrns8rl 5s4l3DlQzeijAlC0ctIPR7i67NG5rltHh7zxxQ78Hra9SlWWxERSwislWK1T0zFYAyylozkNMBB 7I4WUPlzki0rtfKKDzB1ty7MbWJaFUvGGkTpzKcNeMhTxb1bvbaWT5aZtFT6QGPWpe31FkTh2Np 1hKju4Q4vhb70PmL33zNwIBcYZo/6jCKiPnPoh3dv1CW9tnLoh3+ZUeR8adzvT+d/Aa/C438b8c LLvyrT3CVZJCtS/+bpkNJMooi/Xt6KRJt2hDMX4BHmu8rbt8LHMHd4PowHeHpzuuqXn2yQqbpO3 X4lXA5iJrXRHN5CsV5WzSxDyhH86G+LIkgehxwK1d0bJAWDFHetUw1wMaDkMzbHcbCbz/Cqglp+ 8KS40rWsTxfV1/w== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Fuzzers and static checkers might not detect when tcp_sk() is used with a non tcp_sock structure. This kind of mistake already happened a few times with MPTCP: when wrongly using TCP-specific helpers with mptcp_sock pointers. On the other hand, there are many 'tcp_xxx()' helpers that are taking a 'struct sock' pointer as arguments, and some of them are only looking at fields from 'struct sock', and nothing from 'struct tcp_sock'. It is then tempting to use them with a 'struct mptcp_sock'. So a new simple check is done when CONFIG_DEBUG_NET is enabled to tell kernel devs when a non-TCP socket is being used as a TCP one. 'tcp_sk()' macro is then re-defined to add a WARN when an unexpected socket is being used. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index f89b197a9f92..026ed360bd72 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -348,6 +348,16 @@ static inline void msk_owned_by_me(const struct mptcp_sock *msk) sock_owned_by_me((const struct sock *)msk); } +#ifdef CONFIG_DEBUG_NET +/* MPTCP-specific: we might (indirectly) call this helper with the wrong sk */ +#undef tcp_sk +#define tcp_sk(ptr) ({ \ + typeof(ptr) _ptr = (ptr); \ + WARN_ON(_ptr->sk_protocol != IPPROTO_TCP); \ + container_of_const(_ptr, struct tcp_sock, inet_conn.icsk_inet.sk); \ +}) +#endif + #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk) /* the msk socket don't use the backlog, also account for the bulk From patchwork Fri Feb 23 20:17:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775380 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7A81146E84; Fri, 23 Feb 2024 20:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719553; cv=none; b=jah+GJd0SGISxYpf2k+YN1C6VOq9sTxwD6FXCjremm7rPkDQu7TX5T1fwCgpk/RKt6Kvu65WZUpiM0tpOSoes5nPa+3v8rFXjXFr/WxhrkRTAcvJD4A8wXTH65HFLXr3iWcgAbJffdiyC6vQmSdmi/nSN7KI7H4VNMFz7N1Nt58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719553; c=relaxed/simple; bh=CUxFDPyTjDPgcgfn5h2C/Q9GGH3cNDWmsoWlzMpvK6c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HbWVRHMswrH1OJKbE54wQFgZlXXsIutISovrDjtZvI6qaK2jbgb+ttJIDYfTjt1YFGhy4nvIhOpP07LFRLCRqgbkArI8MUI/AB/jck9RRrk55dYd4arjnFm0QHNvvCgSzLQaisCp3bJUdQ9To1nUz41MX0aq0D2bSod1FhRoW14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pRRy/pWa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pRRy/pWa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5195BC433C7; Fri, 23 Feb 2024 20:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719551; bh=CUxFDPyTjDPgcgfn5h2C/Q9GGH3cNDWmsoWlzMpvK6c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pRRy/pWaoT1wDkwlVwp4ayT1x5iXCaJQZ4X5d6wrdqCCrpBDulYaIGVMYG+of5SA9 2kqwy91EIpIsFli8RAVVbHqHFNW1o01+KsBMvWIUDqMG6Lprao0pj4xwZnRuUwVksw 1eoPh2tbE81Qk8xQGsv4d8UhuYQOTMG3IEA8ljIRKQ6K7ALsXU4PghKKszckc98QrA LZysgVeqm4mRPFvLoXDueXueLDlXOhgIjFsMXmdk2zM/Cszy8J0gwzd8ZClbysy6Kk QqL7aYLam4chtYUmMoujxHQmf2YbttpyiYIeoWGuSUvenCiYAw6zb33G7iXf66MDcd qI+ipf1X13+1g== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:56 +0100 Subject: [PATCH net-next 4/8] mptcp: check the protocol in mptcp_sk() with DEBUG_NET Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-4-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1495; i=matttbe@kernel.org; h=from:subject:message-id; bh=CUxFDPyTjDPgcgfn5h2C/Q9GGH3cNDWmsoWlzMpvK6c=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qEcJtSiUiDIwSGN1n9T5qWPvJ2VGPQKWAF p8P6A9lM4yJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c2gcEADibZI0WrfH0y2ybUH4yxBwbFJfUZEWnjhaaPJVdiH+/WjOcyRPvwLivx0QTPPAYOPiJ1c V4OHbrUISKyAhPMBuxmyXIpgwh93V2xcQF9+gjy7UTFzAm/1ql3uZncCAZNGO6+g9EJy8pyQCEO TTBmFcBI7o0/lxbJspHwUe+qQ0SSMJYxcVFgcX/B9de8tgJv1aQtLUC79PSTfm+oez+KrgXbr9S JFyI/MTIR4HmXLnwz7Y8PK+jr2uPZtqfar2z32/OMgLbynKlKKOvmNv5Uebi5baJvNVAPtCnau7 ASS4unrgi4KcxcoPCUa/juBrWX7rXc1XQT37ikK3D4CQ8rIIyOKEBPhy+5oMZ71TYg435Y46gb1 GgxyiwgsKIR5H0nF/+7B7yPPgCLt4u7vf1yh9whWycXga19ivpYG6sNa3e1+OK6/zb96oQaS7Cm gdAAlcuH8KvwUp92RkRpq2ERBfu9a5tpvaD+x1B9oIFQ2TShqLiHss3gJ1YvA4Mw0soc92tE/ov GNtbMrMxnO1jwiNv8iVqJcjvsfi929hhj29uHUCCnVNBn/UjTh1tTrOxFIJsoJMdWKcqPxCFEZP BTwXnwhoKDCMWxgRv2rWBJMG3jfwYaToN1J5HMm/ezi8kKE+v9CWu3VTg9+fUYii+I0G386Endj jckuvanoILA96vg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Fuzzers and static checkers might not detect when mptcp_sk() is used with a non mptcp_sock structure. This is similar to the parent commit, where it is easy to use mptcp_sk() with a TCP sock, e.g. with a subflow sk. So a new simple check is done when CONFIG_DEBUG_NET is enabled to tell kernel devs when a non-MPTCP socket is being used as an MPTCP one. 'mptcp_sk()' macro is then defined differently: with an extra WARN to complain when an unexpected socket is being used. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 026ed360bd72..051b100d9403 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -356,9 +356,15 @@ static inline void msk_owned_by_me(const struct mptcp_sock *msk) WARN_ON(_ptr->sk_protocol != IPPROTO_TCP); \ container_of_const(_ptr, struct tcp_sock, inet_conn.icsk_inet.sk); \ }) -#endif +#define mptcp_sk(ptr) ({ \ + typeof(ptr) _ptr = (ptr); \ + WARN_ON(_ptr->sk_protocol != IPPROTO_MPTCP); \ + container_of_const(_ptr, struct mptcp_sock, sk.icsk_inet.sk); \ +}) +#else /* !CONFIG_DEBUG_NET */ #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk) +#endif /* the msk socket don't use the backlog, also account for the bulk * free memory From patchwork Fri Feb 23 20:17:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775634 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FA90146E94; Fri, 23 Feb 2024 20:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719556; cv=none; b=QTreNTtyuw5IuZ7jQ+gr3cKfG26tMNpwZ681y1eSQcSMW4kX+aH04sZ1zgP1y1yciLLFAR72zZh+Kv2gw2ao9763Vi4jywIrbLddVY/R2DvbAIAiM4gEWgWxAWGIQinXTMoOpZhLp/HzTTCfgbRopjDwyI1XophvCJNEFSiFph0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719556; c=relaxed/simple; bh=Tita/JUXCCZaQUK9VD3z/BlM+pOB6MLFoH+QoKGPM7s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5uvaHa1O0M4BhzE0gaLdAoqQ6KzZnVPTjZl+2vNKOb4ycjitlMzSlWOAUVITZeK5Wkwwh28sWK1VWS/cFTA4a3BhmUd9dlc0fBnEKDaxPleGptzmLamDR+KklcI7+y8IOr51+yuFHGcWJZM7kyzuY1HaWVa5BXKWp3sd4RMBQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JkQyW0h7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JkQyW0h7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAB41C43390; Fri, 23 Feb 2024 20:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719555; bh=Tita/JUXCCZaQUK9VD3z/BlM+pOB6MLFoH+QoKGPM7s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JkQyW0h7mHwhLAa68bzlb5r8Q4FPbWtrQmrtPU8XU7QI4aUwtLZEIQPzF/1wHYLsk JhngJChXFjsTC80pcJAZI7orX+3kbRB8hQZpqcsik0yiEVsCs4EoL6FcQBJ/SfW6q2 3UAosM1k0sSK8mpv/ue3uZwpECIsPSO19qZSCR4nUMwmJb16UZPxdsC0FUSj4YjdAI jue8389cIF3hmfGw1bsRcjay2NaTulYigHIZwojwh9KQAzQ93mKr2Ek2xypVpIIE6o hP4s4o4qIf/8kko4nPO7fplwPkJ3FiLoovJnZLyk0e1JnfBZNiTrirgeyGDawVgUz7 qVCwCOdkiJLYw== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:57 +0100 Subject: [PATCH net-next 5/8] selftests: mptcp: netlink: drop duplicate var ret Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-5-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=896; i=matttbe@kernel.org; h=from:subject:message-id; bh=2TF2DefMK5rCsE9EkAWVPU+W7O7ZdLPJZXqcYpu15OY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qljgRR881Jpgh4LE5QvrJMcRz3Dy6ITZZh CXk07trp1WJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c8S4D/4u+3kcCDRpA1MAJ3d+XaWUnFCkr/9Xoj4tJE3A5LM2vh9S9rdjTElxhRXAyC4OMaNHaMy c21IjmDJu5OJqIVLsl0ThDEINOOb5o9FA/rndh+DsQhJ6Qb7wxGo3nFk5AqkYHkjEAgVG3/28kb 2DI3Vz5m+BKX+Edz0yu91tAa3gWW9SVX3yRCQAZ+yfIKJq89elCB1UIdAzj5A3f0zxo57//4V5c tRyTlEDxQt8xMkwXvjZCrS3N/2AYz7IFwJJUskzTxrFCHaJUALs9UlExnNFZfpE7+NlTfYtcXHq KePO84bfteqDmYU7JJFNJZjKhZEGrdjlfzgaG/MTu9NxSPNuE5PHf/5JMgc4cJ33zjm/FXazAaT TA3KP8tbyVxYbmVkVqtq8097zgzZnmBnWjpfn/6WbblzKYU5MY67a++ATRq/cdAEGLuHxbavLFj gGJLm7arlSPdYtWoElTEj9wbBn9u/uPdvZaK8ZeTqB4xoj+9XiYgeYX4npxRD9mvulvbZgngz2s 6YyLPCKOACER9QCAfpoPU4p7TgBlZDepu01NPnwBJD5COwZzYDqaQS6VqZmySy6X3w3KjTBQ1xS uUyp8zIXokQKM/5T5MAG5SnJWbC09gaWTQQMYjBMZTtDvgpBFYdEZNIXe0bYw8guZiiFTceD9xR SQG135ia4xMRGyQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang The variable 'ret' are defined twice in pm_netlink.sh. This patch drops this duplicate one that has been defined from the beginning, with commit eedbc685321b ("selftests: add PM netlink functional tests") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 71899a3ffa7a..ebfefae71e13 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -28,7 +28,6 @@ sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" err=$(mktemp) -ret=0 cleanup() { From patchwork Fri Feb 23 20:17:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775379 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F2411482E7; Fri, 23 Feb 2024 20:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719562; cv=none; b=Kpd9dthbLnVbr+s7FL3GPAnvVAP8U9Jfkc18DlXQ5M+o1CGAWV0JfwpbHECCQyTyA4qEHpSY9D3krdTX2Li0XuV9IbaRLiW4npJfALmvsUSaqxdY76Osy2fCFp/7wbwuUnkahYWXJIF9sjzWnm3jBy7RzZZOAkSEH7k3ssjCDtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719562; c=relaxed/simple; bh=ex5Mx41Huuyac9Z1t6Hplat3p104iUTSd3x7QbmwmXw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kFbQ2F00yUKJBvzbgZnL0CCJcZ+oD13CWTXUMUJDJhLrMrvkQID6KsFR40NVNnb6XV4WtWuKIDVi/SzmvxH3coq9LLmRYzGYNPUCSln0YsP9vidBJ2uv3mSBTw3oMrC5pDRzRUzWsa94Wq4GstAq65xHtiTvpS+hNpnNcxMIMyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+8CQiAr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+8CQiAr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DFDC433A6; Fri, 23 Feb 2024 20:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719559; bh=ex5Mx41Huuyac9Z1t6Hplat3p104iUTSd3x7QbmwmXw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g+8CQiArye+DO1altSNKA2pHE6/CVJ8dBcJ8uERLs1l1aQMa9TQnrC9oBxTdeGTxn kZfF+JWFwJuCF6SY39MMojutzhl9+wMO6kOQLwnhzSf9So1F2626akwca1SDdVepsY Lc6+6bfAH4uA2hVTveowTdADnqf9qmKlKVK5Z0SzhH53069c8uPILYGjTC2reJWu4w Okd74OQwxz1L6zCzfhNNPHhAn6D7IULbVlw3NGu9SFDib6TbQW3GtlQqyU6OlLZknU SrS9i6fhtliFBW4KOGpYr+8AJHOifJbBrxA4ZB4Ym8EZmEHCvpku2tNHRTTm6QgOqB s57YCIQEqgZ4g== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:58 +0100 Subject: [PATCH net-next 6/8] selftests: mptcp: simult flows: define missing vars Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-6-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=989; i=matttbe@kernel.org; h=from:subject:message-id; bh=2oYftnUEdCOqYjlwEKhBo9GZ+yt54Ro8QzaHPbeEHDw=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qhModMrd0L3Jfk2V/fsVAoLJ/rWnDu47Ga z1TigPE3v6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg czExD/9nDo2PBkCGwWlY2ZMJ+4FQUqW27Yzuav0MeJiUw8BtHFmrcpP/mrvl8FJKbWGf4G34SO/ 577+eLbnMhpGGFHLTdjVlRqIhHA3uxMCxqMCA8IksyexEI4VuFYyzIyQbkAqBJr6rbc5Bmi3ox0 lbFpgWzikW4A2cFVPfn051YtpNl/MI13hnnGIXWcoyNw5VnvQDOYDBAp6BYBXNBzpYNnspuJWAT VBp+7ebPfcKnnVacVKiKFHLOcgLox8tM4g7IDZUewIwz2ngyYAYJ9dzm/staAAam5QQVjSfyhjM 6rLVDqewwQEVwweOfhpzQENcGIaEP48cLqfIhXoECNi1Yd8+lRIOGkmRph/haXm2mm0FXpcQFh9 +Ge3pDEW6UIFuVOYe2dBFFqTp8dV1vDvcR7CwI8bUkO0rgaeViIhexmwc4rkFbajwExZrV4zi0o WDOOko0jChKgFbSdGWNiTuQ18MWBaoQiKnzQvgtUUo5PQWeQjx20XnmE9nDl9DEbn5Ri3KmT881 2+Fmdq9kM5QmGaN504qA3L0HbbKoeRyZs6ekOh3OhhhHGInZY4155WS1UapNu4OlsZ5vu+oeTu+ 0XuVgFoNDaPhD0UWTKQSMC9xluGPo/na4KPjMvHkezs4uSfPRfQCrYrJRTkwf2dlOGr735gZPfD nz+mFUU26vA7M4w== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang The variables 'large', 'small', 'sout', 'cout', 'capout' and 'size' are used in multiple functions, so they should be clearly defined as global variables at the top of the file. This patch redefines them at the beginning of simult_flows.sh. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/simult_flows.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 8f9ddb3ad4fe..ed0165c15a24 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -16,6 +16,12 @@ test_cnt=1 ret=0 bail=0 slack=50 +large="" +small="" +sout="" +cout="" +capout="" +size=0 usage() { echo "Usage: $0 [ -b ] [ -c ] [ -d ]" From patchwork Fri Feb 23 20:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775633 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE18146E67; Fri, 23 Feb 2024 20:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719564; cv=none; b=CrqbmlSdPbrBq7HGHmKLqLInO78gPPOvtgFGyuXhTGuBgrlnHT1/GLUR9DXgkMUskOohLKZnUFOIa9j1uH40oTBKOWIzwjOW79OTbRv8Bo5HjEkp3t519NevdvOFv0KmsBqech4AZvVsGcq34PUVcKyrZeKIaVQYUxU46L97qik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719564; c=relaxed/simple; bh=ukSJGjxu+ue1SOHBDHfmlxv7527kiTH7F4ql4XDr00c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=auzYV+HKVcINDGAKZX4jUu0mOl1m60pK+irSBjX1lnTEWGFfOgUsIaPE03L3d9D21J6oNsBhLinGDp+idc4gsNXYhb6sH4pMmTeq6m3NSS2zAI0zMkE5G6FBVBYJlkMTMF2mbV8r9LesCpIOW+19krKpmh9JPkan9xjtDWJa/3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rN2ojuFv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rN2ojuFv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8286C43399; Fri, 23 Feb 2024 20:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719563; bh=ukSJGjxu+ue1SOHBDHfmlxv7527kiTH7F4ql4XDr00c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rN2ojuFv0oyQzoZrLloiVhjjVW7mrKYyGs20DBvUKJpmHEi3lRvah7wxoLCyPrX2X jP78+SB1aQ9GuY0U5ltgL9GEfb13F6mBu2Aibwb6DOoZnYcQwepfDOcGW+FaK9OkSM knP43mIIDYsHeJdh/Ax53hQaRkbipXNAMqUhMqocr4YlF5bxN1PXmuPYVl72Cequuh PzOhYdEghtt265IhbT50lUGW8K661aS9NUYAEd1pqLHgQ/PO4Rc1Y8SUTxpCVXJgRg mOxc+V/86snBfZvzhuH3uEX16KZjzWU5zB6rKHIcRbiG6XLYLTnMiCXuoCcTRwrmlz tHPLHPtKSteMw== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:17:59 +0100 Subject: [PATCH net-next 7/8] selftests: mptcp: join: change capture/checksum as bool Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2685; i=matttbe@kernel.org; h=from:subject:message-id; bh=QAwNFzDN+MJTxQHIwpBmAUpR/yt5FrvMyfSOP6mUHgI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2qKA6ebgNQ99j+L4S74IFVKs1uktyoR1Cj6 XeSLiF4xD+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c7wvEACeZtD25TbQuGVn8mbHzk+UtSKtpAeKEACWF60jZNCOipC/EBQ0W4njcHMiaBg7XMx8RmQ LqxtGTnUJsEVBZWTi0BrCT3xgcnhpvG49eSpJtjcpWWVlebZLuRCDU+GZwq+4HN1j39WWe/4p/d tsoHbwQ0bcFQHdgPVjUEZQ2w8ZnPAQkJXbEL54f+RAe0CmNbNAh1KwK9PT7v47SuhJYBoXpvib/ 3F6r2vh/EWYU3g7BZk+jgLrLhpt9Z54JZ34f/HRlL0WCH51+7+70dAgWwsKb3x09tG0WVX7Y/fa eXCWtmha7mpdKLWDBW0pRTUqLWqX1QzgEdTHJ71sD+FPfK7kXPHl4EhPE/Ded2wXKdgoqBLrFst WH2vmO+AjTf0WOBs7DPnAS6eFufGekpWuzGeffdTFoYtd10afM3dCPN57aDyPk7/O3TXwFRZ3WL I1iqcCu53jSW1z7WHxmPhg/ROY0MhuAnsveTRFEHV7Tt6uAevFum8pKF1nbR4bz1kvilSlIFGfv bwLC8IsWqgzyCUkGkawPGvKcgaODbNc3D1/mLnxvRMFB9VKPrCGmz6tN5oHs14hMRQnlfR26Ljb 97qzKAxFKDmPcgMwli18qUr8zKgnPYGzufWIQWRvC8kfnacsHKZZVUwU3S3yGVtC1gIdprs1xiT 0boa+s0q0rx34XA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang To maintain consistency with other scripts, this patch changes vars 'capture' and 'checksum' as bool vars in mptcp_join. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index c07386e21e0a..3f198743cb03 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -29,11 +29,11 @@ iptables="iptables" ip6tables="ip6tables" timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) -capture=0 -checksum=0 +capture=false +checksum=false ip_mptcp=0 check_invert=0 -validate_checksum=0 +validate_checksum=false init=0 evts_ns1="" evts_ns2="" @@ -100,7 +100,7 @@ init_partial() ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 - if [ $checksum -eq 1 ]; then + if $checksum; then ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1 fi done @@ -380,7 +380,7 @@ reset_with_checksum() ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable - validate_checksum=1 + validate_checksum=true } reset_with_allow_join_id0() @@ -413,7 +413,7 @@ reset_with_allow_join_id0() setup_fail_rules() { check_invert=1 - validate_checksum=1 + validate_checksum=true local i="$1" local ip="${2:-4}" local tables @@ -1017,7 +1017,7 @@ do_transfer() :> "$sout" :> "$capout" - if [ $capture -eq 1 ]; then + if $capture; then local capuser if [ -z $SUDO_USER ] ; then capuser="" @@ -1119,7 +1119,7 @@ do_transfer() wait $spid local rets=$? - if [ $capture -eq 1 ]; then + if $capture; then sleep 1 kill $cappid fi @@ -1507,7 +1507,7 @@ chk_join_nr() else print_ok fi - if [ $validate_checksum -eq 1 ]; then + if $validate_checksum; then chk_csum_nr $csum_ns1 $csum_ns2 chk_fail_nr $fail_nr $fail_nr chk_rst_nr $rst_nr $rst_nr @@ -3664,10 +3664,10 @@ while getopts "${all_tests_args}cCih" opt; do tests+=("${all_tests[${opt}]}") ;; c) - capture=1 + capture=true ;; C) - checksum=1 + checksum=true ;; i) ip_mptcp=1 From patchwork Fri Feb 23 20:18:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 775378 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 813A7149392; Fri, 23 Feb 2024 20:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719571; cv=none; b=W7Uo8X3V6dbRo7O29QOh9Osfm4yrcGP7XixctPHZiZkVe3/+dZdNPhk/krA6iBxYXImxx0oksNLXyGTe7imF4EtjFmqcxGeiyR4A9aVkLDHeN6ydMm7fIU14pF3IwExjCOaFdD1LIQd2kQjd1a07WUueeOX45CgIzLUTUoIEFdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719571; c=relaxed/simple; bh=FwvYtTGfOF4NuvGGUI168jKEh9/uz8oP6Cgx5tzsEu4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jq7K6ZXRavbPEzFlobcZJiGwAN2h4XUft3K8c5lMdh1mti0tg3hi6KAFtGyHoWUnOxDev6f8aUbhVhtazNXce5D5E9bXK+HeSlKPChPdeVu1PHE+14HXb6pF6D5K0gs5nGNDHtRXsSqpekJJQEBM8aFI8uhBg0ixMxiRF5GYvcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oxHxISt9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oxHxISt9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF8B1C43390; Fri, 23 Feb 2024 20:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708719567; bh=FwvYtTGfOF4NuvGGUI168jKEh9/uz8oP6Cgx5tzsEu4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oxHxISt9+nPVcr3U99R+uDYJC90r0TKLIjZsBOWmFM0aJABvqFYO8xMYZ11VYVoA3 5jVP2wgbjFB2xnJU5E63UQAu9AGoEq23JEplKoEtM4i7onlmL+1sSHp8rA7hOvisWd 9HwissidoxIUwP+qQBGspUPHVQ2VZQTWJO9N+3gTZSvjBxYf5ID+2Sh4mlwgHXD1bX 2kMfRSN9jwIO0/stP12obSwx+6EQWDoH1wx4Xv3wRAymY+xDHy1TkA6vLjl+8tF0+t IeBXy7OFhyPxtU/bRG3VA/cgyTRZ6tLKLJJI52iOoqCHYIT3EwenwJ8sUtlJk3Bg8O wXcC15VjPiNmg== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 21:18:00 +0100 Subject: [PATCH net-next 8/8] selftests: mptcp: diag: change timeout_poll to 30 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-next-20240223-misc-improvements-v1-8-b6c8a10396bd@kernel.org> References: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> In-Reply-To: <20240223-upstream-net-next-20240223-misc-improvements-v1-0-b6c8a10396bd@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1053; i=matttbe@kernel.org; h=from:subject:message-id; bh=ldlT+YlgwNS1TOVTH5ihpsJJVG5JuNAuK5gNgkDMv/4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2P2q/16gTXBNVCrsIQuAheU23oKyVW2BEFE2+ m4sUhGHGvGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdj9qgAKCRD2t4JPQmmg c1yFD/9zMyKUhNJCjKZH5FziaSaNxSGl/y01VMLaWVTFKs1VoY3Olwfqj9b0oBKWdJRm3C/3V1n b1ACvfpLqPw0PyWZcTotGpZqDaM4idaAfH332C3AQ+dso+SpsR1HiJciG0LWcu31R1dbFrYkgZn VluB3ntCvST6AUjTYmaOIr3E4Xg4iEhN8cP+DYg68YdP8qWpE945Ou7MBxJBUO/lSU5jNcMkM1Z aUtQyCyokMmFLOI3FsDHmsufHEf8w2XI7uQMkI1YJG8avQQU378J9+DgqCmxFJawTv7IZfXd4/+ ztH7PunSnYn+IMHXcjGGYkk8SaA1U0dyvWK1SJl97YpGlw5mZJgpGcoEBB6cZwC8eD0OwktL9EH h5dJ14uCg09MUb7nDx7VgZeKNINJAm1wDNq4+Z+MRF45mmepljAIskoWkCloLAdjEhd9sYMaWa+ QSYcBcfO0Bt39I1o+X8jqLdw0t1gE/iu70zz9Gdkc4aH7In7GA9gRskrNL1REAcmNwXbj0cEBjY nXx48R9Df/HIOgHet9CoTLCnb0cnfI5B/2wWCHSbO2+FZVjTJaq/Lql4lv1riEl9ZIFCE79ClEg 2Q2jUojOVNKqwL1gTu90F/mabT5MCs4nTUzrqedW1XcLQu+PFPjxp5/QzEcBAlDacfLD+pLfIGG XEQ5a5bGzWooQZw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang Even if it is set to 100ms from the beginning with commit df62f2ec3df6 ("selftests/mptcp: add diag interface tests"), there is no reason not to have it to 30ms like all the other tests. "diag.sh" is not supposed to be slower than the other ones. To maintain consistency with other scripts, this patch changes it to 30. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/diag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 0a58ebb8b04c..8573326d326a 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -8,7 +8,7 @@ rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns="ns1-$rndh" ksft_skip=4 test_cnt=1 -timeout_poll=100 +timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) ret=0