From patchwork Tue Sep 3 10:23:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13788471 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 662D31AD278; Tue, 3 Sep 2024 10:23:56 +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=1725359036; cv=none; b=h/3DXtEWDENb4n67+QviMXW4dYGnm/DmnevcQJe3j1SCQ7mjUUmiZB14u6jgJMovDm32/0Vg/8DtyluaJC/dmric9pfolawEYQ/kyRGr6Kb+8t6vbtCLPzj/5TR8YAsY8F+JTNCBOGmCTd8ffVpf6DVQmuX+/e5JZQqS3+4FLxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725359036; c=relaxed/simple; bh=rV1vjGTjzOzwSExTkJWvWtoeOAWlAaMiYtcR6b02Oaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dQmMPhIkYA92pkwGfXS3YTrQ59fA/zPESQBRvhiqIse5jXCb7fNrE4AgeiAW6Kr8aqyLMu/95PRRRtUUWYsZ1BObTZEPc5qhYJFxUvbaopk6oGttt3TsLPIUrFkqdGo9AGO0Y5xmazLrHUTV5bXZdJBVdJEBduzaiS2Iat296jw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ibzhPEsi; 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="ibzhPEsi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68032C4AF09; Tue, 3 Sep 2024 10:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725359035; bh=rV1vjGTjzOzwSExTkJWvWtoeOAWlAaMiYtcR6b02Oaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ibzhPEsiO2l37oZY3nVLCYEc5mzeKHF1XafNyL9LOLN76Pvj7t3FWD3l8OQZskSEI YkJewi9cTkSTQmiTTBhU/Q0brOEIJspKsxBMBqjfHTx0gH1njjulxP9rFU4NhO3c0W ENXgzegcQ+1eHORfiTxFAOgZw1B2oZhUSsfZ6SZKdZ2gm7pBlXgMCV7x8Ops+Q6c+S 7ozIJtPHSrl9H4tOuZ8+1UJ2oQuAaGtMthYMuDXk5R+wcGkWtF1htGX5wAwjDDtuKC gyaobG6VJ8lFd81gw9bmAQZy3D/0E7x98uJeBWUEr/j14zOhnnlc5QgXL36ZkHo/VZ Gl/bt61V90WNA== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Geliang Tang , Matthieu Baerts , Jakub Kicinski Subject: [PATCH 6.6.y 1/3] selftests: mptcp: add mptcp_lib_events helper Date: Tue, 3 Sep 2024 12:23:49 +0200 Message-ID: <20240903102347.3384947-6-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <2024083025-ruined-stupor-4967@gregkh> References: <2024083025-ruined-stupor-4967@gregkh> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4014; i=matttbe@kernel.org; h=from:subject; bh=/K1q5LfgKWfWfkdCD0RDAGHV3/LjT2CFFxSixQnB9Ro=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBm1uOzZGNSOKmlNvGWvcOp1X/4xddSjfzQBK86P 2z1qVRI4YiJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZtbjswAKCRD2t4JPQmmg c2D2EADu9bJCnDVng7Ko9gtcPZLM0OHNHdysNa8r/ag3vc5kXJ1xhwSc1h523kDBJFVlorz4Pso Bs0ldTWp6h7dQPUN6f41+uPHMqOK+W3On8TqiBZUFjY7J3r+YD4gSrkwdgyOoextYJgOFW3ZgHD 1rmMgY5Z2YwvMRL4aOb2XRFs+TZ1nQUF7AkAmD4R9TZK/rEC3t/srybvseyRtkpBh9SUpE9x/fa Lp0rp3CyHv915sR3DcQclumm8V9xTCZemYWmzYTbJLg69BqKR6HfCd4HGZIngyJdX1GDh+NAa4T YRESWhx+K4Xzrx7X5/hcSiNbalI7S4wpbty+Yow09JWi1D0AN2giseRT2pTo6sE+ATo5+wz8+/5 pjwb1TDyWiR4FIUO+x30IojU30AD1UNULq+5zOmssvEuJ1FFORsVSlDIwdRyKrPloeTSzT2ozaA gVWdQX6VDhyCX6Rx+HNHhBYcRXu6qNFUzgkBvxLRwDQvxwFau9AelzJubvoZk1lkj9lms04wspQ ug89ytTNTgIS9iXuxqW3h9KyUrnEqLgja4aPz/05SUspSJDwZPUCw4eF4htli7c388FM/+n9ezs 0Ka++7s+1Z9fbpc9yg2O2JuZ4qBfem4YstmZdxadKpp22sujcfjgKBIAgbtMknodyYUJdKajU7U up4E/VmjrAvyxog== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang commit 35bc143a8514ee72b2e9d6b8b385468608b93a53 upstream. To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in mptcp_lib.sh. This patch unifies "pm_nl_ctl events" related code in userspace_pm.sh and mptcp_join.sh into a helper mptcp_lib_events(). Define it in mptcp_lib.sh and use it in both scripts. Note that mptcp_lib_kill_wait is now call before starting 'events' for mptcp_join.sh as well, but that's fine: each test is started from a new netns, so there will not be any existing pid there, and nothing is done when mptcp_lib_kill_wait is called with 0. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-6-bc79e6e5e6a0@kernel.org Signed-off-by: Jakub Kicinski Stable-dep-of: 20ccc7c5f7a3 ("selftests: mptcp: join: validate event numbers") [ Conflicts in mptcp_lib.sh, because the context is different at the end of the file, where the new helper is supposed to go. The new helper has simply be added at the end. ] Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++------ tools/testing/selftests/net/mptcp/mptcp_lib.sh | 12 ++++++++++++ tools/testing/selftests/net/mptcp/userspace_pm.sh | 14 ++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 176790507019..12a5daf6dc10 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -465,12 +465,8 @@ reset_with_events() { reset "${1}" || return 1 - :> "$evts_ns1" - :> "$evts_ns2" - ip netns exec $ns1 ./pm_nl_ctl events >> "$evts_ns1" 2>&1 & - evts_ns1_pid=$! - ip netns exec $ns2 ./pm_nl_ctl events >> "$evts_ns2" 2>&1 & - evts_ns2_pid=$! + mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid + mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid } reset_with_tcp_filter() @@ -669,7 +665,9 @@ wait_mpj() kill_events_pids() { mptcp_lib_kill_wait $evts_ns1_pid + evts_ns1_pid=0 mptcp_lib_kill_wait $evts_ns2_pid + evts_ns2_pid=0 } pm_nl_set_limits() diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 8939d5c135a0..000a9f7c018c 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -247,3 +247,15 @@ mptcp_lib_get_counter() { echo "${count}" } + +mptcp_lib_events() { + local ns="${1}" + local evts="${2}" + declare -n pid="${3}" + + :>"${evts}" + + mptcp_lib_kill_wait "${pid:-0}" + ip netns exec "${ns}" ./pm_nl_ctl events >> "${evts}" 2>&1 & + pid=$! +} diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 4e5829155049..bb0fa1a3b124 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -201,21 +201,11 @@ make_connection() if [ -z "$client_evts" ]; then client_evts=$(mktemp) fi - :>"$client_evts" - if [ $client_evts_pid -ne 0 ]; then - mptcp_lib_kill_wait $client_evts_pid - fi - ip netns exec "$ns2" ./pm_nl_ctl events >> "$client_evts" 2>&1 & - client_evts_pid=$! + mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid if [ -z "$server_evts" ]; then server_evts=$(mktemp) fi - :>"$server_evts" - if [ $server_evts_pid -ne 0 ]; then - mptcp_lib_kill_wait $server_evts_pid - fi - ip netns exec "$ns1" ./pm_nl_ctl events >> "$server_evts" 2>&1 & - server_evts_pid=$! + mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid sleep 0.5 # Run the server From patchwork Tue Sep 3 10:23:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13788472 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 5E1181B9835; Tue, 3 Sep 2024 10:23:57 +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=1725359038; cv=none; b=A3bqZRPsODHUDvT8SRSDL2WqND7gNdhmdW3YPbwIZ4qI+bxwHCKfwPsB94cAJyBxJ5gGWfR6SgdKhb7ln2aG/Htd/l2dcq6zubg5ikhlM6zTAMXJ6Qc88SfDS+rF9KSfbCxw1hFmI0FDf9Bl2QIKX/015OQ+Wu0Qr4UJMFxmKjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725359038; c=relaxed/simple; bh=F3E1oFfdFzgtEQpafWqcWkO5+2evu97CmqTGGwxq0FI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FmJTDVOy8dDbAuSLH1UAHklGDaLvUgBBNTGEO4pXvgY67zFrgVQXqjMOysf+DnB0c77ALGXy72PlodKAKt7NWAOmHk/axtydnHOod4gq6C3haqY2I2a1aIOphLdaYQFqSt6CksGv6mZ26dOMIiS6XKEqkWz9Wk1sqfxUrWMj5Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=scnmWBlG; 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="scnmWBlG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 561E9C4CEC4; Tue, 3 Sep 2024 10:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725359037; bh=F3E1oFfdFzgtEQpafWqcWkO5+2evu97CmqTGGwxq0FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scnmWBlG4H6TGpOZaINuxOINDp9f9xVzxgyM0Xnb2190OPg2N2ACbVCh1UmgmLpub 36DZnwJ4jk6vCXyM5pSnJTOv4LTX88zol5+EISP7j1A97johYKuPbDG46YyTgE2dAb E2/DRqMhXQ3+o37NepDcJl2CGtCrLycAnpzmS7zB1YseUVWQ7gh5aAXuj7KCX3oTAn yObcvejftDAUTyxk6bkzSt7eFHJ+ogxElFO+rqokARot5VqE468Ypi02h/dxL0mVEI YdtBrM37rDynQvVU6dW//JI0ySEttO7K5DtbRGpWwaBU152Ij5F8ieUP1z4/YdWyKN HglBPaFid7qfA== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: "Matthieu Baerts (NGI0)" , Mat Martineau , Paolo Abeni Subject: [PATCH 6.6.y 2/3] selftests: mptcp: join: validate event numbers Date: Tue, 3 Sep 2024 12:23:50 +0200 Message-ID: <20240903102347.3384947-7-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <2024083025-ruined-stupor-4967@gregkh> References: <2024083025-ruined-stupor-4967@gregkh> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6917; i=matttbe@kernel.org; h=from:subject; bh=F3E1oFfdFzgtEQpafWqcWkO5+2evu97CmqTGGwxq0FI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBm1uOzzoIOLzsz7NPvKsncpcTB4hU8g3Qn+jto7 h0zp+pbx9qJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZtbjswAKCRD2t4JPQmmg c9hwEADi4G1eaUdETuj5I2P0onLauwsrF6Ig0w2LS+KwUNDb+xZjC1nfcsQ6EWv9mUgT3mKDKEh edDIdFgnclVXjaW7DBpICAQXb42nx2lOv2NxFHTYThFaIFtaM7Rd4guLgL3bfkgFDReI09VmPj2 tyUzYoWnE4qV7yxM74I3RCEPx7padpShLj8JD86UW4xCl1ixn6K7yg/JobiWPWU/dxfaux7pvnx tj4HkPoTRuS/feFkrELBbCeOKtUYCwhUqTUsoZ2i+xNaRCaDzkX51PtghixrlvRbLEVaQT/G4e0 WoM7rtuPEPaO8UQuEPJTSVTkSgVfaoGI31ANQ6IjulK8lcImOUiuNiRwgZ9Yvf6oEhQCC1/IyNQ GSRsmD1uqvkus+zSvHPwQ/PQ5VnwtNakaRaH2ybOzrRGlXZmumWC7xfPNSrj6kAtQHVfgru9KG+ jDEd0nlZgsFnB4QyImi1n4n8Vh7gJl/ff17n0V+epJHQTy4b2MZKBlTuU2MenZPIMFNGTtz39K3 zcir7X1xcZ4eBY77xRweKNCDdEsXmlAOLgdGJ/ClkTP/FlvtGiZQ3GYbyN6geFnkUZBbHU8o6M1 QZRpHa02z45IMIgCwXNkvPbsuPvyhwyyvrNN54axKIqgl5leMCLHOwStx2eEHzVWVoBQ1bZVRYX MirNlXozZfoF0jA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 commit 20ccc7c5f7a3aa48092441a4b182f9f40418392e upstream. This test extends "delete and re-add" and "delete re-add signal" to validate the previous commit: the number of MPTCP events are checked to make sure there are no duplicated or unexpected ones. A new helper has been introduced to easily check these events. The missing events have been added to the lib. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: b911c97c7dc7 ("mptcp: add netlink event support") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Paolo Abeni [ Conflicts in mptcp_join.sh and mptcp_lib.sh, due to commit 38f027fca1b7 ("selftests: mptcp: dump userspace addrs list") -- linked to a new feature, not backportable to stable -- and commit 23a0485d1c04 ("selftests: mptcp: declare event macros in mptcp_lib") -- depending on the previous one -- not in this version. The conflicts in mptcp_join.sh were in the context, because a new helper had to be added after others that are not in this version. The conflicts in mptcp_lib.sh were due to the fact the other MPTCP_LIB_EVENT_* constants were not present. They have all been added in this version to ease future backports if any. ] Signed-off-by: Matthieu Baerts (NGI0) --- .../testing/selftests/net/mptcp/mptcp_join.sh | 74 ++++++++++++++++++- .../testing/selftests/net/mptcp/mptcp_lib.sh | 15 ++++ 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 12a5daf6dc10..52a028f0a3de 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -461,12 +461,17 @@ reset_with_fail() fi } +start_events() +{ + mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid + mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid +} + reset_with_events() { reset "${1}" || return 1 - mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid - mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid + start_events } reset_with_tcp_filter() @@ -3420,6 +3425,36 @@ userspace_pm_rm_sf() wait_rm_sf $1 "${cnt}" } +# $1: ns ; $2: event type ; $3: count +chk_evt_nr() +{ + local ns=${1} + local evt_name="${2}" + local exp="${3}" + + local evts="${evts_ns1}" + local evt="${!evt_name}" + local count + + evt_name="${evt_name:16}" # without MPTCP_LIB_EVENT_ + [ "${ns}" == "ns2" ] && evts="${evts_ns2}" + + print_check "event ${ns} ${evt_name} (${exp})" + + if [[ "${evt_name}" = "LISTENER_"* ]] && + ! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then + print_skip "event not supported" + return + fi + + count=$(grep -cw "type:${evt}" "${evts}") + if [ "${count}" != "${exp}" ]; then + fail_test "got ${count} events, expected ${exp}" + else + print_ok + fi +} + userspace_tests() { # userspace pm type prevents add_addr @@ -3573,6 +3608,7 @@ endpoint_tests() if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT && mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then + start_events pm_nl_set_limits $ns1 0 3 pm_nl_set_limits $ns2 0 3 pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow @@ -3624,12 +3660,28 @@ endpoint_tests() mptcp_lib_kill_wait $tests_pid + kill_events_pids + chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0 + chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 4 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 4 + + chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1 + chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 + chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 0 + chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 0 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 5 # one has been closed before estab + chk_join_nr 6 6 6 chk_rm_nr 4 4 fi # remove and re-add - if reset "delete re-add signal" && + if reset_with_events "delete re-add signal" && mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then pm_nl_set_limits $ns1 0 3 pm_nl_set_limits $ns2 3 3 @@ -3670,6 +3722,22 @@ endpoint_tests() chk_mptcp_info subflows 3 subflows 3 mptcp_lib_kill_wait $tests_pid + kill_events_pids + chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1 + chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0 + chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 0 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 2 + + chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1 + chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 + chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 5 + chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 3 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2 + chk_join_nr 4 4 4 chk_add_nr 5 5 chk_rm_nr 3 2 invert diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 000a9f7c018c..d98c89f31afe 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -8,6 +8,21 @@ readonly KSFT_SKIP=4 # shellcheck disable=SC2155 # declare and assign separately readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}" +# These variables are used in some selftests, read-only +declare -rx MPTCP_LIB_EVENT_CREATED=1 # MPTCP_EVENT_CREATED +declare -rx MPTCP_LIB_EVENT_ESTABLISHED=2 # MPTCP_EVENT_ESTABLISHED +declare -rx MPTCP_LIB_EVENT_CLOSED=3 # MPTCP_EVENT_CLOSED +declare -rx MPTCP_LIB_EVENT_ANNOUNCED=6 # MPTCP_EVENT_ANNOUNCED +declare -rx MPTCP_LIB_EVENT_REMOVED=7 # MPTCP_EVENT_REMOVED +declare -rx MPTCP_LIB_EVENT_SUB_ESTABLISHED=10 # MPTCP_EVENT_SUB_ESTABLISHED +declare -rx MPTCP_LIB_EVENT_SUB_CLOSED=11 # MPTCP_EVENT_SUB_CLOSED +declare -rx MPTCP_LIB_EVENT_SUB_PRIORITY=13 # MPTCP_EVENT_SUB_PRIORITY +declare -rx MPTCP_LIB_EVENT_LISTENER_CREATED=15 # MPTCP_EVENT_LISTENER_CREATED +declare -rx MPTCP_LIB_EVENT_LISTENER_CLOSED=16 # MPTCP_EVENT_LISTENER_CLOSED + +declare -rx MPTCP_LIB_AF_INET=2 +declare -rx MPTCP_LIB_AF_INET6=10 + MPTCP_LIB_SUBTESTS=() # only if supported (or forced) and not disabled, see no-color.org From patchwork Tue Sep 3 10:23:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13788473 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 2DE441B983E; Tue, 3 Sep 2024 10:23:59 +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=1725359040; cv=none; b=fFf8mqxGJKBeM9AtFFKVpypoXcK5KkJLawRToHl0FSM+Fu4+gkmIu1QuaDkBs720MEafw1rWKzIcM7bTdNP16WNgZvGNKnvptJJIWCeBD4Rdh+AQOldLeUAM/HoODGr4ehUpU4yx9aNGfgaLfVToKbLo915Es6WkVClCwbJEdIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725359040; c=relaxed/simple; bh=RuBumBigVCVoi3VznTaZJkhBfsWaBHM7oEcGDAFpFfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VwwEZEcbZgI1dsMLYbHDLvck+KkmFOXCGHpv0RMYBTlHm/fZHAr7jFXv/L+oQs80pRgHDTHIAiAePYPG6yurF3CnOvERAAIHAWIW2+d1Jg+fMaHCrT54vogkbp3kJo17kkxJZ1tebJjED+4JrIrV2Uz3pw5Lzbq1Q9s5+Soaelg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tzhQe6Iw; 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="tzhQe6Iw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4340BC4CEC8; Tue, 3 Sep 2024 10:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725359039; bh=RuBumBigVCVoi3VznTaZJkhBfsWaBHM7oEcGDAFpFfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzhQe6IwB+cFlp7vaZKnEaZFoN4sxTCeGKsZsldCu10nsLqrs+TjYZW/PuyhJtR33 PCR6clXbH/iSC9vakbYgnlAwL1KgmKO3oyGnIdoDwirfmwy4NBsbZNGGykVZvh+WN5 669pZqRwwYDkO8BPdp2Pup3IyL3kfBpQBgKyLffKmX8sEtG4fzKD4a+BeeRPQZF8xX T6oqb3xBfDSlSrqQvfr8IEb1FE1JyRn8kqBXe+CbmkVFsL5PhkHITXP/PcattlQu5v lWvVBkV4NIarpQweA1281iGP2/KUvDz1zFHQ2aEHwK8HjjSxCoQZp6xjRGYte9ZCpr 2/q9djjJm5VQA== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: "Matthieu Baerts (NGI0)" , Mat Martineau , Paolo Abeni Subject: [PATCH 6.6.y 3/3] selftests: mptcp: join: check re-re-adding ID 0 signal Date: Tue, 3 Sep 2024 12:23:51 +0200 Message-ID: <20240903102347.3384947-8-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <2024083025-ruined-stupor-4967@gregkh> References: <2024083025-ruined-stupor-4967@gregkh> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3347; i=matttbe@kernel.org; h=from:subject; bh=RuBumBigVCVoi3VznTaZJkhBfsWaBHM7oEcGDAFpFfg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBm1uOz5htbm2a46iJtawAaOGM2Gk4cmNXhxAUSy xEoy7qMFPuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZtbjswAKCRD2t4JPQmmg c92wEADtpIHSUxl4FGEdgm7XtO831uJnM81oMI2tWvGg8PdxDgyL1U3bQyNhBxUgo00RnXBwwl0 8EYBSoPEpkZ//VQvlkhxOaMIWPy1fKlf3HBYPsRMlbv4cXwLGibxSQ7ieTBgxzE4b1sWlvo6l67 BTDscIT8vaJfbcUjBXZ9JXT4I0mf+dX7op9YGNFKYmRRkHjCpb4AfuMAOiVJ171If+92rGcd+ge rVEyoNwWRIghkiXXl1r47/wfWjqkTiAgFNikgo0cN8tKKedpZA9hG3tRGQetxkMYLuAzShV8LgR jSx9XdchZyIZYr660ewBvfS4ofxUfVAG9CALVED8uvJ4Obka/zpgQxsft6ubRjFyRf8UBI++nzD V4eVwN5SiT2lcMTLT1w0cEytLIprOewj7YEk3dScW41gVjXDjJuMNHNxJxQvlPjMk0vfqV0krp/ /p3ZMG1ifaA6JV+4iEjc+43Xko4NG8ULGpD1P5M6nxQU+jrXk/p4KQd/vu3mAGoifwG7h9InuAp daX/p1yI2pK16pNtGD8Z7UeUiLHA/cH2JA+/41gHofnrz1w6IzLHGzaGvbUoQfuuOybWAK+HzOY iHIYxwVpMUtB97mkbK4Z2qnszTGdpzwp5f6oYUqQKvUrWnQpsJIWYBxlf/M85hQKZ15MIokpAWT MQqlMDkCeQRDYBQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 commit f18fa2abf81099d822d842a107f8c9889c86043c upstream. This test extends "delete re-add signal" to validate the previous commit: when the 'signal' endpoint linked to the initial subflow (ID 0) is re-added multiple times, it will re-send the ADD_ADDR with id 0. The client should still be able to re-create this subflow, even if the add_addr_accepted limit has been reached as this special address is not considered as a new address. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: d0876b2284cf ("mptcp: add the incoming RM_ADDR support") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Paolo Abeni Signed-off-by: Matthieu Baerts (NGI0) --- .../testing/selftests/net/mptcp/mptcp_join.sh | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 52a028f0a3de..4efcbd2dea50 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3689,7 +3689,7 @@ endpoint_tests() # broadcast IP: no packet for this address will be received on ns1 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal - test_linkfail=4 speed=20 \ + test_linkfail=4 speed=5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=$! @@ -3718,7 +3718,17 @@ endpoint_tests() pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal wait_mpj $ns2 - chk_subflow_nr "after re-add" 3 + chk_subflow_nr "after re-add ID 0" 3 + chk_mptcp_info subflows 3 subflows 3 + + pm_nl_del_endpoint $ns1 99 10.0.1.1 + sleep 0.5 + chk_subflow_nr "after re-delete ID 0" 2 + chk_mptcp_info subflows 2 subflows 2 + + pm_nl_add_endpoint $ns1 10.0.1.1 id 88 flags signal + wait_mpj $ns2 + chk_subflow_nr "after re-re-add ID 0" 3 chk_mptcp_info subflows 3 subflows 3 mptcp_lib_kill_wait $tests_pid @@ -3728,19 +3738,19 @@ endpoint_tests() chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1 chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0 chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 0 - chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4 - chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 2 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5 + chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 3 chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1 chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 - chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 5 - chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 3 - chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4 - chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2 + chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 6 + chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 4 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5 + chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 3 - chk_join_nr 4 4 4 - chk_add_nr 5 5 - chk_rm_nr 3 2 invert + chk_join_nr 5 5 5 + chk_add_nr 6 6 + chk_rm_nr 4 3 invert fi # flush and re-add