From nobody Fri Nov 22 00:49:31 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 726E92A1CF for ; Fri, 16 Aug 2024 11:02: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=1723806129; cv=none; b=KwIQ4Qelzqj/6pt9DmdTvr95C8g9WxqbeifQl7Pfh+hjfDeahDcZiEwsKLBLKJdPW+49ie+jNFu1/mZqb1ge4s05bIOXq6KOwdh7P0NksHIA8gP+Ft8TKg0dkOT8qphVSdIyPNI0ovEeVqqVm91r07ezfLNzxNz7f2b1Jlhn0Xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806129; c=relaxed/simple; bh=LVAGW+m51cX5GlqSgTa+wBpD22XWDMdDSNnxUUITNx4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JE3f4TLT72ilJXO3lHI/jK1wyRRCte6WcVJXhdmoBz68yyony2Vnqq+8eb/iqC8dZk/FunLVKwnaBGWQGc67cd9QXhmb0ffKXLqJU5EtBMvYuTeD9TONracSPqiLUNKqo7dlvvBZ7LFryuSeMiEc6jIuZQ/nLiKmsQT/SIFF1vY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KrxL91EK; 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="KrxL91EK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E4F4C4AF09; Fri, 16 Aug 2024 11:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806128; bh=LVAGW+m51cX5GlqSgTa+wBpD22XWDMdDSNnxUUITNx4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KrxL91EKQYorV3ke67S8u2ZWiKqqGvu9gtkPY/aDgGhV8Z4X7NkGpFN1JAEc5iPz6 fcSsuTZrkOBG7oILmw4WwRI5jqj5GkHV0Mg+7KGhq7aOIOF1zLBqFOPWzL4Y3VBlky bPIX5/ivQeIg0Ghp5Mdr6TYsjQBmoRz8ZT/MYQx6sjZFh5Tjk3JL+mLLyFn+awkOrc RseAuGiad1fkjCOXO1jgzIu8PUV/IXqWaRnqGWorkaj2GC4/9DvNKYyA5+3g/x0Y5/ RTfFCXjzI3ZE+tdZTHVTIXM8pN79cHOMaM8RHwMcq1Nya8JZbTZMDWCG8Ef4Viz1QJ PRTroK7PQrLxQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:01:55 +0200 Subject: [PATCH mptcp-net v2 01/12] Squash to "mptcp: pm: re-using ID of unused removed ADD_ADDR" 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: <20240816-mptcp-dup-close-evt-v2-1-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1177; i=matttbe@kernel.org; h=from:subject:message-id; bh=LVAGW+m51cX5GlqSgTa+wBpD22XWDMdDSNnxUUITNx4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGtvugoj/8Sk7azYMkA/OBPV5ZgtiGfw78S0 f7sO6We0b2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrQAKCRD2t4JPQmmg czgzEADMM2aR6RzUiZaasG7ga7tUJjvhiNg0YRL7QkvJ+1LQwlrYLdug70Zp9ZIuX2HXB0fqd+v uhUidUbIl7szVP+sn9ZembyEmLnulvAw1umfRM+Fjw78ydrByyTNzjZrMY+JCM+fK2cW9rR8YwW jJsyYyysFJPKaQx+ZR9o2L6q3w9DpKiuTxRHUyeg96rB/kT3suXR7jszZ/S+r0dEdRMLJgEo5mE tk4gA+dpxzlu69beSL4r5hnKBbw8DnPzU2p+O7wIMGPlP7MMQMq3LnTHcLZdu9Wr2GA9rC4vHYA dapLaSCiiGYn6r2QjxiqJT/kYwlPYEFizP8wP5cQRTeBrpFu6hobtChPv5TtVNvyltsY888Jyvz VB5ahhkR5p1YlPFzVgg1DJU4rJXstZiilgMbwAl5I4MpVmDywnLK56CuEhYx3JoBR4DN9TiqNdr xlWyQuapUcMrBvWsxlqA7BcVrMiMXrTbpoOF6oVhTTLbS0ehv8St+Ymt26S2I5ZQ4dz/7FmOU+y LilT/gggbRDziK1NcXkRvrwLXtj5NLBCU5XCZLeS6Zl+kpuiPGdBHADutsrv/qcW3YGtV0KBi+R lBqTxOxAVjXiVL+c76Rz7S8zMi/dsAUHYyI6DBVfAiGqkKetRUPruL1/sUo+wDXxamJTIXe6oPQ OoswAnjVTEIedrg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When removing an announced ADD_ADDR, the ID should be marked as available only if it was announced before. Otherwise, local_addr_used will not be decremented when removing the endpoint. That's somehow the behaviour we had from the original patch, before the previous Squash-to patch [1]. Link: https://lore.kernel.org/20240802-mptcp-pm-avail-v6-1-964ba9ce279f@ker= nel.org [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d3b1b459e6f3..0881983f505d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1455,8 +1455,10 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_s= ock *msk, ret =3D remove_anno_list_by_saddr(msk, addr); if (ret || force) { spin_lock_bh(&msk->pm.lock); - __set_bit(addr->id, msk->pm.id_avail_bitmap); - msk->pm.add_addr_signaled -=3D ret; + if (ret) { + __set_bit(addr->id, msk->pm.id_avail_bitmap); + msk->pm.add_addr_signaled--; + } mptcp_pm_remove_addr(msk, &list); spin_unlock_bh(&msk->pm.lock); } --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 734482A1CF for ; Fri, 16 Aug 2024 11:02:10 +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=1723806130; cv=none; b=N4fyF+yN1hBRkuv9J4kq1u35UYre0pObbu4RwUvCcTIEFkLO1ytP2Hfw78w7gNigHx8My+0h1eGguKxVmNqvXKb+39G1lIJ49SRxUKT86qBI4cRuhUk1ku/VMuhZsw8N1jAcrXkBN9M7TE8q8IxdjZc/kb9c8RlHjzCKPkyElD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806130; c=relaxed/simple; bh=PiTzOMgVE1dFUlDrqVvyhkaMMO3fp8l4gkC9UWV1y1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V6UnzpWR7cJG9/yh9X4C+isQqstHyL5HiWy5j+0cGglQmeJR1DSHzbJjet97peMPfNcxXOUd14kQiRBt1Z1eCEkXstS1b+JPzxgqMC3/hZHkDG7boBCYcUPctmBhiW+tFVRlT1y4lJwGliWI399sWYxuPvbb8OqVf3knNDTJAX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pjj+s02p; 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="pjj+s02p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 498CAC32782; Fri, 16 Aug 2024 11:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806130; bh=PiTzOMgVE1dFUlDrqVvyhkaMMO3fp8l4gkC9UWV1y1A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pjj+s02pERy2xI5B23Nl1D5GY/F2H5uja69XCXuH5g8N1Y6e19i8zHVkrsSWvIKUt Yi7xFDTryGcVAgrlgMgK9f2F6+RISrTmREYiEBglXK25EOjxAuUpGQ9ZC4yiyx8jCp cPmJ7j7AtYsl9XJU8WLRTjFQdJa2ZbKqiIOr7Rt9b/Co9/RsyrSu1ibUsd9w83//ye tM5gTzkQLfA+ZPQAFqNhRTXJym/08mCt5DXfgZrJBkeCW/RN+ANuSS2fLPnb4zCOFW gKHPEXdQEb2QQ+FotLmGN/vAzrO2hbqJ4iwDXOCVp6In8i6EgkqbeBGlpR2GOFct17 RWTkAuBhxapcQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:01:56 +0200 Subject: [PATCH mptcp-net v2 02/12] Squash to "selftests: mptcp: join: check removing ID 0 endpoint" 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: <20240816-mptcp-dup-close-evt-v2-2-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2822; i=matttbe@kernel.org; h=from:subject:message-id; bh=PiTzOMgVE1dFUlDrqVvyhkaMMO3fp8l4gkC9UWV1y1A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGutg8LhM0aJY3GYR11J7vOafYBfvfjrvmhK kPSvjjKGl6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c6XnD/9P/iiDyxBaLpUhoKxB4IHSBXz8NlsA6h9JzVHSNXT4rayX2E88EHw64OHaD0YeawxuAEr a6YjglxmRSS5I46y2edjlsBhgLz8tUxiFlarKbIIBRM+aOsLZ5w4kIYvmVC/1xzQeJUbHUwcLOS tB/uKo5FK01JirdnwXcVYDj75IghvDeIa9jkhFY9iWdeh+BK74YLfPcez0JVZmot/EIZnlmx+fE vmpmeETKCRCp4IDBUPUulh51BE2gIXKFOAt1Q48U861obaebv24v8PrmTznsBTg7dLJ3qNAIUe/ YSA4VYr2Mc1gjYDDxIEJnwwaCYhbPkWOIHv51kq/tPVy/AtJK9BYfcQbKFBJ3Ru8bNkBdkNFpmw q/1Z7w6g3pcUQfJx5YU4e27SsZjBFucA2j90gehVOEYVlecCBUJ6P/LP15vQzP0y2Yi+qwj/ucU 4DJu2bYKEoGEg5WT2snUYa7uA/0zQfQ1yxQF29WUiPK9phQSqtQKLJZo4B9BUVQx3hHpDM9DPqL /Swaah/wT7oHK2cyDxqmAMmQoCzk6NIF9F2ke2QHFA+uzt5nLRf1OJMUyLtjH4felyFE9sDrQc8 4AiJOJohw8unl+GuWlQQaZTxR1MB3850nxlzobm/tZXXw7n1lkWBKOE3SDG7B74NL7rf6zhxZLo XyG2JvSeAp8GRaw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The original commit was replacing the recreation of an endpoint used by an additional subflow, by the one used by the initial subflow. Except that it reduced the code coverage, as shown by the previous patch fixing a bug no longer visible with the modification of "selftests: mptcp: join: check removing ID 0 endpoint". Instead of replacing the endpoint 2 by 1, here an additional del/add is done on the endpoint used by the initial subflow. So the two cases are now covered. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/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/testin= g/selftests/net/mptcp/mptcp_join.sh index 77b3a68bd8f7..0494610694df 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3659,36 +3659,46 @@ endpoint_tests() wait_mpj $ns2 pm_nl_check_endpoint "creation" \ $ns2 10.0.2.2 id 2 flags subflow dev ns2eth2 - chk_subflow_nr "before delete" 2 + chk_subflow_nr "before delete id 2" 2 chk_mptcp_info subflows 1 subflows 1 =20 - pm_nl_del_endpoint $ns2 1 10.0.1.2 + pm_nl_del_endpoint $ns2 2 10.0.2.2 sleep 0.5 - chk_subflow_nr "after delete" 1 - chk_mptcp_info subflows 1 subflows 1 + chk_subflow_nr "after delete id 2" 1 + chk_mptcp_info subflows 0 subflows 0 =20 - pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow + pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow wait_mpj $ns2 - chk_subflow_nr "after re-add" 2 - chk_mptcp_info subflows 2 subflows 2 + chk_subflow_nr "after re-add id 2" 2 + chk_mptcp_info subflows 1 subflows 1 =20 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow wait_attempt_fail $ns2 chk_subflow_nr "after new reject" 2 - chk_mptcp_info subflows 2 subflows 2 + chk_mptcp_info subflows 1 subflows 1 =20 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJ= ECT pm_nl_del_endpoint $ns2 3 10.0.3.2 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow wait_mpj $ns2 chk_subflow_nr "after no reject" 3 + chk_mptcp_info subflows 2 subflows 2 + + pm_nl_del_endpoint $ns2 1 10.0.1.2 + sleep 0.5 + chk_subflow_nr "after delete id 0" 2 + chk_mptcp_info subflows 2 subflows 2 # only decr for additional sf + + pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow + wait_mpj $ns2 + chk_subflow_nr "after re-add id 0" 3 chk_mptcp_info subflows 3 subflows 3 =20 mptcp_lib_kill_wait $tests_pid =20 - join_syn_tx=3D4 \ - chk_join_nr 3 3 3 - chk_rm_nr 1 1 + join_syn_tx=3D5 \ + chk_join_nr 4 4 4 + chk_rm_nr 2 2 fi =20 # remove and re-add --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 B0A8A2A1CF for ; Fri, 16 Aug 2024 11:02:11 +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=1723806131; cv=none; b=pMHXp6EJtdPA0x8VsvXKNIk2AS8QFKQWj0oOGdTaedzeN2v+nu5dvR3v85XTyF9UP96fOkiTasiBgklCwJOfGONkMIf15pa1oNSmVKeNkCAqgxwVa7hOsXZ9aIG0EiPor3DxIkgMETswRaHl15y978uvVNUKv2vctqUtDa/yMOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806131; c=relaxed/simple; bh=38yqVkpfYH9uEwxRwherj3Y/AO8wIe7M+kcX2QqNBI8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cctuHfUJfoJqRrKSXuvXtspzvhIqeNhzugBnU9onhvjkN7BKZIVKrW+2GRuaDZt+lyn9KPuZxF/tLv8PIFpCA0IVcWt9ZiXOuffNnW3TaIyS4As72StWTbnL1HzTKoKLnog87crDpWq74kRI7ZApUwZhCNvafAQKs4DV6UjQiQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X/6BcY6y; 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="X/6BcY6y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77FAFC4AF0D; Fri, 16 Aug 2024 11:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806131; bh=38yqVkpfYH9uEwxRwherj3Y/AO8wIe7M+kcX2QqNBI8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X/6BcY6yCP62g/RwRM9G3SfxkhSBhHo5hmxjym2q0lmjcBezktJ2piWR6ZoBFUzzJ 5wPRe8ovVPGJ8Yda0KH86B8n7WohcFTXXdmlpTDHwGa2bCVgIxNSRzgVLUHcXZcl1J p8l3CBbJndAaq3ODhtzGf0CK40QSIRXPxvyqDIgyvIbJ/Jbnn/0juDA+HXybaOEQCF KO6uX1qlRRaqVgrrGcOsfbg5nRXcHjYS2A34tRZSnWABzfBfmtUt9+G/JO1B5ydQcC i3QceOiZJNiyx7EzwziApV6JlQe1eN4RWJ3qs+7/O0Vvqnlmrn2z+YwStDeXweFMci RCKR4gealpF3g== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:01:57 +0200 Subject: [PATCH mptcp-net v2 03/12] Squash to "mptcp: pm: only mark 'subflow' endp as available" 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: <20240816-mptcp-dup-close-evt-v2-3-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1188; i=matttbe@kernel.org; h=from:subject:message-id; bh=38yqVkpfYH9uEwxRwherj3Y/AO8wIe7M+kcX2QqNBI8=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGuWU0xhxmToPKHL0mkc1nUpNV0+TKlq35tu qGGBHKRAqGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c4cBEACDe4jjws0Ok2oxQe9Lca3bqAO6c+4v10pA9P/vV9Tg2A6yL2fRdR8G1JMNfknPxx61h0z JRBl9nBdrwlSIR1K9Bjum2UpIVSnxP5afP8ac1x3nBD+HHYf2otuMpMW8Uu/6T2AGXEsXyvvXKT ULS7MFWLxTyqAICgovAC+ZaOrbD2XzKq7NSpdEJjbTzr6Nyqh8HgSP+RP8HV3XShQIg/JT22RZ9 T6934X/W0HQCf0T4e1s11ks4KM6PE4GOJiIQSRaqwdbm13hf75lICf+PRnFxBMcR7+pkINikGzL savThRw6PLipbRP8b/xKvyfX/86INUkljbSIR/H8KQW8jfgoJWMBGtDmlysLV15AkmJl+5u3j42 ZTnGJxiMq6CnGmG5ip6GJjBQj/RPr4teihmJsv9DdUTKRwrrq+AWCOpg5r7jRjQOXCt7shCOQLO 5nPcBpuS2MakMjY9NuoG+quGbl+ybDslC947GD2nyFmdBc1OQwU55Z1rU7vzMdRVyJ/m6cyqtCB OOSANKgZZBFkUw1dLuZE0km2jqmeoX53jH34uVRjpuzTdhFlaQCNFP4VymDVrFFk6O1vDSeKuAL CCbIyZ7AhF6qvxeov8sZC6xCKFZqRRJwkeWiEPcu1Rk+Sn5bhhLL3T54Qp3Efh1bz5ipdoxtgor /Hml5KiEmeRpXIA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 __mark_subflow_endp_available takes the ID of the subflow, which can be 0, not the one of the entry. If it is 0, the 'local_addr_used' is not decremented as expected. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 0881983f505d..3784eb5e2044 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1510,7 +1510,7 @@ static int mptcp_nl_remove_subflow_and_signal_addr(st= ruct net *net, =20 if (entry->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) { spin_lock_bh(&msk->pm.lock); - __mark_subflow_endp_available(msk, entry->addr.id); + __mark_subflow_endp_available(msk, list.ids[0]); spin_unlock_bh(&msk->pm.lock); } =20 @@ -1954,7 +1954,7 @@ static void mptcp_pm_nl_fullmesh(struct mptcp_sock *m= sk, =20 spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); - __mark_subflow_endp_available(msk, addr->id); + __mark_subflow_endp_available(msk, list.ids[0]); mptcp_pm_create_subflow_or_signal_addr(msk); spin_unlock_bh(&msk->pm.lock); } --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 E2F07817 for ; Fri, 16 Aug 2024 11:02: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=1723806133; cv=none; b=PFdPvJdLur0D+59GEXTJlJJdNAcQ5mBP6+zy3rAkM5n168kgH4zDEcAFMtOLNtD8JhBDwoEaACSWkUb/8IPimFY7ePA8IjbdpAF4uGfgrRWvwkdEeG7dSnpB3XI3/WcuB84oKkZJEZtu6EFcEcrcYxIQuzOLWrfXhATReAxR6x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806133; c=relaxed/simple; bh=1yncGT3b55dm+a3Yu88dvG3n/OFXQHesEWhO1+HNfT4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ol+oUZLh7LhgiplRzJIDlEdFgNeEC7gMgmDGMBJJI2M1anRaV+ZFhWFE1EldA5hEO/6TNuERZfsIltK4ghe+Ukj1s5M/zyCN43jdKtqKR5lOcGqRGiJwSUvHZBmIcqBIzohvnCqBnqa+Pm41unZwThjGXGzJpNVGEQqFNUIGPAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I9VRNxmx; 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="I9VRNxmx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C76C32782; Fri, 16 Aug 2024 11:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806132; bh=1yncGT3b55dm+a3Yu88dvG3n/OFXQHesEWhO1+HNfT4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I9VRNxmxn+jFjiFAQbTkPKTu/WSUATNvjs+0bmxlbT5M4SBzFSfMVv1OsIbyw2F9f WFwUuk8GYJeHCEf3OiV/SqZqFU42j9U3GpgaG/4qhTR3gyKvmr2gn6IwzzJDNwEUUv 9k25ApTeRWKJav71qATWn4zVhEx4I0qDtGx9q1kPAQDiw5W2KFxjQsquJ8kDUxDv1T TCz8JFq+tN3gfu2HKR4QCcaLphggvpeR9bNn2uBccc6mQXtY7nYW7Yoz0H5blamZJo QdswWwritmzl42rpTaKc3t/eeqWIV/4V0PyDYX2J1oYAVzxpMaDgL/UAlpvTCCu8jS D+WyT7zfwoUFg== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:01:58 +0200 Subject: [PATCH mptcp-net v2 04/12] Squash to "mptcp: pm: reuse ID 0 after delete and re-add" 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: <20240816-mptcp-dup-close-evt-v2-4-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1266; i=matttbe@kernel.org; h=from:subject:message-id; bh=1yncGT3b55dm+a3Yu88dvG3n/OFXQHesEWhO1+HNfT4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGux3lMFE0rporNgkmfAdvlsMM4Lrwwu63E1 NDM3vKAVQyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c7rzD/9n4aRqKfNBRq44ZXGwlOdkum0NuZb5mbaiVImMrBwRvAMvFMMH/lg2waNEx/ULg26zwHh jctm6Z2P8Bw4PZbvGRyHGolFq1Ts2wue3WOQ9XgJ9owzppq5tl5EMMUwS0/i/MiZC50DkJzoH7E Jb+vu7r/UT5xdcEEwzOl1yGDmZvLL0D/8DnI/q9pEZTx5svkRhifIT0HVyH9seFHsDMMLITAG+N rtufUoB3u/cgSA4OU78+gwmB4H7uXqsOqCnZb6IQks7BqGE/upU+DeJ1l12YF1NYpLKAXezoo5x rBX3tTbxRrhHhTlTHEBt8halrMMZZj908GVLwFjvuSXxE+IfimfoiZFkMYhi6eK7gXpHxBSNDNA BQmiy4m99hdJDZJPf+5FM0drHcWhC8IQSSHAOiswtG8WgyeO/4M/iI9aguDlUZzEICU8pgaWcL1 s7czOBNtdZ5wbstm44/9iRI97IBbenV01EUCuD1+rjbKd6qq96Pcy7gjDlMT8L4IRZy1ix3/WC/ ljygSaeWNQj6UY/lkW4bNRto6kTRkCzWPw9BB6jWQl+KDklRJi8H2AdZJ0muElarrXN3O+FNkKN cjauEQRt+/bF3gi6tasqWRkpORgOtVK9dlYVhHePqjQ5I8Cc5NRcq7ZGwpwaGJkoGXiTDSK2KTo sSlwTAkYsPG95UA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Set the address ID to 0 before calling fill_remote_addresses_vec(): for fullmesh cases, a bitmap will be created after having looked at all subflow IDs matching the local one. The ID visible on the wire (e.g. 0) should be compared to, not the one of the global endpoint (cannot be 0). Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 3784eb5e2044..eba3c0e2ec0d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -621,14 +621,15 @@ static void mptcp_pm_create_subflow_or_signal_addr(st= ruct mptcp_sock *msk) =20 msk->pm.local_addr_used++; __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); - nr =3D fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs); - if (nr =3D=3D 0) - continue; =20 /* Special case for ID0: set the correct ID */ if (local.addr.id =3D=3D msk->mpc_endpoint_id) local.addr.id =3D 0; =20 + nr =3D fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs); + if (nr =3D=3D 0) + continue; + spin_unlock_bh(&msk->pm.lock); for (i =3D 0; i < nr; i++) __mptcp_subflow_connect(sk, &local, &addrs[i]); --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 A867A817 for ; Fri, 16 Aug 2024 11:02: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=1723806133; cv=none; b=Dy5+Z/aqc9ILq4QGCFCLiM/paUsLRMYaOKCDUtojBV/PVf53L8wj+k1+WuG5l5Krt3V7iJ8xTRlkXgz9xOA0NVXVrLzeCrGVisyc0koLPA+LmwMh39TVABQAiwwLANl/xaT2OFMGXrN8fx+2hsxZb3VRwVtWjFaweuayKANJWMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806133; c=relaxed/simple; bh=j0pfLB7wl00D0tpnM/81lnE2CgU2ZnxPd+PBvTXvUXY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lMvLSVb6iADZxVggfRu4jG6YXmwuOVfLmZ7UvRdqTXCqiKAYIXNRpcqu6Y555zpdAhOmNOJKSXsxl9hCHfdGigVxhjxS4Nj3UNSOAPmLCea/ZIiRzsaCrv/4qnsR/EpwpgXneJDc6tbxWTkxzsa3AKisFtmGttxeDYJa+XEiDTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hQqiFwfi; 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="hQqiFwfi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEAC1C4AF09; Fri, 16 Aug 2024 11:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806133; bh=j0pfLB7wl00D0tpnM/81lnE2CgU2ZnxPd+PBvTXvUXY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hQqiFwfi0uO9VFQ46s4xzKnqciFEIEPjizssoOoNna8wixpPJ/7gDKl47Y0F7r7wI m+OiHvUC0Cvy3e4MNghv5VDDZijS4VNx32bKLjxpU2Q9y2OfpOgXNWmxYWfpDwFrR2 pYyXZKKBTd3tS2umTy3T9jLNe3YaFZC7XxGdhbhrlxQqW5HzdfncI6Izwmnrwe6LZt 9ZJgujt8aUpjhsNq1Wska7o3wcfqUWwkna0/36XQs0ZSPdV1mX8qNhkPpp19OVvwKv BDJOG7Zy3B47FPL5lSBK00lSgaIBK4Zbz/U6UJCYs73pMvRr/iY5frkzx1+rLeS4Od k7Up1WxmZB7gQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:01:59 +0200 Subject: [PATCH mptcp-net v2 05/12] Squash to "mptcp: pm: fix RM_ADDR ID for the initial subflow" 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: <20240816-mptcp-dup-close-evt-v2-5-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=951; i=matttbe@kernel.org; h=from:subject:message-id; bh=j0pfLB7wl00D0tpnM/81lnE2CgU2ZnxPd+PBvTXvUXY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGuYHLGh9cUKq4KCWFQiGeO91GqYHrec0yZ8 M6XyOAtfguJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c4WiD/wLKu7L7DSuhZJPxmrNFP7mi2mUyXANOADX8XP9qJaoJIeOtCZP+WEd1J8ju5TxhIFZd/Y OiusF0Nla0Vwt7tIQaAPxdKawq1aokKgV+4U9R8cPgYj6WD1F2mpkjgMTVEvqB7oS99uOpnA09p bD9lS4v16Ru8gv1i0XWOnSvrueWswa5i2tn2mVelWtnH3Hejp+0guv/OsFqJgWLjhMCPclxs8KO +dNk6nWWBmqbJ+vGuwJZ7/LEyU5OYQ0iUQs8LMsxQsHD+xecX5wOz7BHKvzVrMoW6ZA6tBUJtTT LHUOMGVwSu/j6VKT9alqUyViZBEMiT+f3tUfjivjIo2qa4eHqgQgtRDYTkuCTukfANgdqig8zpU 6vXcFlGf4DGwimlo5X2M0hG0nQqPGHeR10KRtQtDsaJgjANL0z8t+JRIdHg3zE8m+m1Bpf9kFlI 5YfrU+laHtQ2Yq+MKEcSFiiKiG2RuESSK5Efr2ad3F33Yb1bNRrMLksAHcQtY7Url0652d/oHN3 fcmO4naMQlgzfyrVIz6neHbi3AoTbCmy9KPUty9l163V5+hwBcRDTI/fcSonfbRn6H09BKgRk8W vtyeYNpv7F/s1SmnM+ewyOdPHuk+OA8+hba5NSaAwCb7UW+Grzx6ThMSDr19TSwTqBpkArqPaIb ANwdC7GbBLL47dg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 To be used with __mark_subflow_endp_available() below: the ID should be the one of the subflow -- can be 0 -- not the one of the entry -- cannot be 0. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index eba3c0e2ec0d..b7173163c238 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1501,9 +1501,8 @@ static int mptcp_nl_remove_subflow_and_signal_addr(st= ruct net *net, mptcp_pm_remove_anno_addr(msk, addr, remove_subflow && !(entry->flags & MPTCP_PM_ADDR_FLAG_IMPLICIT)); =20 + list.ids[0] =3D mptcp_endp_get_local_id(msk, addr); if (remove_subflow) { - list.ids[0] =3D mptcp_endp_get_local_id(msk, addr); - spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); spin_unlock_bh(&msk->pm.lock); --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 34D29817 for ; Fri, 16 Aug 2024 11:02: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=1723806135; cv=none; b=D1qV1YAEBOHgIi/po2J6ECVCmzlpsjJ1JFOSzFRO5DvIK+wMMmVFuoc7Aul3xn34Ommww2BebyFbWbeizvWmOY9fGlOsJwsOKkDRUho/9zQkTvhMwcws4RzH99ZTBvnXORwgMPg3wBjbTkSHj0Q4K3fKa+wcHnkvtfmGUh774O4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806135; c=relaxed/simple; bh=TC7chJwOcBTrnOT0qXNaq/v7DhIU3BJFVEsML5a1Aaw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H8LKW2O/gDY1K6s0XB2eeEXMDKxslFXLQ9kk7vXwCHfVfg9L9mEq498+8eYdyYDa/4Q6O/Nc0XPig+oty3hHbjhIw6snoeMIXxNfK9SOhW7xky7HBz1utdJondMbSyc3A2/0/1aRb2151R/DZYe5RCM3Y0JZ3D1cFBshJMxrbBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W4amJU6Z; 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="W4amJU6Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 055F6C4AF09; Fri, 16 Aug 2024 11:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806134; bh=TC7chJwOcBTrnOT0qXNaq/v7DhIU3BJFVEsML5a1Aaw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=W4amJU6ZurdJUL1DSGNjcWYwO8yZ8uIZiqNL9S6OYgrXtIBU8QajOtJAiRf2ECBvJ j3NWeBt4N6oKcb3IfbAsbO/Ultr1dDBif4Sr3yHgCvZtIMXoCk2Q7tCdNjR2OMTeoc rLvSWNYoFokO/8/Y3ZnXar0pSlGXTf80gFPSyrSz7ipJOALG4FLYLLuMWRZI19rx+j /9yOBqGouoVrCwIIihWPafYbKeF6GfnSirxpOrDYjGre/cSqyrVwpFWkTk3MKUkq6m 0Vadd4b+J7Vlo3hY94xw8mjQX38u5I0hqNNU+RJS5uCBANoAPUkUtUXYO4sRSJcWWf UWshBXagVn6zg== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:00 +0200 Subject: [PATCH mptcp-net v2 06/12] mptcp: pm: do not remove already closed subflows 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: <20240816-mptcp-dup-close-evt-v2-6-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=967; i=matttbe@kernel.org; h=from:subject:message-id; bh=TC7chJwOcBTrnOT0qXNaq/v7DhIU3BJFVEsML5a1Aaw=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGumX7z+Rfj3BAoZSnHjysH1klV9rKn2ewTh c84asGlmUOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c+b1D/4407KVgyoVDqf820q3RZx1Znwy2OTA+iPTUaJrlhX2WRIutAK7Fqm7uSR+8gqZFYJsQZ6 0pFN29q+rMQZmmTJI6zgNjYVopEpsVkmCEEXMvT2OnzEnSZsVaKKb5Jq9lLoL/y8l6eiEaxBb96 4ia3NMepSYbdnRISd2kW9Oy/T22Yj+TWOms5ixeVNfVVaheElJnxwgm4dTWanBLYSyrLO+eLoWT ZhLefXAyAWosjyf2DUHz74Ys6XTeuerGDoWUKX8ZDuzY+OgQ1IbVlM9eYdXiE9jQgKV2eexlLZq bLQLojAD7/sOGMfJ9cCQd5UcARML5nw8XKStTCn1JXhLJqLUlyDfC74VbJ4CmNNMRPeYZ1zt5k6 EOSi1uxNEHkuziaLcDIQvQ58wzCVQXcCha+2cUNKyofb4hIqbRGmeG3VHoO+VISv/8tP1BR4fVU OTG2+EwPca9vhLHdxHWbUa/4YnumqJzQYVLqdJIaw0ZvWGz8dD1PHA/XB8lgz5xBiWsMJR1N8re jDpoafEWuAs0GqWikMDZLXzQiJHGCBz2R8k4hhhLMHxRoqFCfE/ddLDCWtXRf5KDK6mOLlhFXtC l/94u0z6XAXOOIL2TcRij+a95bi8uIddhM5AlyE5ZF0CIomNdMiDumGylvIjnggmE/aA0p9SBLR ijY2oN1gOPruhRA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It is possible to have in the list already closed subflows, e.g. the initial subflow has been already closed, but still in the list. No need to try to close it again, and increments the related counters again. Fixes: 0ee4261a3681 ("mptcp: implement mptcp_pm_remove_subflow") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index b7173163c238..952982ebac17 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -842,6 +842,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, int how =3D RCV_SHUTDOWN | SEND_SHUTDOWN; u8 id =3D subflow_get_local_id(subflow); =20 + if (inet_sk_state_load(ssk) =3D=3D TCP_CLOSE) + continue; if (rm_type =3D=3D MPTCP_MIB_RMADDR && remote_id !=3D rm_id) continue; if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW && id !=3D rm_id) --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 0D109817 for ; Fri, 16 Aug 2024 11:02: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=1723806136; cv=none; b=j1K4ZikuQJ1mkYmne+LafoNDjvZPA4i+4x64AKO1nTtTbSJW22ouM1fNfqvVLlxR7fNMi10AZPL175YPuUQU22ZhqXakxrDXj60S5iuoSkbP4VytBeE8RmxN17aQmocnTriL0NiKUi20P5IItzgZqVMA098jLJ2kMjNXc9BrHoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806136; c=relaxed/simple; bh=LTGbYf9O9GRqZOAxsvgV9QVTfJsxb96kEGOsOcJ1EeY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u+rjT/D33e2rP2xRhkFMEPG5US29DSwtQEMx1EF84RqdUQD0Z5yo9msWNJ/GVu2WKbaZQrQFsBf3+XX0tkk2CawczSIEO9gK+TB4J6stB+F8ZEdKsJRy3iDla3MarL9nB//s6goS32I8ZoQfNKkAIs/ATvtHpqx+1WeYHUJSkCc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XyG/zCub; 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="XyG/zCub" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 306C1C32782; Fri, 16 Aug 2024 11:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806135; bh=LTGbYf9O9GRqZOAxsvgV9QVTfJsxb96kEGOsOcJ1EeY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XyG/zCubQnUUdQ+cKbvA8wJUgUee6tS4m2M4FqmXIaLoWF+Aaf/pr4wV2W4G8OU24 +z/ac54DLpfB9G4ANAfdjY/otczJqS4f7E0Qzct6MOW9wS8/kiH+qfUsAPvotC76am zEsjuhPM3MMk5q1ajbYiPAEMDCQVKT/sTVUqcR4Vnv8xEeFe7bb2NS9pGlldCojplY KkrED9V3KYJ7R3oNKjkivRZUbWy4VfO1vsX1hFGdP3IpH4pCf7NIQVHcvzHvGjMTR/ Uo8pFGgarcCoaOiPJoV+Wop0WSEieDQN6ViPpIiN+MskN4khfFKTSHFfNlpJk7HeqK 2Mrp5uXHzOSmA== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:01 +0200 Subject: [PATCH mptcp-net v2 07/12] mptcp: pm: fix ID 0 endp usage after multiple re-creations 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: <20240816-mptcp-dup-close-evt-v2-7-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2038; i=matttbe@kernel.org; h=from:subject:message-id; bh=LTGbYf9O9GRqZOAxsvgV9QVTfJsxb96kEGOsOcJ1EeY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGuNYEY3tVSjCAhcl7e4opT/v9ORM5aWXAr4 YnQAoe2PAGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c6KLEADEX10VWGT4nXxqF059nILmcsuOWB8B0E7yzMonFgat+4q0ujXLFDNOY84uQmWslVn7/kM e3i/3Ve/WBOTzAbyFWTceIG5bfw/AetDi5fmFPlx5sLtxGUM/w781eJ7VnGRFyQWwzBOWo+CKL8 ewPv1VCLPrw51GxAurlMKVDgtXSOmCCqo9Ba7MeziXe+rVzLFj9Oth37UVbZvny5qPXLugIGf+G X62O4oCI8HICV7RLE1BkZLstxqY2sWJQxB1MVGQK7klGnut9U8oTnTf/pyoE+i1LsSLIaRshZSi TgfaAZXvNMS4oXRALAMSkDFi/RPTJ+4fsAcHK5ZpTazjN9LvqPreNbPnODNmvF/H4QEe+1pDHJh ebKfSuYK2rSPKpHJQghWDDpVWpm8jHCyztOaqXJh1+HxnHZChdb16MWoKR43oaa9Bih7BMoEd+L ug6TK5vhKMAsUcgzTTGKY4P9YL5z06LM4SlSfpGo0NClFeQR2is2Ken8SM+pThokG1tvfPm1XNX pK8lGlIr4anU8CLvMMD0g6kDY+XcX23eaAaFfAyalzziIuqCIjNqpnUYlczofo0JFWCqJRtbq/9 8lbGMN3Ik0DtS7qARyBPAv1k/8Y6NBgMM/RtqrOSOUtclUHLt8GRaxMEAOZn2Mzi7ZvnpbkyojI wbdSfLZ2Th0muXA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 'local_addr_used' and 'add_addr_accepted' are decremented for addresses not related to the initial subflow (ID0), because the source and destination addresses of the initial subflows are known from the beginning: they don't count as "additional local address being used" or "ADD_ADDR being accepted". It is then required not to increment them when the entrypoint used by the initial subflow is removed and re-added during a connection. Without this modification, this entrypoint cannot be removed and re-added more than once. Reported-by: Ar=C4=B1n=C3=A7 =C3=9CNAL Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/512 Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Tested-by: Ar=C4=B1n=C3=A7 =C3=9CNAL --- net/mptcp/pm_netlink.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 952982ebac17..6a05eacd59b3 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -619,12 +619,13 @@ static void mptcp_pm_create_subflow_or_signal_addr(st= ruct mptcp_sock *msk) =20 fullmesh =3D !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH); =20 - msk->pm.local_addr_used++; __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); =20 /* Special case for ID0: set the correct ID */ if (local.addr.id =3D=3D msk->mpc_endpoint_id) local.addr.id =3D 0; + else /* local_addr_used is not decr for ID 0 */ + msk->pm.local_addr_used++; =20 nr =3D fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs); if (nr =3D=3D 0) @@ -754,7 +755,9 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_= sock *msk) spin_lock_bh(&msk->pm.lock); =20 if (sf_created) { - msk->pm.add_addr_accepted++; + /* add_addr_accepted is not decr for ID 0 */ + if (remote.id) + msk->pm.add_addr_accepted++; if (msk->pm.add_addr_accepted >=3D add_addr_accept_max || msk->pm.subflows >=3D subflows_max) WRITE_ONCE(msk->pm.accept_addr, false); --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 89EB1817 for ; Fri, 16 Aug 2024 11:02: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=1723806137; cv=none; b=uBzCv5Ivecc0jdkATfKawe+6o4OP7bwPTuC/92RtDmFsN6OnWN/1LpqzlTtfvggaGUfxbjYbyN78pITXq8JUrDW7aLGzQXEWK6Z2WpfGYGVbmgYr+HBG8YvOgCY2L0JjK53eNeFCjKkv3smtnZhnUAMQDRhgJ9SYfwQ8LsAo2Ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806137; c=relaxed/simple; bh=/Lx0fUCqoVVYQ7bsrG3kIZ6PEYhnhTU5aspq/nEkXPA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lrrGX7s8F7hyKIOGOeSxhlyFSDAeAFic7qz6X0+uEeIcABDbZq+0L8+U0Lo7KEZv3YQp2ubrTyoClPQKNKT482a6mrayAsbfcMAQVHIy/Dox9GJ6ad8361eB3+I2Xtq+fZ5w8FXy0MYc0Qidtdt2JDbGt5GJuVTUssDl/eDeNl0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sVxswA2c; 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="sVxswA2c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BF9FC4AF09; Fri, 16 Aug 2024 11:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806137; bh=/Lx0fUCqoVVYQ7bsrG3kIZ6PEYhnhTU5aspq/nEkXPA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sVxswA2c0ReAGuxWqde4Gzo1l901EYxpOxnZKL1S/zZQxvPP94ahKw3yDFqXRs5VZ CydcUGmyNbL/MKqXBeMZfAANKCB0hsjTrvsbif0vcccDhlyGk66JjXSe17/1+3rWk7 73+qgojPQ3iQJnrgR+71oBHP7stgmUOq0LpMWdU4BUeorfy2sxhohtV6gBMtBf+H6c gXol4hU15ZKdbvxDzSSeDCD6CAfgQ2t9cRyH88aiLidE5XJ/psBfxoGWDAOmyyJyGi I9tvVdge0Vi9/Milt2Hax1mUscYwE9bVHW6Uq0I0ZmoCrUyMNbfwovqd/7/8dd5vZ6 Y2eCau3IU33vw== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:02 +0200 Subject: [PATCH mptcp-net v2 08/12] selftests: mptcp: join: check re-re-adding ID 0 endp 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: <20240816-mptcp-dup-close-evt-v2-8-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2276; i=matttbe@kernel.org; h=from:subject:message-id; bh=/Lx0fUCqoVVYQ7bsrG3kIZ6PEYhnhTU5aspq/nEkXPA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGuSqXS2/jgjeQLNCW4hbgU4ZvYjsyCFMYFO UEr23hggW6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c1ItEACcAph4MmrKkxxaoqXz4x6yScJkeSYiVDSdZMjRQWYMQSW8123PIH0lmWHLCKRog6QLaau IhvyYpIRB6/DH/w3be5p/EFJgflu+2lMmXsi+OuofUDdNhtXnaSEfp42TXeiOIYK/HhS8Fzvpmc YJchhGWfFk9aMB/1nJuc8Go3yI6V0IW7E4EpfzdMO8OyssNQXv3pOYEOJPJ3vpVZV19fWi1Rg8e bWGLINA33L4iKVNeMLPdO7v76G8qgLFLAIFQDzAI0WGtvbbdKMTTRs9PU7i5VTAPBMpl1C0BU4g Q7EIH134mn6ppU7KuoOGJIIioL4S2wIc3LjYi731i2Ywi9Cy6G8PQFfaKiu0b5EOqaf3pYI3i0/ Zvw+CHwXfgTD8QOZLjooI8M/ECNpxK5IO4LOuwVxbP521fdAmoAtXGvzxvYiegpx3sdk9A4/duy VfQjWQUWBZh8JwO6h5Vi5TqSaEWXpWOmtOisIAk/oFS4TcDhsiGOY36nMgsuOHqNwVzSf7qkjPT w51PlkrWwVNjDp/2h7PuMwuPBCi7uE3KrJT/6unYSw5slsFguAxJWWi1d4KlYXEDJXyataKjDWF KJPT0QowfYOW6TbqA/FVJi6F6z6wnD5coaHOpfEF2Pts1KnBL+UJdbnM2QeAR3KkU5xogcCG80Y ahSYj/5ZzKtSHVg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This test extends "delete and re-add" to validate the previous commit: when the endpoint linked to the initial subflow (ID 0) is re-added multiple times, it was no longer being used, because the internal linked counters are not decremented for this special endpoint: it is not an additional endpoint. Here, the "del/add id 0" steps are done 3 times to unsure this case is validated. 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: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- v2: - Re-create the ID 0 endpoint 3 times, in a loop --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++++++-------= ---- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 0494610694df..7867a6ab0646 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3684,21 +3684,24 @@ endpoint_tests() chk_subflow_nr "after no reject" 3 chk_mptcp_info subflows 2 subflows 2 =20 - pm_nl_del_endpoint $ns2 1 10.0.1.2 - sleep 0.5 - chk_subflow_nr "after delete id 0" 2 - chk_mptcp_info subflows 2 subflows 2 # only decr for additional sf + local i + for i in $(seq 3); do + pm_nl_del_endpoint $ns2 1 10.0.1.2 + sleep 0.5 + chk_subflow_nr "after delete id 0 ($i)" 2 + chk_mptcp_info subflows 2 subflows 2 # only decr for additional sf =20 - pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow - wait_mpj $ns2 - chk_subflow_nr "after re-add id 0" 3 - chk_mptcp_info subflows 3 subflows 3 + pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow + wait_mpj $ns2 + chk_subflow_nr "after re-add id 0 ($i)" 3 + chk_mptcp_info subflows 3 subflows 3 + done =20 mptcp_lib_kill_wait $tests_pid =20 - join_syn_tx=3D5 \ - chk_join_nr 4 4 4 - chk_rm_nr 2 2 + join_syn_tx=3D7 \ + chk_join_nr 6 6 6 + chk_rm_nr 4 4 fi =20 # remove and re-add --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 7B11D817 for ; Fri, 16 Aug 2024 11:02:18 +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=1723806138; cv=none; b=CQsIjRuqWszbp3I3BsZAFJ9ddP6nXLK4rf86qaUEZpuhYcvSuJ6nUf3xmmBySwpuFCJNHX8OGt/V3d5RZysg6YFwkkgNIKmp7FzvcXugB8CNtTGeXWNo7b7BO/T7eDyxlxOToHd46pN7X1W+RyCZQSvPypmuGyjtLWVkSlhxC6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806138; c=relaxed/simple; bh=X3kingAe+MIqD04vcc6XOI2en1Bn6QN9uOtcfEzO/lM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EO8Ug5SGdF0McBWtSI2dw6Z+eLo5yMmeutjEeHhpDbRyntUNE71EEqzz1v0n2MOKyMCsLFn6az95hlqhwuoXlw8JCYwUElA2kwdyhiAkrnNlDVw+cHwOhegED0SDVhrt7HPISNBQjkrf5Krl3GD6NCPcOwdwrBW/+B+c6CockBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D6usHlgE; 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="D6usHlgE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D5B7C4AF0C; Fri, 16 Aug 2024 11:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806138; bh=X3kingAe+MIqD04vcc6XOI2en1Bn6QN9uOtcfEzO/lM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=D6usHlgE5iIdT8alWH16dzOfbygJLHrWu06buf6AUmo96T/JXrGmLTHnGwClDt67I 8ZR+tAvdf5WB8v/ypUNJWq/i/ZUXPKnlj9Gry+cx63Vh+qBWuZAhv62CuRYByrhXLz lNV4WOcFCbzMxE2R5K/JYEChBTDhZjgOL+K3QHbt639VKhAt6/Bs22mkAAf0GwHw1t whGtOI+YuQ0YlI16o6CCy6JI0jwtbgXzwO/Vnp9qPEZpJa/rAwB1tvoGxzG2KHcfoI 8v8BDcd7To+7/YOIxud7Uo5+jg9620aiiGLggCIo738UZXnX3c+3ZJuBqCKAncHLem eKL3p7QtBzJEg== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:03 +0200 Subject: [PATCH mptcp-net v2 09/12] mptcp: avoid duplicated SUB_CLOSED 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: <20240816-mptcp-dup-close-evt-v2-9-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2613; i=matttbe@kernel.org; h=from:subject:message-id; bh=X3kingAe+MIqD04vcc6XOI2en1Bn6QN9uOtcfEzO/lM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGufM6qW/Q09ycZs8XdXxhIsTuB1VxBKBXwY aY3WhsraxSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c90NEACKJf41vlofx2gPegLrBHU03y4QA048B66j7Kx625ClHoOCNSAj1XXEMEoBoyoCcjUxNTj PG/LDVQq3fV6R2v2jHSXesj8jwOUsZ/gCn3mPn3hmnyxxxb9tIH71vRlV3JhB+qUvTztkB0RcjR M+XFJqN63kTCnLRkEWLzteBT0MSU5kabrXN5CJbG929FqQMiN69aE2A6sYC4FBR0DuZFBOoip91 lmjvEadFr9BNCG0aWJ3DQG/tu6FEKzbld9eZRpWFPcRIrCUAbrdjCTPHU1WpxBInuyK0OuUNryR LDX7YYuRM96Qi7EKnmPeZHya6lr4zbzaPUSTpW2Txsna1A/hL78xzredPa0PPXp5JAN3zW15g7u nea8kznedtexUQdQFM6AECN4qdJN4cAZXwA3Lz3/FIlOo7tk/zJRpKvVeIzgJKrF9sG+beM6A13 mFmkj/m4KjVPeS6GxUGKDHTBh2477we43hY65am8NxJ2R2X6Z6l46oHUhKrDkDZvi+d0ejlxvVv sPTewaZjeFHyKMIoEJ5112cPschI6y/HkccY899mUYEpwyR87UUMSd4W2SVSz4ZANyVaUpI2gXt l+PWo16zkoJzJSxPKZGEoDk7eDh6SblxRrI6fBG6/U4TmzOj2hSLO7METQKimQ+I7CdjlF+Jqos ws0VI3vVmtNb6qA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow might have already been closed, but still in the connection list. When the worker is instructed to close the subflows that have been marked as closed, it might then try to close the initial subflow again. A consequence of that is that the SUB_CLOSED event can be seen twice: # ip mptcp endpoint 1.1.1.1 id 1 subflow dev eth0 2.2.2.2 id 2 subflow dev eth1 # ip mptcp monitor & [ CREATED] remid=3D0 locid=3D0 saddr4=3D1.1.1.1 daddr4=3D9.9.9.9 [ ESTABLISHED] remid=3D0 locid=3D0 saddr4=3D1.1.1.1 daddr4=3D9.9.9.9 [ SF_ESTABLISHED] remid=3D0 locid=3D2 saddr4=3D2.2.2.2 daddr4=3D9.9.9.9 # ip mptcp endpoint delete id 1 [ SF_CLOSED] remid=3D0 locid=3D0 saddr4=3D1.1.1.1 daddr4=3D9.9.9.9 [ SF_CLOSED] remid=3D0 locid=3D0 saddr4=3D1.1.1.1 daddr4=3D9.9.9.9 The first one is coming from mptcp_pm_nl_rm_subflow_received(), and the second one from __mptcp_close_subflow(). To avoid doing the post-closed processing twice, the subflow is now marked as closed the first time. Note that it is not enough to check if we are dealing with the first subflow and check its sk_state: the subflow might have been reset or closed before calling mptcp_close_ssk(). Fixes: b911c97c7dc7 ("mptcp: add netlink event support") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Tested-by: Ar=C4=B1n=C3=A7 =C3=9CNAL --- net/mptcp/protocol.c | 6 ++++++ net/mptcp/protocol.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 13777c35496c..9d6ef94ca6ee 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2508,6 +2508,12 @@ static void __mptcp_close_ssk(struct sock *sk, struc= t sock *ssk, void mptcp_close_ssk(struct sock *sk, struct sock *ssk, struct mptcp_subflow_context *subflow) { + /* The first subflow can already be closed and still in the list */ + if (subflow->closed) + return; + + subflow->closed =3D true; + if (sk->sk_state =3D=3D TCP_ESTABLISHED) mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); =20 diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 22b7eff311f5..ce15e7db464b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -530,7 +530,8 @@ struct mptcp_subflow_context { stale : 1, /* unable to snd/rcv data, do not use for xmit */ valid_csum_seen : 1, /* at least one csum validated */ is_mptfo : 1, /* subflow is doing TFO */ - __unused : 10; + closed : 1, /* has done the post-closed part */ + __unused : 9; bool data_avail; bool scheduled; u32 remote_nonce; --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 9643B817 for ; Fri, 16 Aug 2024 11:02:19 +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=1723806139; cv=none; b=TdwWW1P6z1/QsKxxuH/velgcJxHAtf/wkyfGXQ1RmjNuOI+/J3iE8xDhgq/sdVQ709cqM16aIYlkbv/EX2YS+QnuSUfnYYm5UI+v4OqNPnATyt/81dcCkkYzEm6KSlbIeQmULdYiEF3Ms4uc0TDv7EW4nHtzd/ykD6Q7Ogxoofw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806139; c=relaxed/simple; bh=Gsv8saBvVoXQjvt4mfoKiWBdgMPE/cnw10fq5Td6f7g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OMGAQijXy3DCNorwLckPNqftYhxsydlxpZ7iWOKzYb7j8LU4DVAwBGa+cCnxHQ6Jpv7UuBI0dkgFlJ6rnEUDmorSZaOcrRvW6piX8lBOF2fEwftJJpn40dO3ESM8twg1f50E/eFd6jzZ6fRBYUb2op1fSrZ3J6mIxLz7O/3IZbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PXA6AinZ; 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="PXA6AinZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9E8BC32782; Fri, 16 Aug 2024 11:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806139; bh=Gsv8saBvVoXQjvt4mfoKiWBdgMPE/cnw10fq5Td6f7g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PXA6AinZhCabRcvWFa7ublcAFaYLhx1ExsAeNiagtkXOJ6IOejn/Fs/VJKAlB3oy9 LjrJdAwr82d5yLKNPZ4ZquZIJVTj+3aDttt9OCodUQCh9V2LDa8oZTEJRQXD48yFNt Bme4ol7Tl3+lFdetuQTq/HHyD5BRKsA5gSs5vV1zNSOhpVQfbQX7f2KN5kVo2AjNSX 7tCmzI87ZIkakGrl384Zm94itg91eBRospZ/zR2dDEpBrQiTCqSFPbfFRGVbJQFIfP mM27+3Q9RsixFzLofaLKW+wdBp9icq2FlttuyAiD2fnDpyZuJDHz4w69FxUHFsOVsB t4jJzJPNAXE2g== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:04 +0200 Subject: [PATCH mptcp-net v2 10/12] selftests: mptcp: join: validate event numbers 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: <20240816-mptcp-dup-close-evt-v2-10-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5800; i=matttbe@kernel.org; h=from:subject:message-id; bh=Gsv8saBvVoXQjvt4mfoKiWBdgMPE/cnw10fq5Td6f7g=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGuI6n6HmsdROE4qJ/8epKNJdBIXcrg0ld5T 3PSu6SY/TmJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c8XBEADnO9VQ6HEUPvagu2zKrp7MKRMy3L4P69n8jo1fFIkW2G+P1QERMPCHCqJK3q+JD+yWZ2s 35a++t7ptDPjtwwBP2dwX6/QSOTr7neniLC1vGi8ph7N3HozreDRNnxoeMF0G8gthucOF75mrbO FxLZZyRcCoXdjPY7BtpCAu+nc3dKFfC8LqK6mOYys2czzOC9o1E5PdGz53iZV04h8q6VtMxPVTh tu2N9iChMTC3qTrGu30v3OTxeapoUm2nS6+gjgbJQt3NfyT4loyKGQjwS47X4OLJmR80ioMf2Mu tKC8+7/AB9xc04kxorz/komjmwGdh4J76/wv6N4LN8DnNJsq+dPu/LSG05HWR3x4fAlTQ8EQ+L+ O6upeunsSC1B1+ulke03F5HlpkNz4y7ekXPYBgn6hOn7GQUkVqEomJtHMYnQJ7/VWMCTIC7Er7+ F05x1vVWXMnwVObb7G8hNyif4IXLi35MmzJiWsjPGLF/AO/upx65aEG0qXq3tVgNTq3bj94a9L7 I+EoO1bgWNLH7ptujzGuT4d6qkVvxjOJ+c0RFkVSSUub88SADJmDZkRmmy7DkDug0NgrKSWJGlK XD1RJE4S2TXqK9UUK0Y4aPIHoo832j+MAfiWsmdfqYUampPTivXYvXG1XEIAz+teumc0x+XLPYQ zCIRoTBdxpuX1lA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 74 +++++++++++++++++++++= +++- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++ 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 7867a6ab0646..56557a7e488a 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -446,12 +446,17 @@ reset_with_fail() fi } =20 +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 =20 - mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid - mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid + start_events } =20 reset_with_tcp_filter() @@ -3406,6 +3411,36 @@ userspace_pm_chk_get_addr() fi } =20 +# $1: ns ; $2: event type ; $3: count +chk_evt_nr() +{ + local ns=3D${1} + local evt_name=3D"${2}" + local exp=3D"${3}" + + local evts=3D"${evts_ns1}" + local evt=3D"${!evt_name}" + local count + + evt_name=3D"${evt_name:16}" # without MPTCP_LIB_EVENT_ + [ "${ns}" =3D=3D "ns2" ] && evts=3D"${evts_ns2}" + + print_check "event ${ns} ${evt_name} (${exp})" + + if [[ "${evt_name}" =3D "LISTENER_"* ]] && + ! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then + print_skip "event not supported" + return + fi + + count=3D$(grep -cw "type:${evt}" "${evts}") + if [ "${count}" !=3D "${exp}" ]; then + fail_test "got ${count} events, expected ${exp}" + else + print_ok + fi +} + userspace_tests() { # userspace pm type prevents add_addr @@ -3648,6 +3683,7 @@ endpoint_tests() =20 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 @@ -3699,13 +3735,29 @@ endpoint_tests() =20 mptcp_lib_kill_wait $tests_pid =20 + 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 + join_syn_tx=3D7 \ chk_join_nr 6 6 6 chk_rm_nr 4 4 fi =20 # 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 @@ -3746,6 +3798,22 @@ endpoint_tests() chk_mptcp_info subflows 3 subflows 3 mptcp_lib_kill_wait $tests_pid =20 + 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 + join_connect_err=3D1 \ chk_join_nr 4 4 4 chk_add_nr 5 5 diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 438280e68434..4578a331041e 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -12,10 +12,14 @@ readonly KSFT_SKIP=3D4 readonly KSFT_TEST=3D"${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}" =20 # These variables are used in some selftests, read-only +declare -rx MPTCP_LIB_EVENT_CREATED=3D1 # MPTCP_EVENT_CREATED +declare -rx MPTCP_LIB_EVENT_ESTABLISHED=3D2 # MPTCP_EVENT_ESTABLISHED +declare -rx MPTCP_LIB_EVENT_CLOSED=3D3 # MPTCP_EVENT_CLOSED declare -rx MPTCP_LIB_EVENT_ANNOUNCED=3D6 # MPTCP_EVENT_ANNOUNCED declare -rx MPTCP_LIB_EVENT_REMOVED=3D7 # MPTCP_EVENT_REMOVED declare -rx MPTCP_LIB_EVENT_SUB_ESTABLISHED=3D10 # MPTCP_EVENT_SUB_ESTABL= ISHED declare -rx MPTCP_LIB_EVENT_SUB_CLOSED=3D11 # MPTCP_EVENT_SUB_CLOSED +declare -rx MPTCP_LIB_EVENT_SUB_PRIORITY=3D13 # MPTCP_EVENT_SUB_PRIORI= TY declare -rx MPTCP_LIB_EVENT_LISTENER_CREATED=3D15 # MPTCP_EVENT_LISTENER_C= REATED declare -rx MPTCP_LIB_EVENT_LISTENER_CLOSED=3D16 # MPTCP_EVENT_LISTENER_C= LOSED =20 --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 0E357817 for ; Fri, 16 Aug 2024 11:02:20 +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=1723806141; cv=none; b=kyE8QHi0QBH9CrkNkA/YnlUNRIjk5o64lITIucTR/HX0dTbDK4AV0c4JgBdkih2veVluVDCHa9ujuIvflSIFfNF++KZ3b71HZa9IQzmZ36+aa4YRLFsUNrlhyECIrM9g2sxb3t5hNDwVBlTdI+SqDVfB7kTWTJpiPDGXi7w/NfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806141; c=relaxed/simple; bh=w0gVgtS0irM/m9XnfGrohdvca5g3Ze/cnTABI3q6STs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FDfV8hIriPc9iYpE83K+n8fjIEcczOoj5NuNK7Xcc6IYoxcKdYW4Szamj4q9iiJk//ZNy6HTtL/L62NcteED2qSceGjmNF5zpQnXG3jphAvzv7OaB/IVrSIJOh9/R/459EILWspiYEVFN8OAJp1c9AxQ2UXAKjL9toktLh5FPb4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P56xSdzc; 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="P56xSdzc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7EBDC32782; Fri, 16 Aug 2024 11:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806140; bh=w0gVgtS0irM/m9XnfGrohdvca5g3Ze/cnTABI3q6STs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=P56xSdzc7Q8yFvSbvo9igOXBVXvHswrNOq0FJnnF1KLrOOOlhtI/u9J88Ydf3K1v5 3XqT+ssrj8V3eOjIp1u6L6GrNovonUC+KQmGMTZElGSrGk9WozR7e1LWgA6xP077t3 6rkUeFOce5nJAZTxN92rHm0qm4NHh+vVim1nz/Qwd4shOqU70o0NVvizVSXUq+JURb xS5hL8hIV/5lt47SILilJiLckBNQkIBaIrcosilDpuUsOTp7rB8r/nhTdZKQk7eqpO utEKmnBEliRgps0dBQmEfwNYqrv5S7fWbrB/wAo/+7vi9JB/+x0GFENmrC6CZmbbH5 FkYnQ/GtYKhRg== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:05 +0200 Subject: [PATCH mptcp-net v2 11/12] mptcp: pm: ADD_ADDR 0 is not a new address 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: <20240816-mptcp-dup-close-evt-v2-11-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3254; i=matttbe@kernel.org; h=from:subject:message-id; bh=w0gVgtS0irM/m9XnfGrohdvca5g3Ze/cnTABI3q6STs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGubrgcLw7qf9nxybP1aSYS63EMnziSR1KlH waEO+x31qeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg cyXvEACMbk8DZvr4LnKP80wHs52m1qRC8NPRpacMtqyVlY985Z8LWBpYDhmO1SxzS9+GMMhJzkB kKXTTt8kONaiBxmLanW69gfuuZs9ZhclnMlcHYiOiYQvdEzQsSGYT9kLCIijPDY7nDtRBKS1OeV WETiOSCVtP9OtMqyWvyYmzvgHb7FaftGXFQ+p00TkBk7WZUTiWLCSdv2MU5NmNgd17ZaTzPo/N7 ra3NY5fQ6O5Ta+wEf0RRoijhDv8Qa1hbn9yAKpAeNu8hhFNgh8lgfOBMrp8T5QYUb3o6kC4gjII Uz8uJSk/iLTkQ9GT7OrzZOpnQ3j3MIDk1kJQaoza9Et5ajgTQ1zxk+T8FBougDdrsbaPOrkQ9Ec xU1xaz7GHRtcjoMGAObaKhHJsXyn6Im0kWoyVUoCzdo8NPkshfRfIXgNUKWzZE5XXJSvEzKhK6g 3RNC3tIQM3dAfxzOSYYEfCaMzlZssEAad/rBkxstrNTLxpNutQ1aFbhR5cTZnI4ZutcIoVqbd6X sbl8l2CTokAkClflb9+sC5cuUH6pCMQmApmj8WP/ESyQ+0rbQemY3BOv2i0GLUzUPn2IGxMabtX e71g56oRBe0yCXjYkS/+tbSGM5obvtkquIaOvFldt0JHaMCb44DkQU0qO8fUFjFQhloOdZgtL28 TZvSxJRoHHDY6+g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The ADD_ADDR 0 with the address from the initial subflow should not be considered as a new address: this is not something new. If the host receives it, it simply means that the address is available again. When receiving an ADD_ADDR for the ID 0, the PM already doesn't consider it as new by not incrementing the 'add_addr_accepted' counter. But the 'accept_addr' might not be set if the limit has already been reached: this can be bypassed in this case. But before, it is important to check that this ADD_ADDR for the ID 0 is for the same address as the initial subflow. If not, it is not something that should happen, and the ADD_ADDR can be ignored. Note that if an ADD_ADDR is received while there is already a subflow opened using the same address, this ADD_ADDR is ignored as well. It means that if multiple ADD_ADDR for ID 0 are received, there will not be any duplicated subflows created by the client. Fixes: d0876b2284cf ("mptcp: add the incoming RM_ADDR support") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm.c | 4 +++- net/mptcp/pm_netlink.c | 9 +++++++++ net/mptcp/protocol.h | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 56c0a318e5df..da7b2b95d568 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -226,7 +226,9 @@ void mptcp_pm_add_addr_received(const struct sock *ssk, } else { __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); } - } else if (!READ_ONCE(pm->accept_addr)) { + /* id0 should not have a different address */ + } else if ((addr->id =3D=3D 0 && !mptcp_pm_nl_is_init_remote_addr(msk, ad= dr)) || + (addr->id > 0 && !READ_ONCE(pm->accept_addr))) { mptcp_pm_announce_addr(msk, addr, true); mptcp_pm_add_addr_send_ack(msk); } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 6a05eacd59b3..8b9580b6d643 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -764,6 +764,15 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp= _sock *msk) } } =20 +bool mptcp_pm_nl_is_init_remote_addr(struct mptcp_sock *msk, + const struct mptcp_addr_info *remote) +{ + struct mptcp_addr_info mpc_remote; + + remote_address((struct sock_common *)msk, &mpc_remote); + return mptcp_addresses_equal(&mpc_remote, remote, remote->port); +} + void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index ce15e7db464b..c05c5a3cb07e 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1004,6 +1004,8 @@ void mptcp_pm_add_addr_received(const struct sock *ss= k, void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, const struct mptcp_addr_info *addr); void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk); +bool mptcp_pm_nl_is_init_remote_addr(struct mptcp_sock *msk, + const struct mptcp_addr_info *remote); void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk); void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); --=20 2.45.2 From nobody Fri Nov 22 00:49:31 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 363CC139590 for ; Fri, 16 Aug 2024 11:02: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=1723806142; cv=none; b=uiNPbh9ruCPLfAG/xG7ysBD/2wB8mj8JsNqejiRjvsd7KLGBOWDWVqHonXCp3btE++CYXoYfcxe4UGW9wf+C7ncnXmHWjt9QEa0O4HCwgJEybEGnNXwVivD4BqjKPRtmiEhRLyG206kNsncG7XdlZu0/sReSGFDsOgdNFMC0xH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723806142; c=relaxed/simple; bh=WoQt0OoDMjBs9YCEmJSyNcYnt+UpLxo5EXOKjoZ6ygo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mrYmstfoCwl9qWvyX39Vtw1XvW7h8h6kJ6VjQToPxT/mVZ+E258/0qbzulh1peUmvnAv/lNMzrEpUfUmh5r+kVXMEC++fn9ZFJFar9Gkfb9zyw+Ar+EUuTwVlYGHBDh/2LU040YyLaxi4YLnxLfR4X5jLov4t5AH9m73/QgKtmc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HT+eIcOv; 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="HT+eIcOv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2028CC4AF09; Fri, 16 Aug 2024 11:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723806141; bh=WoQt0OoDMjBs9YCEmJSyNcYnt+UpLxo5EXOKjoZ6ygo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HT+eIcOv6N0psTfoMN0EV7vnA1rKlLAVWp9gmypEJuC9l3dxWvCcEMVp3/PY9kCIo e8f9zSGiyF6tkma5WJQw1PJsKs9ONCEE+BUGIbW21QlYyL4lNNqTfiFn956LbW2D7G jqZoOsEJvQ+7SviT+n3Kma0N4aWWcdRrYRYTsiMqgl4UY2MFPBz9SlutRO71aTx+jF 2jZoz7El6SatzREjouv9n8/BXPr2PPVTToudr8OvS7Grm3JgItdDvTMVI+JpbnrQcS cURBPoV7IdHaOzlo1b3Fd/vofwfXmYst+ac/0Rnml+YbIt2MeOl3lGYpH6TOVXuaNM Erd7p3OYPTNuA== From: "Matthieu Baerts (NGI0)" Date: Fri, 16 Aug 2024 13:02:06 +0200 Subject: [PATCH mptcp-net v2 12/12] selftests: mptcp: join: check re-re-adding ID 0 signal 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: <20240816-mptcp-dup-close-evt-v2-12-8a33f6617f5c@kernel.org> References: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> In-Reply-To: <20240816-mptcp-dup-close-evt-v2-0-8a33f6617f5c@kernel.org> To: mptcp@lists.linux.dev Cc: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2790; i=matttbe@kernel.org; h=from:subject:message-id; bh=WoQt0OoDMjBs9YCEmJSyNcYnt+UpLxo5EXOKjoZ6ygo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmvzGutNZ+CSzVQhjl9sahIDU5PBbEhCZnC9trJ JPYxNUdN/CJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZr8xrgAKCRD2t4JPQmmg c0E+EACdzQpQ+gxrjoRG1oZ+2OXA14KC+Yjml2DRU7d8kMNyMrBGobEz08+lv+FLI1a2TXbm71u Y4PZClDmEckMIONscSP/KB0x7CkgNTyfYFdwL0b/6vo2rc4e4oH4lwSIteSqvOjEduhvyDF430u 8LhhhkQs90BznTXi+W/Q8i5EgsmkEW1smkNgbqBq7G5weoERX1Q7j+5iNQSRVJQTcU4wI/TbY+m MtX3Wqz+4P5xXWC0weOnokNGvvElrO8JHbbYiFpCqceofLtmVAwV5Y+kHuXZ7fl50k96p3GFDky mvtKjNq62zJd2VvK+e89GbdVUm6qV9qRBMOqBqwhM5uTefewNi3ONHu/PXtm8Cp1Qnx0Fybl1ah 84pYqOlxoSO1iuNgWL8F15vFfHno1nH8tq2RACGeAv+USR7g/OrueZL7+W15lSPRdYgqHbzwktO Huho0qmdLN4OQSWZMYf3gKQLP1A8/MpLYAytk381IL8gZXV7PcTRwhukFlUMc850XDXw+upUarI w6BFkhb6PAGW4iDF68Ohn0a/WMVtXrgKcWsiVG+uUHaByMsqsEftMOtT5+9oLO2jB2adg8Q6a5I ZPDcmRJrMZkorP6djNbSkRU3oArU5GuqXw+TaInrqoZMYOKf2gcaZjUAh+S5J9yRMr4UMmSRlmk LUYPd+QthDjBv/g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 30 ++++++++++++++++-----= ---- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 56557a7e488a..037fb790f155 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3794,7 +3794,17 @@ endpoint_tests() =20 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 =20 @@ -3804,20 +3814,20 @@ 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 =20 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 =20 join_connect_err=3D1 \ - 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 =20 # flush and re-add --=20 2.45.2