From patchwork Wed Sep 4 11:03:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13790509 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 E61AA1CFECB; Wed, 4 Sep 2024 11:03: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=1725447799; cv=none; b=kKJUajkT2KOcaEwmI2TV5Ii+R/znV4k1Y6qSFXLrmVvdgLaxwztE8k1nGj1dpFB1q8RCENdw33chzTRg5dHlUMIf5Qob79fNXIg8SfYVAIPI13AttRA+5G2UHEd3gDU7T85hTI5ApQvdnO2dMqx8d5afsyLezGUcQ7UON8X7Ge8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725447799; c=relaxed/simple; bh=ftGq5/zhSqpqgd3h2SqOmjFU0bHUZidkAU6bL3ixTKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VHmv3OSZcLJq1P7zTrzx9ZZDPaMgqzJPHmPxaFEWrGEszmKuGxlpKj6kVggk8c7iKpYMmjcSh4J6Xf0/qD6/asSiiTZcNSm/ItaUN2QhCQcss8uZ52yzVTSSioOnakaMyJPKxm4b8pG9wS6SzC7Tv7RZJm9Lh5C8Eq5dF4Kqmlc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jw37PH6v; 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="Jw37PH6v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50F1EC4CEC9; Wed, 4 Sep 2024 11:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725447798; bh=ftGq5/zhSqpqgd3h2SqOmjFU0bHUZidkAU6bL3ixTKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jw37PH6v4HtCd6oW9ozXUcWsEl33ljUxc9hH25/vKt8u2zpcvVbOHlEKXZRH10jNs WpkGEjAfWXcFeN3hnKd+zOXpK2zQKk3o08/1ricPv9UNzdCOsyCNchUSeQgltL+XbF UvPAQcDDND8PU/TsZ6zFgK9I7PeXxD2kWr6kwWPn+e4drccdBuv1TDyMyx1md+cxhW XpczxqkkqnKjiFZOGre49rrTg2aq3gFH/PnLrXqJDVYSgwOSo/tml/XLEJsD5xhn5K ZrB3FAfSrB/UMhTlrVWCAo2HJTyUe2A5NfwylaCtXE0AGLhEpRPG8Z6BxlPGyL0qHo Hdp6mRBIWP7Xw== 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.1.y 1/2] mptcp: pm: reuse ID 0 after delete and re-add Date: Wed, 4 Sep 2024 13:03:08 +0200 Message-ID: <20240904110306.4082410-5-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240904105721.4075460-2-matttbe@kernel.org> References: <20240904105721.4075460-2-matttbe@kernel.org> 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=1705; i=matttbe@kernel.org; h=from:subject; bh=ftGq5/zhSqpqgd3h2SqOmjFU0bHUZidkAU6bL3ixTKI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBm2D5qQBa7SeF0c4FMoAy+BIJuPIGV3k2TjaZUU xl/Us9S39aJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZtg+agAKCRD2t4JPQmmg c2MdEACMWLQSbH11400BAsAY/u6VaoW7bRn95YIjU6zLO8+m8mBV26p3IIYeP3DmHDGDi2evgK/ tmK0B+b8GF6tkcq5VYdoaU407KJ4hyfD9GSQngBK25qZwLITdQhdDm+qKEPtp0Fpl8KqRjzJTcd 2VigpFtv/ojVnX2bEBT2K1e+O4iNUymGEhXWQeAiP88+cQmwI8mz4/waEC8FEntD6FSGVPi6uTx L9sXrUkuqOnBxqH3rT3Dy0xlseHC+OFHUWbib5mKqYlDZU8eRVzAyiAC+GmzfuGzQy9GrJl9JLH kxIjo+6HHS+DHSDWOKArEL9z9KExy0Q30k1y/Pj6OohWvDNLSbGvJXDIOf7r1ZrYDpbJI1MCBVw +jXTBiWcY97EjdksR40wO99+W998bn8WJ49XnI1sEMi+N/V8xi+5gE9ZIY11oYHJlsc9Mc0rskx 1aApk2EwqtqSqYm737AYTqatAL9hslzldf8mSV+q1kxK1Tq5Ikzlp7LdsmrPeNyUOYiIdrd/mse WPb7LhQzxcyY69woyZwzvHMm30JjEyc9QjtkvO8VES5wKlzTDW/w6j2dF6sO7NfEk/zWEnxH+f2 Bk236Sns+07w0iY1ByMvbqySkdHDTHR0KdPehyytTGA8YSmGE9HHgG70lTkf6OztftmW0/LfQqi 9ixCP/biPKEUc6A== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 commit 8b8ed1b429f8fa7ebd5632555e7b047bc0620075 upstream. When the endpoint used by the initial subflow is removed and re-added later, the PM has to force the ID 0, it is a special case imposed by the MPTCP specs. Note that the endpoint should then need to be re-added reusing the same ID. Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") 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) --- net/mptcp/pm_netlink.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 44b036abe30f..c834de47bddc 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -600,6 +600,11 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); msk->pm.add_addr_signaled++; + + /* Special case for ID0: set the correct ID */ + if (local.addr.id == msk->mpc_endpoint_id) + local.addr.id = 0; + mptcp_pm_announce_addr(msk, &local.addr, false); mptcp_pm_nl_addr_send_ack(msk); @@ -624,6 +629,11 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) msk->pm.local_addr_used++; __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); + + /* Special case for ID0: set the correct ID */ + if (local.addr.id == msk->mpc_endpoint_id) + local.addr.id = 0; + nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs); if (nr == 0) continue; From patchwork Wed Sep 4 11:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13790516 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 0E1A21CF7C0; Wed, 4 Sep 2024 11:06:34 +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=1725447994; cv=none; b=F8L8XZvJP7KA9yLOMzse4kfKEyeSNO6iMovxSFVo9jxcrWZ7q36N6EbDouMCv9zw9ga96Po0UkAam71E0Gi87Omgn6s+ZZpkGyHKMJ3/UQKMzXr2fsp1ZTIv3NVW9LBCi++tIVYcVsg6Hx/zXnUU5O/gkG+ayYXBtcXyE67fpYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725447994; c=relaxed/simple; bh=/QXBL5BfqoMeyrvLxmqYzg8bHM7f9x/l7MnfUpsZsHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U2a7poZG5Y5rrCw0o6Sx4CTjCSP8ec4wwu/K3Wk0/HLUPgqWp/kTG34o6GmlBHTaoA4Y5zPfu9KxCAndGrmfvltREOQHdYCas3ut7kLwouYMpAZdvspc9Rt40B1L429P0nkM79d+S10ndOJsfe3PrdWISx0kD6FYNmKgV9eXUjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bMNns84g; 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="bMNns84g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E553C4CEC8; Wed, 4 Sep 2024 11:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725447993; bh=/QXBL5BfqoMeyrvLxmqYzg8bHM7f9x/l7MnfUpsZsHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMNns84gguQgyE1lr+Ydi7Bua/srRRMOUpCmYsdeewySa41UVFSTNGxmmfQSWuwqF p5EnfdJVwqBBxqj6EJJqn+glzqCXDyH4WeUXR6ADlwAS0kb+2voI404heLUNeHetiO SVaPoc8rwFjq8vPPHawEP/hsEGFu4cPF/uOfmWBquaJsxKgMaOWAD66vpfkmmSJfQv 23kLJVF5dLbqchJfhgkmTuRCYyxI4d1bJZxnu3pPJ0iCO4+ICNoq5a+NA9maDC21PE cVx9B7fQCveS02vEUCOpUkJGjRbDX69WBTCiNfZt9MJNhTQfh9PLTn1SM2vZqjv3JV aDztYEVey9JQg== From: "Matthieu Baerts (NGI0)" To: stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: MPTCP Upstream , "Matthieu Baerts (NGI0)" , Mat Martineau , Jakub Kicinski Subject: [PATCH 6.1.y 2/2] selftests: mptcp: join: test for flush/re-add endpoints Date: Wed, 4 Sep 2024 13:06:13 +0200 Message-ID: <20240904110611.4086328-4-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240904110611.4086328-3-matttbe@kernel.org> References: <2024082618-wilt-deafness-0a89@gregkh> <20240904110611.4086328-3-matttbe@kernel.org> 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=2774; i=matttbe@kernel.org; h=from:subject; bh=/QXBL5BfqoMeyrvLxmqYzg8bHM7f9x/l7MnfUpsZsHs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBm2D8jjX77OHD1/XO86EUpnQx2iQsQeiAu83qWW NNw1frHMxOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZtg/IwAKCRD2t4JPQmmg czH0EACjccAJhAy+SeY6b28RxttjeveBcRsJd8t5bkJDIoOghHPDNvR32yxmq63kO93BHZWIas8 8dHxaehf2BmWeoUcRMPu5ReVOtT4b43azloQvgGcfqWMW/ZA0iY5qvR2R8DzHYnv1IxqeLhbVsF Ac6ar9AA7WYKcIp50A770eAsgywf2D8IrmjZxi07v8WBJzBxNuNdeo+0HbwcaUj1TP5pF+Xd+s3 K6gbEdXxI8oaF0PTihU6onKOeqFBtWCZBn9463upzGLJy+/eJIJspHCofUHc+GNgW5Tjrxik1YG LD7HbwVPKUbBb29avMjb1aYtdAh55YGpn3pJ8EzMpvA7e//c3inPHyPsT53CVd3l33FTFg1FiFk /sibI1bevPJUId8NwG6N7jsBXuMtQJy5f6qfwVkEf4SONXe4nI1ihZ8v8pO6scd6qfRCamhUJHA E6nVR0RysPTQO45xQyetdgD71LugXshpCXSajkPgxxsUkTt8TJ5SYUeikH+4yH8sY5rksLstQn8 7VW6SiNA7KPYZNSjszPvJP+xGLHQXNIdr+QknvTovJt1kYL4Wl0JxENbLAlUU7vZUVg9NrjB5Y3 HqaSnrQhN/QFulH+qEq0ppJ5fcCiscRX5UNtumFoOXQX/ONJ1hYGN+gW6he0lWkoM49Q5sFZArX bWE3BDtCPvxjJuw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 commit e06959e9eebdfea4654390f53b65cff57691872e upstream. After having flushed endpoints that didn't cause the creation of new subflows, it is important to check endpoints can be re-created, re-using previously used IDs. Before the previous commit, the client would not have been able to re-create the subflow that was previously rejected. 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: 06faa2271034 ("mptcp: remove multi addresses and subflows in PM") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-6-38035d40de5b@kernel.org Signed-off-by: Jakub Kicinski [ No conflicts, but adapt the test to the helpers in this version: - run_tests has been modified a few times to reduce the number of positional parameters - no chk_mptcp_info helper - chk_subflow_nr taking an extra parameter - kill_tests_wait instead of mptcp_lib_kill_wait ] Signed-off-by: Matthieu Baerts (NGI0) --- .../testing/selftests/net/mptcp/mptcp_join.sh | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 549b230238ca..0d2f30affe1b 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3320,6 +3320,35 @@ endpoint_tests() kill_tests_wait fi + # flush and re-add + if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT && + mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then + pm_nl_set_limits $ns1 0 2 + pm_nl_set_limits $ns2 1 2 + # 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 $ns2 10.0.3.2 id 3 flags subflow + run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null & + local tests_pid=$! + + wait_attempt_fail $ns2 + chk_subflow_nr needtitle "before flush" 1 + + pm_nl_flush_endpoint $ns2 + pm_nl_flush_endpoint $ns1 + wait_rm_addr $ns2 0 + ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT + pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow + wait_mpj $ns2 + pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal + wait_mpj $ns2 + kill_wait "${tests_pid}" + kill_tests_wait + + chk_join_nr 2 2 2 + chk_add_nr 2 2 + chk_rm_nr 1 0 invert + fi } # [$1: error message]