From nobody Tue May 14 19:21:54 2024 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 9CD72130E32 for ; Thu, 22 Feb 2024 16:28: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=1708619292; cv=none; b=dTQqsgzRuALNPAX4jJm2NnVJOKlvlWQKuf8du+7npZ7QBugds2Zxq1p25o/q5stBSUTAXrJA5TndY+hSZX0lPZTjId0+WunYqFnbkQJoNXR9Mq3aDaqGk3TgCuvXPHnB39b9lD4Fpac99daHzHEDLrA/+EHHqP+16sjf2cKjMps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619292; c=relaxed/simple; bh=6ppa6gVZX7Mf0YViq2iuuXIyOA1XpMhNbWorGleUM38=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WDJkqjgvme51oKVARSyrMIkPoh2c+TmAjz0ym6StR96B5whSQPJ1n6Z8gPWg5a5NcLHjSS9yUCBSbHAqYgBnio4CmPox/qK13kycNAsS3KBwBi4fUxRJ8wGU5G/x/0n8lqyYejWgX0sZ5YBwVVRd7zM+PgfvinKulIveTW09204= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X7GfuB0H; 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="X7GfuB0H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0E63C43390; Thu, 22 Feb 2024 16:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619292; bh=6ppa6gVZX7Mf0YViq2iuuXIyOA1XpMhNbWorGleUM38=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X7GfuB0HBOGRdVfkmSzQM8yMr769OJZzqALC3YSfWInl6zKMiai2vfYGpBVKQsHa8 8v8oCSaFc8jO4j2OJJTW9IR0egFUXJ0g0gkpksaLrxhlQ2zLI4MJqN+VfcZDb2XCCY DB4NVzv9fjvQAqnBAK0II6Vvd+M1nXFOkuCCGYt7u6yD8NnW+kMRpfiRMkEaQUVafZ LQiCzlOyt4KfKbPugeD7Z7dYNDZ7Y1wy5q84NyMDX48b2YBiqvYrQOtAEOxYE6ZHQT jKLfPOI9ATXtcEfsDkyElvK1t9eVpqcDn9WLstNUiVDRd/4bnXSB1GibkI0fx/d/97 ao3aUN7nwuZjQ== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:27:57 +0100 Subject: [PATCH mptcp-next 1/6] selftests: mptcp: diag: fix shellcheck warnings Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-1-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2632; i=matttbe@kernel.org; h=from:subject:message-id; bh=6ppa6gVZX7Mf0YViq2iuuXIyOA1XpMhNbWorGleUM38=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13Yaitd6PE7F/3RpDPMJXuO3c3KUp5QiqvkcC NvWkg+zAMuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg c6jVEACh6WStwVKtPvnSE1evZ8iLRwP2ZD4zFh1u04dMID4qUgMVkuFhqymiiNvNdReFuLGYzwi cw6ahEzT2BZVNog4ckR0g5FNcHOJD3+Gi/nLY4cekOK7Qhf2ukk8lRouMxgA7ARt+aFg3iJpVvg 4dGIgoGP4Fl3dhjYhXcaub2Sy5bleTvjf5AAxky4eTYOfws9wnW22zzQFk+dODRMgY0HwOhJ/kB /2mklvCg8ylz9gQCCTza6BO3DffThm6G9x8I8Go9cTfd8WNvphoeY9wd+aMtHaLG0cpW5JZ0cwq 9uVEFB6aVsZ6cOw1MD+UefZQ/DTJAAUcBFHHyzwM7eJIvpGtINeSwGheR077rRwkL4g0wr8oKkK ry7BMEXauYocXdqnzc0oAxsBSMjqmXGszOsTcgSXMkJ15sA1oh8k9Gp+NVBxO1bkxqYhI82SGja ap7etNavhCc68MtinqvHdi5PT3LigjtDXso5QNqW5413XL3UU/bTKwi5mDx4yuXnD68S5MdSXPp fzItHrttw4IeiLbKOyTygetwNs8anc85JzxYf8A9wXjZNfy07MaQo+/h9+IBSZV5s0qDlesfenM Le/8BdkaQAL43euFabx3FfLEqTOIaZO0c1bVs/Qhjhhr8OeUPK6Nv3rqfznBsOJkT+4mDcereXC UPYSkXaFz3ZphWg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2046: Quote '$(get_msk_inuse)' to prevent word splitting. - SC2006: Use $(...) notation instead of legacy backticks `...`. Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/diag.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/self= tests/net/mptcp/diag.sh index 0ee93915bccb..d8f080f934ac 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -1,10 +1,14 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +# Double quotes to prevent globbing and word splitting is recommended in n= ew +# code but we accept it, especially because there were too many before hav= ing +# address all other issues detected by shellcheck. +#shellcheck disable=3DSC2086 + . "$(dirname "${0}")/mptcp_lib.sh" =20 ns=3D"" -ksft_skip=3D4 test_cnt=3D1 timeout_poll=3D30 timeout_test=3D$((timeout_poll * 2 + 1)) @@ -24,6 +28,8 @@ flush_pids() done } =20 +# This function is used in the cleanup trap +#shellcheck disable=3DSC2317 cleanup() { ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null @@ -174,7 +180,7 @@ chk_msk_inuse() expected=3D$((expected + listen_nr)) =20 for _ in $(seq 10); do - if [ $(get_msk_inuse) -eq $expected ];then + if [ "$(get_msk_inuse)" -eq $expected ]; then break fi sleep 0.1 @@ -260,7 +266,7 @@ chk_msk_inuse 0 "1->0" chk_msk_cestab 0 "1->0" =20 NR_CLIENTS=3D100 -for I in `seq 1 $NR_CLIENTS`; do +for I in $(seq 1 $NR_CLIENTS); do echo "a" | \ timeout ${timeout_test} \ ip netns exec $ns \ @@ -269,7 +275,7 @@ for I in `seq 1 $NR_CLIENTS`; do done mptcp_lib_wait_local_port_listen $ns $((NR_CLIENTS + 10001)) =20 -for I in `seq 1 $NR_CLIENTS`; do +for I in $(seq 1 $NR_CLIENTS); do echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ --=20 2.43.0 From nobody Tue May 14 19:21:54 2024 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 E754B130E32 for ; Thu, 22 Feb 2024 16:28:13 +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=1708619294; cv=none; b=F9LZA9bYVb2ixxG7oXjT1pi8lgU+Zztr+yT2HPJ0HNbeSr7XlWCff1qqdEDfBB6+acEEeGRuTQvnzupYuOFPgvHHlpfg+QRRIysHewoq3J8ZhzPpMcYU25GxZGd5mOutEGcuDz1xegkPuiDK6OeVZB+FQ4jL23L7kCV9F50nWq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619294; c=relaxed/simple; bh=IKrIfUU+eO3CSKxbtFfZsGvYatox8OS2nqe7cmd/4Sg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nqfPbxR/+knfkDIydxolIwQ81R3dd/jbe41ShPKI2T4w5TN/Rd131oJsj68QHgxrGuaklcwTftrwXLS4wnUfmJMMhg1x4s/eFz51Y6cP5Oy/N4PPLdXbOzutHw0BGZWvlWVSKhi71tYsJLNKnRcj2BtbkKwmjgsL63y+RhzD8qs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gmIiSnKe; 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="gmIiSnKe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE005C433C7; Thu, 22 Feb 2024 16:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619293; bh=IKrIfUU+eO3CSKxbtFfZsGvYatox8OS2nqe7cmd/4Sg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gmIiSnKeeDOvCArb2k/geul6do61bRTowReKvWB8cNuOJ76U6IZ8AFWVf63E+MRxq tgBFTye6wzF17x/wZlxB9g+ItxSlNzBPViNNg+S80LglxEfiBLI87fKIYjDOXsy8cH 2RZgQEp4sMmxMy+uL/6jOIaKV0CvLfg15PiP174gyWlI1W2Scpbnv260jInX7BMEpx eWW3UOJErCISWeArWOLbqgi46gq1okhSbn7dFwqsWiTruYT5xyCkEagfVmeFIXfzDE eZMceNFYLRnMBnnd9XIjNhnkqCr5eO0dnG4czTK7sXwwgECgM5unZe8OQUWqSWEhu6 7Xv95ACu3VScQ== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:27:58 +0100 Subject: [PATCH mptcp-next 2/6] selftests: mptcp: connect: fix shellcheck warnings Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-2-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8839; i=matttbe@kernel.org; h=from:subject:message-id; bh=IKrIfUU+eO3CSKxbtFfZsGvYatox8OS2nqe7cmd/4Sg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13YaA4Yw7V8y4gyyb4POPldV5ZOQIEg6+6BoN GrNt0kmpTKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg c5YGEAClMivQIVaX1YSkBfalCtmH2A8PNruxa8dF8PG3nVGegFi+niqf6NRDktItWqAV3zeC/+d 03Yfr+fc2GQ3i2CBtzuFCeRweGxcAYE9Vkhi58NauPIQO0+JnOA+YIcNn+4M9JwLYxvdMc8BByr o83R6gF7dIsjwuSMbdpcRckkgbhIGWW1LZOxm5c5Px01plhpJR4njJJr9+nJAkRIXqsYyLyu7jU q7pwgoZnD9EAMx96RpcBZUhnNmTF1OarRruqwRQh84P2jT7QSN3wNKk3qQsOmMohUuodzxzBiLI u7HrWqDfTgRUbKnqLzRVgLwlBAk6WrFjzTfsm/o8dh3WfCxzDzgbCdIpzoDUXpnsDKNG1n5Cmfq XM9ooX9JlJbrWzGw4Ch8w6ZXXMkwM8x4PjWJLDlfxKiehhjcf6Q1coPtElVkUlcdjz5WI5P4BoH Zth9eZDan7E0DhEcB9Mhgex+WeW2x3H6R4N4+RtlC2vo0ZEWpXsbHQRODXZG9iH/uR9Hs9ymZYe jvbRi34b3s5xjFJvGnFVGneFTKfAuvnaVa70Kqvi81n+x/6O5zC4vEG6Ct7a/gFCKqtUMCcDRsx slxZ8o1WasjofwZJhkpps1RtSFSu/B8omhT5/BFSGlQG0vKF0EHfTXllx0vU3NuRckWeRQ0fsBf Azf3io/4nwnqVaA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. - SC2004: $/${} is unnecessary on arithmetic variables. - SC2155: Declare and assign separately to avoid masking return values. - SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. - SC2059: Don't use variables in the printf format string. Use printf '..%s..' "$foo". Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 76 +++++++++++++-----= ---- 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/tes= ting/selftests/net/mptcp/mptcp_connect.sh index b53ae64ec08c..0ca2960c9099 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -1,6 +1,11 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +# Double quotes to prevent globbing and word splitting is recommended in n= ew +# code but we accept it, especially because there were too many before hav= ing +# address all other issues detected by shellcheck. +#shellcheck disable=3DSC2086 + . "$(dirname "${0}")/mptcp_lib.sh" =20 time_start=3D$(date +%s) @@ -13,7 +18,6 @@ sout=3D"" cin_disconnect=3D"" cin=3D"" cout=3D"" -ksft_skip=3D4 capture=3Dfalse timeout_poll=3D30 timeout_test=3D$((timeout_poll * 2 + 1)) @@ -129,6 +133,8 @@ ns4=3D"" TEST_COUNT=3D0 TEST_GROUP=3D"" =20 +# This function is used in the cleanup trap +#shellcheck disable=3DSC2317 cleanup() { rm -f "$cin_disconnect" "$cout_disconnect" @@ -211,8 +217,9 @@ set_ethtool_flags() { local dev=3D"$2" local flags=3D"$3" =20 - ip netns exec $ns ethtool -K $dev $flags 2>/dev/null - [ $? -eq 0 ] && echo "INFO: set $ns dev $dev: ethtool -K $flags" + if ip netns exec $ns ethtool -K $dev $flags 2>/dev/null; then + echo "INFO: set $ns dev $dev: ethtool -K $flags" + fi } =20 set_random_ethtool_flags() { @@ -307,7 +314,7 @@ do_transfer() local extra_args=3D"$7" =20 local port - port=3D$((10000+$TEST_COUNT)) + port=3D$((10000+TEST_COUNT)) TEST_COUNT=3D$((TEST_COUNT+1)) =20 if [ "$rcvbuf" -gt 0 ]; then @@ -365,12 +372,18 @@ do_transfer() nstat -n fi =20 - local stat_synrx_last_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcp= ExtMPCapableSYNRX") - local stat_ackrx_last_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcp= ExtMPCapableACKRX") - local stat_cookietx_last=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpE= xtSyncookiesSent") - local stat_cookierx_last=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpE= xtSyncookiesRecv") - local stat_csum_err_s=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpEx= tDataCsumErr") - local stat_csum_err_c=3D$(mptcp_lib_get_counter "${connector_ns}" "MPTcpE= xtDataCsumErr") + local stat_synrx_last_l + local stat_ackrx_last_l + local stat_cookietx_last + local stat_cookierx_last + local stat_csum_err_s + local stat_csum_err_c + stat_synrx_last_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPC= apableSYNRX") + stat_ackrx_last_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPC= apableACKRX") + stat_cookietx_last=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSync= ookiesSent") + stat_cookierx_last=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSync= ookiesRecv") + stat_csum_err_s=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDataC= sumErr") + stat_csum_err_c=3D$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtData= CsumErr") =20 timeout ${timeout_test} \ ip netns exec ${listener_ns} \ @@ -433,11 +446,16 @@ do_transfer() mptcp_lib_check_transfer $cin $sout "file received by server" rets=3D$? =20 - local stat_synrx_now_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpE= xtMPCapableSYNRX") - local stat_ackrx_now_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpE= xtMPCapableACKRX") - local stat_cookietx_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpEx= tSyncookiesSent") - local stat_cookierx_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpEx= tSyncookiesRecv") - local stat_ooo_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtTCPO= FOQueue") + local stat_synrx_now_l + local stat_ackrx_now_l + local stat_cookietx_now + local stat_cookierx_now + local stat_ooo_now + stat_synrx_now_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCa= pableSYNRX") + stat_ackrx_now_l=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCa= pableACKRX") + stat_cookietx_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSynco= okiesSent") + stat_cookierx_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSynco= okiesRecv") + stat_ooo_now=3D$(mptcp_lib_get_counter "${listener_ns}" "TcpExtTCPOFOQueu= e") =20 expect_synrx=3D$((stat_synrx_last_l)) expect_ackrx=3D$((stat_ackrx_last_l)) @@ -446,8 +464,8 @@ do_transfer() cookies=3D${cookies##*=3D} =20 if [ ${cl_proto} =3D "MPTCP" ] && [ ${srv_proto} =3D "MPTCP" ]; then - expect_synrx=3D$((stat_synrx_last_l+$connect_per_transfer)) - expect_ackrx=3D$((stat_ackrx_last_l+$connect_per_transfer)) + expect_synrx=3D$((stat_synrx_last_l+connect_per_transfer)) + expect_ackrx=3D$((stat_ackrx_last_l+connect_per_transfer)) fi =20 if [ ${stat_synrx_now_l} -lt ${expect_synrx} ]; then @@ -455,7 +473,7 @@ do_transfer() "${stat_synrx_now_l}" "${expect_synrx}" 1>&2 retc=3D1 fi - if [ ${stat_ackrx_now_l} -lt ${expect_ackrx} -a ${stat_ooo_now} -eq 0 ]; = then + if [ ${stat_ackrx_now_l} -lt ${expect_ackrx} ] && [ ${stat_ooo_now} -eq 0= ]; then if [ ${stat_ooo_now} -eq 0 ]; then printf "[ FAIL ] lower MPC ACK rx (%d) than expected (%d)\n" \ "${stat_ackrx_now_l}" "${expect_ackrx}" 1>&2 @@ -466,18 +484,20 @@ do_transfer() fi =20 if $checksum; then - local csum_err_s=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDat= aCsumErr") - local csum_err_c=3D$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtDa= taCsumErr") + local csum_err_s + local csum_err_c + csum_err_s=3D$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDataCsumE= rr") + csum_err_c=3D$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtDataCsum= Err") =20 local csum_err_s_nr=3D$((csum_err_s - stat_csum_err_s)) if [ $csum_err_s_nr -gt 0 ]; then - printf "[ FAIL ]\nserver got $csum_err_s_nr data checksum error[s]" + printf "[ FAIL ]\nserver got %d data checksum error[s]" ${csum_err_s_nr} rets=3D1 fi =20 local csum_err_c_nr=3D$((csum_err_c - stat_csum_err_c)) if [ $csum_err_c_nr -gt 0 ]; then - printf "[ FAIL ]\nclient got $csum_err_c_nr data checksum error[s]" + printf "[ FAIL ]\nclient got %d data checksum error[s]" ${csum_err_c_nr} retc=3D1 fi fi @@ -645,7 +665,7 @@ run_test_transparent() return fi =20 -ip netns exec "$listener_ns" nft -f /dev/stdin <<"EOF" + if ! ip netns exec "$listener_ns" nft -f /dev/stdin <<"EOF" flush ruleset table inet mangle { chain divert { @@ -656,7 +676,7 @@ table inet mangle { } } EOF - if [ $? -ne 0 ]; then + then echo "SKIP: $msg, could not load nft ruleset" mptcp_lib_fail_if_expected_feature "nft rules" mptcp_lib_result_skip "${TEST_GROUP}" @@ -671,8 +691,7 @@ EOF local_addr=3D"0.0.0.0" fi =20 - ip -net "$listener_ns" $r6flag rule add fwmark 1 lookup 100 - if [ $? -ne 0 ]; then + if ! ip -net "$listener_ns" $r6flag rule add fwmark 1 lookup 100; then ip netns exec "$listener_ns" nft flush ruleset echo "SKIP: $msg, ip $r6flag rule failed" mptcp_lib_fail_if_expected_feature "ip rule" @@ -680,8 +699,7 @@ EOF return fi =20 - ip -net "$listener_ns" route add local $local_addr/0 dev lo table 100 - if [ $? -ne 0 ]; then + if ! ip -net "$listener_ns" route add local $local_addr/0 dev lo table 10= 0; then ip netns exec "$listener_ns" nft flush ruleset ip -net "$listener_ns" $r6flag rule del fwmark 1 lookup 100 echo "SKIP: $msg, ip route add local $local_addr failed" @@ -844,7 +862,7 @@ stop_if_error "Could not even run ping tests" echo -n "INFO: Using loss of $tc_loss " test "$tc_delay" -gt 0 && echo -n "delay $tc_delay ms " =20 -reorder_delay=3D$(($tc_delay / 4)) +reorder_delay=3D$((tc_delay / 4)) =20 if [ -z "${tc_reorder}" ]; then reorder1=3D$((RANDOM%10)) --=20 2.43.0 From nobody Tue May 14 19:21:54 2024 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 EC9361509B5 for ; Thu, 22 Feb 2024 16:28:14 +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=1708619295; cv=none; b=ZWTTL4Cwf/MMIT8D9ArXX1U1qMX8K+V01X3AxuTlh16QLELz0TdXLsbE9qOQlI7afImYC4OTSj4Z0kQ4fD0xMirLijDbQV+P+EEKbHSB8Kk4SsxWqlal5gH3Utg1eX34f4dFj4Tg7595EPMzAd7cMP3x9EQiN7LjeWHeCJ0vHL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619295; c=relaxed/simple; bh=o+jSbvlYzxeuCb/O3UexE+kxh+qFTT5+46ZgSo6Gq38=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EHXwAw0XfMSzDGG85SwoAmJ2PU57ZlUxr8dqeoiUk+Qnu0joA2qDFsnDS209mZ9ceofr8gdezMAeZOMNOXT7V5L+zLwRvJu/W7D1cdQDlVBt5GZSCvhAiRDbs3/yvl3bW3/zMIgizBio4IxOtHeJch2jnUPyPXCstWpivIttZ58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W5Zdb8V/; 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="W5Zdb8V/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDEC9C43390; Thu, 22 Feb 2024 16:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619294; bh=o+jSbvlYzxeuCb/O3UexE+kxh+qFTT5+46ZgSo6Gq38=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=W5Zdb8V/uPWZKlpC0AIIN0f262lazuSYYxxRSj+jpabe6WN+4zNuBwIQodv24tCyH 6whhI423HOjXbGDWtVdxxYnPczKeP+nPQR8Ct6O6nC81wpntRbtoD8uZHSR6+8ucaL mis8o+p4Ex1jYrTyfShIyPQZddZMt7nzIxwAE4uWteAMc17qs8lVrumwZjKcNY+BZ4 Z/5XNTBHAfrlqTbGYqL9iYCr3VoZfnduJWHwIwCDvQ31niDsSJ4kK4E38tkuoPzlyq bjgfUjp4IU0ExOsbXaHONnGt0PG8W8cIajbAcQKMPceQdv5/zVywhzTCAyWxnp57bi cCQOGJ5ByJf0A== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:27:59 +0100 Subject: [PATCH mptcp-next 3/6] selftests: mptcp: sockopt: fix shellcheck warnings Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-3-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2699; i=matttbe@kernel.org; h=from:subject:message-id; bh=o+jSbvlYzxeuCb/O3UexE+kxh+qFTT5+46ZgSo6Gq38=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13YaTmis9DgClAH6p6PfbTtKRNMvtDxoRVVDo hMyK/wsoKKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg c1iwD/4iG4Lszko78e2Eh1k61MF3QDlzTGxRZGox0vuk7NWx2wgRKsAc8qC9Bbe807JSUUdVvII p1VYoLbR4I5Fet3DSkjUyccqWNMEMHOBTRJkurMisv/1h8RBMac/81ZWkYvBn/jN58G81d+X7Vo mQrX83D3svP1LmX1t0f0/CZBxCyGMC5oQhj3O+aHhjTaTFyerulaG41CpVshuVcT9CeG/9sOsnS 4VRuRPgM+VWciR2ZrC2zDIibwTNNTtneRjeficoEL6W8tZ0zhD2I/JKNQ1Soe/8hHrEokMz6PFT RaDvv6rswy2BGq0nwP6lZOBRj/gSg7wfyD+lqMWiksSeBmtU1hlf6UShYIV05ma//79WHhpKDQj kJEOyzETSmpsFCMliVjy03qAle8bxs7IuZaSWFfCW8wKsK56DLZkGopTrl+SC+IgwQTRHUYOsnQ rtaT6fdSONIEkmqKDXGYQtaTI9WfXhAnQTU8jY6yuurK2mlD/j4VylS5YWSKCyU9ZyCuk+CopJ+ cABP89I4EXb8bpGce9UBguKf9n8y9ady9uFekoKeedZ3OY/FIpE11omCHBqrCHxh5z+7xs7xsY8 o55SR+AXlOi1v/4ysxIyVQKd1XE+VObKsZ9efAjpr1MrW+GhRqChA4PJQVwtdReHHX9J6aXMmzB 3LWM/W5pvPu8oWA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2006: Use $(...) notation instead of legacy backticks `...`. - SC2145: Argument mixes string and array. Use * or separate argument. Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/tes= ting/selftests/net/mptcp/mptcp_sockopt.sh index 7dd0e5467d35..6ed4aa32222f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -1,6 +1,11 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +# Double quotes to prevent globbing and word splitting is recommended in n= ew +# code but we accept it, especially because there were too many before hav= ing +# address all other issues detected by shellcheck. +#shellcheck disable=3DSC2086 + . "$(dirname "${0}")/mptcp_lib.sh" =20 ret=3D0 @@ -8,7 +13,6 @@ sin=3D"" sout=3D"" cin=3D"" cout=3D"" -ksft_skip=3D4 timeout_poll=3D30 timeout_test=3D$((timeout_poll * 2 + 1)) iptables=3D"iptables" @@ -41,7 +45,7 @@ init() mptcp_lib_ns_init ns1 ns2 ns_sbox =20 local i - for i in `seq 1 4`; do + for i in $(seq 1 4); do ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$n= s2" ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad @@ -68,6 +72,8 @@ init() add_mark_rules $ns2 2 } =20 +# This function is used in the cleanup trap +#shellcheck disable=3DSC2317 cleanup() { mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns_sbox}" @@ -257,12 +263,12 @@ do_tcpinq_test() local lret=3D$? if [ $lret -ne 0 ];then ret=3D$lret - echo "FAIL: mptcp_inq $@" 1>&2 + echo "FAIL: mptcp_inq $*" 1>&2 mptcp_lib_result_fail "TCP_INQ: $*" return $lret fi =20 - echo "PASS: TCP_INQ cmsg/ioctl $@" + echo "PASS: TCP_INQ cmsg/ioctl $*" mptcp_lib_result_pass "TCP_INQ: $*" return $lret } --=20 2.43.0 From nobody Tue May 14 19:21:54 2024 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 23736130E32 for ; Thu, 22 Feb 2024 16:28: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=1708619296; cv=none; b=c+Q9YLsdUB5YHASwwzU0BelSnmRUAYTym7yvk7ULx8GO26x9haO3HOuEx6WiNdtdhqUMqpmjXvN1EJ7W9AZzjzVxBBdWyG220jmIJ0Hx73QZGClgLYrW2eXrR2k2UZpws9npxMIs+vI0yZMS2R+UP2li/Wa+VLBsyBijFMFfmiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619296; c=relaxed/simple; bh=NdzuTZnT4mM3C0AQnuBnVv5/NzPYTKcBpWEYp6mEj9w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bk2wd/Dqmfq0xgbHxn4vtsaD0+Pvu3Q8tJMzXy6OPwOuXqVR1S2NAFwZHGVPyyYlWXL3/uC812Ec4HvVThmiKmLPibVF+K59j0ev53KCaG5JwIII5saA2kIAPK8fqvjERYuMDE5oWe6IkIEbG2rquhe5OSLtUx7g85VPZWgk4AQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ehQYmTYC; 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="ehQYmTYC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA345C43394; Thu, 22 Feb 2024 16:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619295; bh=NdzuTZnT4mM3C0AQnuBnVv5/NzPYTKcBpWEYp6mEj9w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ehQYmTYCVjLfWDXAdvP8gFs2KhNZOZa112bg+aZacAF1d4EWlrLkHY/jyrQSSJzuY 8BvALWmXRzZRPXmcUdlOR9KW1Vzs70dl54g7eiaG6sCXJEwaORM3KbcUrsuoJX/VJ8 fGP+5FILfIhi3Tx3yVSb1V1v1eud0k7chMsw3atrsQz4UMI9UBurrFH8FDLgDR4zdw xtVr0FjsAMQYfruu5gi/iufnFMV3oveWrVVu2wAGABH8DRMWZ5OxggPtA6/mxpdSHI f6PfeERzXVU0DhHKx09Kr6SGstzaMh/VkgTX+ISo5IIkfSlyt87gm0HJ3YTu5aJzmu bcEzCIlOkYoDA== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:28:00 +0100 Subject: [PATCH mptcp-next 4/6] selftests: mptcp: pm netlink: fix shellcheck warnings Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-4-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2670; i=matttbe@kernel.org; h=from:subject:message-id; bh=NdzuTZnT4mM3C0AQnuBnVv5/NzPYTKcBpWEYp6mEj9w=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13Ya3LT+xyBODp4oJYTT8+f7lIQAgNdsWalQR g8QvWh40MOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg cwetD/wPYjL3HhU/xpwPxFSuqRygOCiqUlYlsQfDshIpkcqxw5Qi1+eeFeSQ8Hj9fb8cSxWHz4I Au1KcUACtKxIDL5WpFAbSG2d882WIyLYqyePfVQ8b1HyPj3nnhaOEjgayRJZOHxe16Hr87u6YYn RtGjlhEl8dCbLPmx2T5eT0ayClo6eJmDspZBbRW5ixuReRzvUlq00kP2oOpWJ134G3aYpfbgZa6 6Pp6A7HSniEVNuWcnuMOqRHD7x5ONrShnnb2tFDyE82coLwcI+md1tF4VTS8JJ6/wELsM7/aPQ6 3GIoeJobhfNgUD0wAO/Ip2j2lhnsQO0tuJf3PbwjKokfR9PGp/3Oes5jp5CE+GnCRYgETs2m9qh 10T5Rpt6GoFH3AzGmJc2LzTtGo8RBvfuG2+4lTMtb7J1jOLIqGPWud7Vp8O1i7HV+7yQGQAaDEN gg+kRM4gJ6X7olzZ1F8tYpO0id9iZMxhwwBofVbP/XHnNsUDDt02OTadoUy80RCaZ1ZIlfqtecV 9pl+omgskDlc6GTrlGMrEnDEousUhxljPKAg80es9zla2JKynbD+bJQ46OmC3QnbPrsmtoq1pwM UO2fb+Bxly51rts0lB5X9C4q2NJ+YTgejaCGZGu1Xw62+eWDB2uGKaFFQWh9CsnNe7iBbchEvnz bRnnp+QaRlFf12g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2154: optstring is referenced but not assigned. - SC2006: Use $(...) notation instead of legacy backticks `...`. Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testin= g/selftests/net/mptcp/pm_netlink.sh index c7c46152f6fd..427fc5c70b3c 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -1,16 +1,20 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +# Double quotes to prevent globbing and word splitting is recommended in n= ew +# code but we accept it, especially because there were too many before hav= ing +# address all other issues detected by shellcheck. +#shellcheck disable=3DSC2086 + . "$(dirname "${0}")/mptcp_lib.sh" =20 -ksft_skip=3D4 ret=3D0 =20 usage() { echo "Usage: $0 [ -h ]" } =20 - +optstring=3Dh while getopts "$optstring" option;do case "$option" in "h") @@ -27,6 +31,8 @@ done ns1=3D"" err=3D$(mktemp) =20 +# This function is used in the cleanup trap +#shellcheck disable=3DSC2317 cleanup() { rm -f $err @@ -91,14 +97,14 @@ check "ip netns exec $ns1 ./pm_nl_ctl get 4" "" "duplic= ate addr" ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4 flags signal check "ip netns exec $ns1 ./pm_nl_ctl get 4" "id 4 flags signal 10.0.1.4" = "id addr increment" =20 -for i in `seq 5 9`; do +for i in $(seq 5 9); do ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.$i flags signal >/dev/null 2>&1 done check "ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9" = "hard addr limit" check "ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit" =20 ip netns exec $ns1 ./pm_nl_ctl del 9 -for i in `seq 10 255`; do +for i in $(seq 10 255); do ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.9 id $i ip netns exec $ns1 ./pm_nl_ctl del $i done --=20 2.43.0 From nobody Tue May 14 19:21:54 2024 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 CA1F2130E32 for ; Thu, 22 Feb 2024 16:28:16 +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=1708619296; cv=none; b=hu4J7TsjbMEDPV6pwDcFGBI/L/yMtCLt4CvREAj9PdsRnMYPuSEnCyB2MjIoSxevnsP+FniyqFVK17Fy5TxXQKoU3/mAui7URrD5v/kKyU8V5ySMxL6LOngJX/cm25VVDFC1WDpxWdKCwUR7fBxs7zc9YXQqEQbkxZGegLi5uEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619296; c=relaxed/simple; bh=6gp3tMz4Awm0XC4OVK37KQh1Stbq3kFN1MWg7WiNC+4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LQRnLL1MJCeqwWzGuHWxp8QNdisGkEIOfuxgVfLdI9pAfFPHjMrP6XeXhuNt+QmINC0THcb25gEEZ3Hm5XQhVICImtuo9WWen3YyKuZ9VdjrVo9M7Gjm5yFJO3S7VaeiOhC0KvPdRpSWTRD+lpSMycBG2LUl4aVEwCu7n+WTsiI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bo/Smj0L; 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="bo/Smj0L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A52C433F1; Thu, 22 Feb 2024 16:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619296; bh=6gp3tMz4Awm0XC4OVK37KQh1Stbq3kFN1MWg7WiNC+4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bo/Smj0LFNS0UA26I9UbI9BhQ8WwnAW80EmFQPqQ1kicVFrdVG2Wm9kMuIzMqxIs9 Z2qiTpbQ8hgyS8awQv1aBlJqbWbSoiJOM/0FE6oq6v5VG1DIEw/F2ngmortS9KwkK9 MLKbStZJ9iqjgCgRwN5iwTa2bwPCzr2E8JZlQR1SY+HJKmhXN/SjO8I8yVjIZO/bQH eUeJv+3T+O4YUq0vXHmALkndfkJnkceN1kHAIn+NqK80bg4dG8CwTlyEI3hOBoTFHL qEc8v7Rw54XNErr4d1Id6BoXO1p8jHqJCCLBIz+8PP258g1zsxTFNV/sH4RyZ7AMLB l2YtBblQUevnA== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:28:01 +0100 Subject: [PATCH mptcp-next 5/6] selftests: mptcp: simult flows: fix shellcheck warnings Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-5-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2056; i=matttbe@kernel.org; h=from:subject:message-id; bh=6gp3tMz4Awm0XC4OVK37KQh1Stbq3kFN1MWg7WiNC+4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13YaIeksgYAGUuI+LLgikd+42gWL23KWSKsLu ZnWkdtizvWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg c2IGD/9ReoQkkQjQk2V8K6Vkoe2g/6TA86U++KsxAK6vsbpUs3snSK04slp/KuXy5AG8VrIxUux EORObB80dMAnmmWOyz5Df+B1KqECjgjna1ZEabiiDZFAGbsrQhZExXpaXCphf2DZU+2pSFee5vj UoYkjPyqP/dbePrluX2dUE9J+S6kh5QJZmYo2eRfAxM63YKl6S7pvWQ7WeQsSZyP1g7kBQbvKjx d9+nve2R/gIf8sM0URbpvNWJM6vUfrsAWrk2+Tm2tByTXMfCaykY4XqPa2iLHRCSknojK2brVEv gg5GdY9D4e7m56bY4Dx0R0NP1VpvZIpPsPWCeVNMSgnN7Tr921+H4vYiRSR2U5horn5EmtTAtDH CZSqPdeC3XyUPNnujJRxMia4dRhRo0m/SbHDga3UggiJljqcweYlNfa9ot9UuYPc6jkAviEWJbZ Nbptf8w92NJNIY8YOuLmN6S9pTj1isDZdfdS8gQy/xqeH+ITamQqspud57pa4Jpl2bDhH2Qkhzd Qp8JiJuZ4vAhQ3hOxa9gBOxTd6MvBTMEwauK0LhCgU6uU6inD9+UU45ZdBfU+y2PQaqYGZ6gjpH wqLt8aaAnKNFWWWaMXZKDuTsAAnTh9bKyz1gfsRrMi2neFC7bAI272dHC2EVINUvPiuwShZE/Ma iJprk/YJhQj/WAA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2004: $/${} is unnecessary on arithmetic variables. Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/simult_flows.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/test= ing/selftests/net/mptcp/simult_flows.sh index bc8f107357ac..467feb17e07b 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -1,13 +1,17 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +# Double quotes to prevent globbing and word splitting is recommended in n= ew +# code but we accept it, especially because there were too many before hav= ing +# address all other issues detected by shellcheck. +#shellcheck disable=3DSC2086 + . "$(dirname "${0}")/mptcp_lib.sh" =20 ns1=3D"" ns2=3D"" ns3=3D"" capture=3Dfalse -ksft_skip=3D4 timeout_poll=3D30 timeout_test=3D$((timeout_poll * 2 + 1)) test_cnt=3D1 @@ -28,6 +32,8 @@ usage() { echo -e "\t-d: debug this script" } =20 +# This function is used in the cleanup trap +#shellcheck disable=3DSC2317 cleanup() { rm -f "$cout" "$sout" @@ -120,7 +126,7 @@ do_transfer() local sin=3D$2 local max_time=3D$3 local port - port=3D$((10000+$test_cnt)) + port=3D$((10000+test_cnt)) test_cnt=3D$((test_cnt+1)) =20 :> "$cout" --=20 2.43.0 From nobody Tue May 14 19:21:54 2024 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 DF91C130E32 for ; Thu, 22 Feb 2024 16:28:17 +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=1708619298; cv=none; b=LkfWRTsCxcZa4uadsbLL204YG7qu2YUtoG0sNmL0Vni6LmcABLWlJquEkY3dpyaG6XgN4nyx+5F7use0Q5PQMiMEOH8YlfCjpFyzx2I/7yMMfoz6lAU97qGr9aLdnaKU/An9KLs5zAD7xdIs8Js16BKWTrlq8iR/oI6WB6IL+G4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708619298; c=relaxed/simple; bh=7wfBIsDFKLIhv3WQTuiEJmSuIVeZe6lt8rHgoUmQ+uY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=klWBw6HZSOfxW0krGTWcS9YNqy86/2qrmKZl7x1kYUNlWaVmnpqMHJQ5Azpj1iEh0JQdCplQo3crwYviJ1PV9puak6kpHnMRJOZYl2a+at8OOIGD6IdVY3N2AITn44SehJhQnO7SHZ9f7Ke+rwu/e80GN46KOoKC70wWGS2BNyU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qMAND7RQ; 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="qMAND7RQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E205CC43394; Thu, 22 Feb 2024 16:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708619297; bh=7wfBIsDFKLIhv3WQTuiEJmSuIVeZe6lt8rHgoUmQ+uY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qMAND7RQOwQFS9megKK/mICD7vj9NZDIIo+Vq392s9XQvi9xfPP4zqRiX62pUfk5y 0CoXYOTnU3GuodrYA08wdr/4RjmYgOMMpDaFzvxeLNqyDJWNSrVkpRlXaibj0Iobch HGK8abpLj5j0EArr+z53noA6wpvC2D6J8rnYonqvAf80mTu7AAz6bUg81fGjDfxG7R 6gtKdn0xxsY8IPwc/CbJzE8qWRbDxEPnv4HD6Fb/bTpVyoQC0zCeW7D7Knit7znq9s +GUKpmKPu6rZsxmSsQeVaoZlTU65NXG5wXE0rmbJn8H2NxTdjbN2hiRt4MmENByiym PaSa6cACI1j7A== From: "Matthieu Baerts (NGI0)" Date: Thu, 22 Feb 2024 17:28:02 +0100 Subject: [PATCH mptcp-next 6/6] selftests: userspace pm: avoid relaunching pm events Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240222-selftests-mptcp-shellcheck-v1-6-fed8ba9e6ca6@kernel.org> References: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> In-Reply-To: <20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2381; i=matttbe@kernel.org; h=from:subject:message-id; bh=7wfBIsDFKLIhv3WQTuiEJmSuIVeZe6lt8rHgoUmQ+uY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl13YaV77N1aP4xvm1POf2HwxjWfYoe7AjE/Y4h +wjdaWuYsCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdd2GgAKCRD2t4JPQmmg cyIgEACdhujqEsSW6yus+CBdH0QgsM8gvU0U8PCKJF0JTVNbT72vMrOq+HU6eoCxOPe0qa+ibL9 2b0yKVouwUcUvtJpcXiVMomqE25f59b94XujH3Z88P0+bCn03OTqLsA8fHL4vYyBVr5F4HF+j0M g5Eyq8NbjW/NuWF4fPmkdGZIych/CdzM7rBnaJBOSrrdA0cWhQYwFXW+IC3JPUuw9Ok1AKAm2zN 3cHHetErMpjuid4fuxnb1/f9Q+VDaoAx/z1Bnk6W4MlPR7BVaqQAoknZVMadcKyvdbNFsm2UK6r 8F5/yp4k1nR1KP1/T3NzrdSUGkc5S9vGF5HQL5vepgOnXYDpxlAHymbC/aVNlQ2s/gYVW2UAWBf Nz0ir0/bE++xYwRcv0SDhNkHvW2YOisPfQSGz17cotMcePr/4njD9nqa2uYQWZQk/vPOgUw27aP HQ8AZvmEgynJ8JtMeUBcM4bVeVRu1uVu9JLnhcg94D6zaCJvq8+EvrMEUq+VmbOxys14VqUsqti OVdUC4SjxrlYCso29sCxTADqkxh6tpByqO51+msa8LGbceJq2gHtNu0aE+z08e47A314S95+UEN j7WRHSA4+wuh4rxoLCnxcaBGEIe8iRyjPbNvFo+UT9eYLlOk5tVabgzXKoG/w1DSCkd7GDuPtng O4Uqf8XPhiqtSCg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 'make_connection' is launched twice: once for IPv4, once for IPv6. But then, the "pm_nl_ctl events" was launched a first time, killed, then relaunched after for no particular reason. We can then move this code, and the generation of the temp file to exchange, to the init part, and remove extra conditions that no longer needed. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- Notes: - we could backport this to stable, but it also works without issue without this patch, and it would be a bit annoying to backport, due to the use of the new mptcp_lib_xxx helpers (make file, events). --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 29 ++++++++++---------= ---- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/test= ing/selftests/net/mptcp/userspace_pm.sh index 3200d0b96d53..b0cce8f065d8 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -149,17 +149,23 @@ ip -net "$ns2" addr add dead:beef:1::2/64 dev ns2eth1= nodad ip -net "$ns2" addr add dead:beef:2::2/64 dev ns2eth1 nodad ip -net "$ns2" link set ns2eth1 up =20 +file=3D$(mktemp) +mptcp_lib_make_file "$file" 2 1 + +# Capture netlink events over the two network namespaces running +# the MPTCP client and server +client_evts=3D$(mktemp) +mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid +server_evts=3D$(mktemp) +mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid +sleep 0.5 + print_title "Init" print_test "Created network namespaces ns1, ns2" test_pass =20 make_connection() { - if [ -z "$file" ]; then - file=3D$(mktemp) - fi - mptcp_lib_make_file "$file" 2 1 - local is_v6=3D$1 local app_port=3D$app4_port local connect_addr=3D"10.0.1.1" @@ -173,17 +179,8 @@ make_connection() is_v6=3D"v4" fi =20 - # Capture netlink events over the two network namespaces running - # the MPTCP client and server - if [ -z "$client_evts" ]; then - client_evts=3D$(mktemp) - fi - mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid - if [ -z "$server_evts" ]; then - server_evts=3D$(mktemp) - fi - mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid - sleep 0.5 + :>"$client_evts" + :>"$server_evts" =20 # Run the server ip netns exec "$ns1" \ --=20 2.43.0