From patchwork Mon Aug 26 15:59:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822550 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 C28F6194135; Mon, 26 Aug 2024 15:59:26 +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=1724687966; cv=none; b=dK+RaXS1Y6LBJr/8003T+I0icrz/TjvWeB3GhkZo9hJbpa3/pylgYbaRbzMqbqR8Aox4xz3V3wRzAt2YPn09S06uiErBoHcsNsYZ7BS979Na3N4HluiLZxfXBOBbumDxpRjNi4dtjtu+Q6chO4vTCCYZRBaXIGpHwt6NcJ7hX8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687966; c=relaxed/simple; bh=eH+2wuCEf6ULWeN4oFAYdU9huILl507IPxdL4JUgAA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b9kvxd8R+NMmB32hEOS3x/GmnUQ3wnawMQOS6niGkOJ7UslFqydoSBddkgyfpYKqUV9ULFhsqR0ql4UhC94Q7AaVSF8lgluPhlZnMWSeuamH07nYnyEtRFcfcW+LVMNvmhAb1oS6G6O0K12i44b2TN4PC59n7Qbmqji9ThU8Yz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r1TvMDvW; 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="r1TvMDvW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52463C52FF0; Mon, 26 Aug 2024 15:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687966; bh=eH+2wuCEf6ULWeN4oFAYdU9huILl507IPxdL4JUgAA0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=r1TvMDvWlNypBpzpJFxfrLqVGgMEemIsW62Kw4dF+JmKsojS6/B0aBBB/U9xMSues iV4UgTHqXoC+zk4YZ2qX8/uGQpS5v1GeXsJuZqeS04plrlqnyI2WAz7A8njJ9sgBlQ VgvnxxJqo0Yo5wA3o7xajzlzUL0xrOUuGlqTYVtFNGmYP8hFm+gYpe6dMa+aX8Elo7 H/1jzrt8w0egg53qx8z/uVNVItmU3UXhVss+YaVvXcqBmBzZg/a1bsVR96pJfJXfcl t+Kz2jhIDsgqfKL8D1LpCSdewtJsftqaR70CkCB7tCsLDgrPnOSzKI1JEBfdWyQI9H QiXESrsNNUh+w== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:00 +0200 Subject: [PATCH net 01/15] mptcp: pm: reuse ID 0 after delete and re-add Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-1-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1538; i=matttbe@kernel.org; h=from:subject:message-id; bh=eH+2wuCEf6ULWeN4oFAYdU9huILl507IPxdL4JUgAA0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWN1RjCjLcUQt47le15GvR8p6uXCKDOYRtR wLC94BpQ+yJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c53wD/918QDlMD8wY2ISMeYjOw/6pBVwMWJu52U0EzyImG3dhvqU3o16FOFdpZ5pQ7d2kgfc4dE ZuV9dJKE10IOfOk16HyUASK48drOgTO7Ge5RiCVryIhi/9mfAZ2hTGvBbjnHjEEoeSkuo08FLqK SF4cbBLdC/kjrvKWBs/CfCmMnoYtbwM5WK4+3J+IbUHDNihRvxJ331y2GdRoAndKcl+Kex38FoL YVm9CZtWZOQ0GWcvEl6DYyUqTpCEwfylnG9rJ4UvhAmNM8xsfcwoqRhhY2kU5ml6Y9eUFKwATeJ +7lyyoa5ecV2EsWP0RMQAqMcbS3Sj4AIQ0uvyjq2X9I2OVV8gaq3ngJ3434ULUaeoSDUS0G88+N td9dcIx77nQkGOymwD3P9YSi+M6rtN88pfvceYTr8X1uEjOdoKyIDJ+d3/neRORrQajqNu7uPCM E47jLg2Y5azsQNgjTbg8ESgwlAQTECoamJwwY+0fiVHMAjDKi6kuujFaUfG0iJTpKAOSphGFyIZ mEe93QmjYU5xCscj3yNZrcHzCMBIaFUzdfhqgtkg36aiFzFnVa3UJzRFGNFltHvt5+/sYcK8igT +RGR7BPt3bQvreJQt75tAQLnygMRh/91WqiPXTrqvDUJhNmcD/Tu2egsMTjbyNMKU09vUNzrwWD cK7HPTfvs6Hp6wg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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) --- 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 3e4ad801786f..9ee68ab4665e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -585,6 +585,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); @@ -609,6 +614,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 Mon Aug 26 15:59:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822942 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 DDA4B1946B0; Mon, 26 Aug 2024 15:59:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687971; cv=none; b=A4dRo1BmVR3/MGVZ6maVsxPYpveTEak/8ChWQrjP1lZFl90YR52bxktVQTAv9J25dDF/+kf5nWMf0J2oH0A0slMODqO2VFoDE9fSvFL6P+Sdyx2wh1faUhrjr+zJWl5KkR5Ghe8zjJl1KMY5npJsmHRb8gtY9P0vavlVVt+SxpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687971; c=relaxed/simple; bh=s1yss0paMK4upnZxrl0r9CGRCoeHOS6+86NQ8h7dypU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hYFew/cyKo5HwFjODmGlT103O1gnPIPCw0WyKG58MIaTAG+iRcAYmupFMSDTxgY2dIZfoJWDl5x8Xl51ph2Ib/lxQ0j2TgGoPYqeFqI2t+GF9xQ4nuSgdZK6Dn0phjyv38dvIeLHzlrewpo4CEkLVsWB9KR4Y9d+v4EQ8cNNFNo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ffEk+RJ/; 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="ffEk+RJ/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D420DC52FFB; Mon, 26 Aug 2024 15:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687969; bh=s1yss0paMK4upnZxrl0r9CGRCoeHOS6+86NQ8h7dypU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ffEk+RJ/cE50lRUI7Ns7xq+LzWLcf9sSFeIW7lqSBa92NgOc05GESb2xPEVz+jInR b7WiiV/mOuRbiWzJ93lS0z58heIOmxUb3ho5aN3xvk15DRmaNyuPrEqqKtNZIeffou yNd93xWrNDr97dyKPrIFkXYMlVxoKertwNirKI9D3U/KPhAcm1ttF0sGZFr/MYMaLl QD+OM11Q0qFy4CIHmN0hz04ET77ZtcNe//uhKa80rkQeLHughMJDCJHRMptjLEadMO /b9Cj1nUsjdg2ZhK77Or9YOnBHdGg3U3IGpYN9ZzUQQ0KM+mHkGBYbYbWwBfMPiqus QPzToIX3dwaCQ== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:01 +0200 Subject: [PATCH net 02/15] mptcp: pm: fix RM_ADDR ID for the initial subflow Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-2-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5041; i=matttbe@kernel.org; h=from:subject:message-id; bh=s1yss0paMK4upnZxrl0r9CGRCoeHOS6+86NQ8h7dypU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWgDx4oVOXW3KVTZdQq5DLNgm/h6fcYUdUR I5Nl4MHmh2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c6QcD/4nJ9n2ITXkCPmY9TGzXAu7epOBH1A2i0YjLQELrLqtdzQCkNoD+959fIb6yHv3a480KyD razQeRwpezXraa/OWFVXHkk+AIZ634+FMVVfARiyVuTFpN/h6xwyRyC6weLuWLXt07yI4zT4XDc SRCbaW+ZYckAP6Gy46B2eRAqUCtrDrudJq438oUyBEM7O/6KDa+p364KbrZJUaAwK/Oz52o3p0Q ocM6CGzcUYrILDww6kwmUptpzAeXe+aUlTxaTjZ085p6j2/GJMyv1uOTEVt1BiDA0A7iCaREGwW MVtN2QvT70GtX+BUgj7KUeaBHbBLT+7trPrsVf4YHQEHDRVr7xhiEFlseZYmaAPTQttcEhu8uPn 1m13hgJnUUP9jDl7/VTt22/bU+xDUZStdrnTeeb3J/8Wa0Gl/k+UXUn1NnLb8vFBdDybempn3m5 mS38J++RraFZU+CETLxpkurDTcl/5FXD3QRe0kazQ4Cg2Wfl4jq6GDstW/xrkmfhx9fb7cuFgwz 7S4+K92oygY7X5HrnqHDT6oR+HlWwOw9awKVmTG3X+2Yn9m+vpDrYgXV1+NfqXcPWGSIvft043P DHVDvn9gRy1vE7N1WxbOk8SQ5X59bf/0O8aNo+z6i0lgxAgG3te33il6CSt1W/wUvzGYp+Yupvu QAyMUGEeqRHKyfQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. When an endpoint is being deleted, it is then important to check if its address is not linked to the initial subflow to send the right ID. If there was an endpoint linked to the initial subflow, msk's mpc_endpoint_id field will be set. We can then use this info when an endpoint is being removed to see if it is linked to the initial subflow. So now, the correct IDs are passed to mptcp_pm_nl_rm_addr_or_subflow(), it is no longer needed to use mptcp_local_id_match(). Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 9ee68ab4665e..042cd65d974a 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -800,11 +800,6 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, return -EINVAL; } -static bool mptcp_local_id_match(const struct mptcp_sock *msk, u8 local_id, u8 id) -{ - return local_id == id || (!local_id && msk->mpc_endpoint_id == id); -} - static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list, enum linux_mptcp_mib_field rm_type) @@ -839,7 +834,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, if (rm_type == MPTCP_MIB_RMADDR && remote_id != rm_id) continue; - if (rm_type == MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match(msk, id, rm_id)) + if (rm_type == MPTCP_MIB_RMSUBFLOW && id != rm_id) continue; pr_debug(" -> %s rm_list_ids[%d]=%u local_id=%u remote_id=%u mpc_id=%u", @@ -1448,6 +1443,12 @@ static bool remove_anno_list_by_saddr(struct mptcp_sock *msk, return false; } +static u8 mptcp_endp_get_local_id(struct mptcp_sock *msk, + const struct mptcp_addr_info *addr) +{ + return msk->mpc_endpoint_id == addr->id ? 0 : addr->id; +} + static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool force) @@ -1455,7 +1456,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk, struct mptcp_rm_list list = { .nr = 0 }; bool ret; - list.ids[list.nr++] = addr->id; + list.ids[list.nr++] = mptcp_endp_get_local_id(msk, addr); ret = remove_anno_list_by_saddr(msk, addr); if (ret || force) { @@ -1482,14 +1483,12 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net, const struct mptcp_pm_addr_entry *entry) { const struct mptcp_addr_info *addr = &entry->addr; - struct mptcp_rm_list list = { .nr = 0 }; + struct mptcp_rm_list list = { .nr = 1 }; long s_slot = 0, s_num = 0; struct mptcp_sock *msk; pr_debug("remove_id=%d", addr->id); - list.ids[list.nr++] = addr->id; - while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { struct sock *sk = (struct sock *)msk; bool remove_subflow; @@ -1507,6 +1506,7 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net, mptcp_pm_remove_anno_addr(msk, addr, remove_subflow && !(entry->flags & MPTCP_PM_ADDR_FLAG_IMPLICIT)); + list.ids[0] = mptcp_endp_get_local_id(msk, addr); if (remove_subflow) { spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); @@ -1613,6 +1613,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info) return ret; } +/* Called from the userspace PM only */ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) { struct mptcp_rm_list alist = { .nr = 0 }; @@ -1641,6 +1642,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) } } +/* Called from the in-kernel PM only */ static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, struct list_head *rm_list) { @@ -1650,11 +1652,11 @@ static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, list_for_each_entry(entry, rm_list, list) { if (slist.nr < MPTCP_RM_IDS_MAX && lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) - slist.ids[slist.nr++] = entry->addr.id; + slist.ids[slist.nr++] = mptcp_endp_get_local_id(msk, &entry->addr); if (alist.nr < MPTCP_RM_IDS_MAX && remove_anno_list_by_saddr(msk, &entry->addr)) - alist.ids[alist.nr++] = entry->addr.id; + alist.ids[alist.nr++] = mptcp_endp_get_local_id(msk, &entry->addr); } spin_lock_bh(&msk->pm.lock); @@ -1951,7 +1953,7 @@ static void mptcp_pm_nl_fullmesh(struct mptcp_sock *msk, { struct mptcp_rm_list list = { .nr = 0 }; - list.ids[list.nr++] = addr->id; + list.ids[list.nr++] = mptcp_endp_get_local_id(msk, addr); spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); From patchwork Mon Aug 26 15:59:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822549 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 DF881197A66; Mon, 26 Aug 2024 15:59:33 +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=1724687974; cv=none; b=qe1bCloluTPDuc5XxiB1uEiSB5NWh4b83r2E5zXlMtJjhmajOuyigFDjLaDFIOf8YBw3dxTNJc/hD36xLlEuWKFZC2PxEqBBdgTPKBTRNAy2SQaBGJepB1SZPwdZek/vaw4+rnYHAgPV6xt2uzX58ijdnR7fSQRifTnJ0FnAP9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687974; c=relaxed/simple; bh=p0kyHCAmBWmo++X4fkmrWosQeS0ZfREeOzPeG1DHAbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b3N1FMv5qBW9wUzcF8BRSLuehcWHijD2owVDrkPvhW0/4wJ2tIp04VUB1PoVT5R1xuRxJYN8rR4xVagwhhAWHDZOUvHg6FrJ0AoygBrB4hwSy1VXRPq7brteZ0WtThj2JeDRbCrwdVOH9Sc7VI6X4tKNVG1YYJxiatw85Wf0dNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TbdAQDQi; 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="TbdAQDQi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65491C4DDE5; Mon, 26 Aug 2024 15:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687973; bh=p0kyHCAmBWmo++X4fkmrWosQeS0ZfREeOzPeG1DHAbs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TbdAQDQiryI0/yk0vN5GEeYhx1ekGso+Hh1oarWs4rrxhky5k1GAosdXiY/bpty09 CzZReXDSIkfLBWFekRpxcUEX26H7S6XpNt/XJsmr4gQnaJPQdgSQ1XjyPGtL8a9M/J vjT3FtaJl017dVRFuKzihJBtBcp8QCvmtTtIp44ED25Caz4cqnvHCqfxz90BPTaWCp KaElbfO2wEIOhVFDtSF8ZSHRyIdT9cn4VLFGHsCBVJ9cqyv5xpA4Vrlp06hIT5LP7g T4YMxmNHnJyxNwu/rLkhJ3r3gu5jXWo+erdTSSqkDR2+LPd9ltP4mFt8BwiQtUfBlF BwMW1GuxLr5dg== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:02 +0200 Subject: [PATCH net 03/15] selftests: mptcp: join: check removing ID 0 endpoint Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-3-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3151; i=matttbe@kernel.org; h=from:subject:message-id; bh=p0kyHCAmBWmo++X4fkmrWosQeS0ZfREeOzPeG1DHAbs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWXs417NozfGuopBXKoHLVFs5XV8DYFr61J suDYKkM4aSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg czOYD/9WVbhgQjmdS7iWv7QF9zpcDiSix1W6uwlnVNgJokIANQkrfbxEPHeddjygEwz9Cf98YTC pGWA2faBAI7T8eHv6x3aeulMrk17n6zdbHUgtyrz3WWqqv6xAtDl9ox2dVJj7tpg6PygM+wpCrm FYLYxADhWc3x3PKSDKVI42UonJeS3T659t148d63+t59RSZ8PgKTrjF8lZglSMkefTFrE/1+ZkQ 0ZdOzH88CHpeAf7dkewZctnsJ2zTzTIDVnBlm+mGkDgO1z5Gji9v1L0y9qMPNMpYAJPH2RdwUAg ybDA8/xRZusvYrfYmxuGCWcs52Z0x3yWnjY7IrOIYZjOnl5yBq6cBziVrGN7NC2A866dMu+yKHo 5ro84/o1NBVGlbsE6Uv/9hhJpQmRVyItW5peVFgxcK45+vORdD1er7LpcbI5Mzqz1hy6wLVE3aq UvNrXNlS/p0/FMcYjN2/aYe2nmx9+T+8Dr9FGRrBha6YV51ZCI+jVhl9RjmqMCSTLH+T7M3w7kS MxfXWkbusyhp+3hT/zI4ReE6GJTo4iNWfkLqVDu972zGZtWlcEdDrf/WEmVp5WbG63CPf7O4tYA TSlXEjbg9uM9Mp8po3z2Umoq21NrTxVILd0YERqwWILBDWv2/2ymB8aSaMjQQSDxrxt+O8syN3U dGyPa41KcH8nNiA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Removing the endpoint linked to the initial subflow should trigger a RM_ADDR for the right ID, and the removal of the subflow. That's what is now being verified in the "delete and re-add" test. Note that removing the initial subflow will not decrement the 'subflows' counters, which corresponds to the *additional* subflows. On the other hand, when the same endpoint is re-added, it will increment this counter, as it will be seen as an additional subflow this time. 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 89e553e0e0c2..d2dd48a539c5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3575,8 +3575,9 @@ 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 - pm_nl_set_limits $ns1 0 2 - pm_nl_set_limits $ns2 0 2 + 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 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow test_linkfail=4 speed=20 \ run_tests $ns1 $ns2 10.0.1.1 & @@ -3585,17 +3586,17 @@ 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 pm_nl_del_endpoint $ns2 2 10.0.2.2 sleep 0.5 - chk_subflow_nr "after delete" 1 + chk_subflow_nr "after delete id 2" 1 chk_mptcp_info subflows 0 subflows 0 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_subflow_nr "after re-add id 2" 2 chk_mptcp_info subflows 1 subflows 1 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow @@ -3610,10 +3611,20 @@ endpoint_tests() 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 + mptcp_lib_kill_wait $tests_pid - chk_join_nr 3 3 3 - chk_rm_nr 1 1 + chk_join_nr 4 4 4 + chk_rm_nr 2 2 fi # remove and re-add From patchwork Mon Aug 26 15:59:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822941 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 175BC198838; Mon, 26 Aug 2024 15:59:37 +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=1724687977; cv=none; b=Encoz9yZfwp1DKgo/vTlFij6Nk3lAy2TMI9k1ualvImVlPohjozQFTV2iHabX8ZToUmfD8/mam8uq0k+QxT94z0BFDUO6n2tZgKML1OkyVfaeggZqmPmYMjZgt3vDQWt/S5aJPNNJ7Q56jUE2dArv6CB+cD8uS7fSNtvRzIRpDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687977; c=relaxed/simple; bh=LmV+esdBEe916xs5xmg/co551PZP2TIQKsdBgoEOmMY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OP2w6oWNz+ZYGqz4cxqtyE2/YxPceNuBfaCt+6YoRSjOhO1LM2DqL+3X2dlh3sY1skkJv21E10xC97x64MzzO2NxFWJfv3lqYZHTtddV46K/AgFhFm+Kwb5so+u+64emKMJbwJcGBx/IGNdVkd3lSK/MwkpPjBLUDJEWE85Sz08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T7iOtKmk; 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="T7iOtKmk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7222C52FFB; Mon, 26 Aug 2024 15:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687977; bh=LmV+esdBEe916xs5xmg/co551PZP2TIQKsdBgoEOmMY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=T7iOtKmkSg6B4lQ7cEcO978h3UBChjmumhptu+sq3ovQwgqU1m4LvojcT12IfSF7S 5F+B7cW6plBXkGKxsEjJUwh5Y/CE6XfkOjQcpwzpjKoyRXMR29C7EO8+8hPPTFi2YC Ey/yyQrM8zYmHUekdBzESctJrZF7n2D1IB8jHsYQt1PwDFy/v9fKEP30ME/IdyEeCt XkTy4eaXzZGgwmUcxz1Nnsx3dym/puXauu4kdCDLDyYGW0Mg6wdkku5aqRsn102Jm7 +QKsum8bCqlM21dOI4Gm9kvr+OjC90bG0RSrNb7NDUjI/0oxdfkR7+AwrhR18cAigC Hm0OPZcO7nzFQ== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:03 +0200 Subject: [PATCH net 04/15] mptcp: pm: send ACK on an active subflow Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-4-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1147; i=matttbe@kernel.org; h=from:subject:message-id; bh=LmV+esdBEe916xs5xmg/co551PZP2TIQKsdBgoEOmMY=; b=kA0DAAgB9reCT0JpoHMByyZiAGbMplbIHWKwLX8Sdft9Uv2XLVWRhoOeIQarFY7Tn9jTHVYUy IkCMwQAAQgAHRYhBOjLhfdodwV6bif3eva3gk9CaaBzBQJmzKZWAAoJEPa3gk9CaaBz25cP/iR8 55pcFzbFM0gPn38CaB48MwOQrqQokz+Cq4D/uc597qbzBvx1EzUSu5QjWIdQjHECKtMFLAWXr4j WjjVLsYSOaSu6gC3AOOORqEP/YTQr52hZexu0UzZOnGm0ALJ5LJ5a/n+FYh8WPQKZByFthXPozP wHXPmlWpsgTPZYBe6ODSFFKvxclK095Ax0NqlESUcdaEuenfUTTstLFSQjJilbeTQapLcKz4dEa u2caRvgJ4UQgG/YTYsH+jS4qPUdfIsXRRBJDX0xKzIuDWMbg/WDGGkpXVhKUYbWAOMg+5OmgtfV N7JmvKn+pOdTiMmUrrXjwWw2Gl3Owhb/T9wOc51YlHM3od53g4v0zD9c/SSIcCwKN4R4SYL0Wc2 qCT3dugEdvLUwxM43CFg76Hj5o8xz4YlRisBC+bmTHOQqe/DTJq56d4fK3bMPzoKTee7Bjq8GYZ kOyaIOcg/eTxwafS3JB87gG5jBh29nyJ283Yh+IFKWmNXqcyXT7TYT91lFhnER//I3bVC4vtWlH qv4OV8fs/oYo9tHcV2vHjb4JbdKLuG6pnNu5+v7xYtsM2tObh91nL+rldVsKk4yBiSaQCvcQbpu 4+Ws3sJG3pd64nY6jBmE7SqRLNltLN1ChYLZVyR6/+wlDrnO3oXJGEXumI5Vx2ZpLuVDP9MMdkE pKnOU X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Taking the first one on the list doesn't work in some cases, e.g. if the initial subflow is being removed. Pick another one instead of not sending anything. Fixes: 84dfe3677a6f ("mptcp: send out dedicated ADD_ADDR packet") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 042cd65d974a..380647f7bc33 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -765,9 +765,12 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) !mptcp_pm_should_rm_signal(msk)) return; - subflow = list_first_entry_or_null(&msk->conn_list, typeof(*subflow), node); - if (subflow) - mptcp_pm_send_ack(msk, subflow, false, false); + mptcp_for_each_subflow(msk, subflow) { + if (__mptcp_subflow_active(subflow)) { + mptcp_pm_send_ack(msk, subflow, false, false); + break; + } + } } int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, From patchwork Mon Aug 26 15:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822548 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 188AA194131; Mon, 26 Aug 2024 15:59:40 +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=1724687981; cv=none; b=dbieSODQpPBsIxH5rKYej2uSZrV1dJP6u2kaO1affVxSzm/O9lWes+oKDqry3kqNXZgH37RN306XTqbL5mAFhM4x5pAmRz3eSJnJZP9HmXcfVqrZ8KdWk5SCFfiRdAkJW6dATj/y5tZnybKcZoBdgsjKNc4t4E8rRCUNL2yhM60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687981; c=relaxed/simple; bh=vEBrXWE8EKUMVAFWC8MYLR3HoWGf3JejB4BAD7km5GM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RR4CBR4BM7hPZ3Fx3Gadc+AsCa3Ak7nuNkNR2cULTsbSaWVM5FYi2EYKFa0iJ0FxfqTuyAlTEOQheb3GpxMDOKFemUKO+Ivmgtt3N6i7uqMTssYn7iTn6g6cPKukLkKmLoH/MyvuzFplFuJzlPFe7e6hJpXDcA7/hBnLoPoem6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rEE/efo4; 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="rEE/efo4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74C29C4DDF5; Mon, 26 Aug 2024 15:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687980; bh=vEBrXWE8EKUMVAFWC8MYLR3HoWGf3JejB4BAD7km5GM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rEE/efo4rY8vccZrPNXKtxd9bWFBxMbGTdzw/NIuCaUK+J0xDMz+nVkP+gSnFJzXL U1uDvP27IQ32G4A573rwbQxaaGhyuIwKE7BP1t4dfFnORGFTLUyFsNhNwzTp36oSUw K0vJt27nO4dpXy1t0hiD0WGhV9If12qiFDc3xaNO8m9nfAeFjp2CB59S36m5kmy6KT Jh+6x13KUJmTJm5ceKBc+ukqoG5ExQ6Tw1KDG6BHBLpsXzaRnBGeexcDusgPo0ow7K R5duSb+hs0IVG7ooCEaWcDfB5NQhH4gYP/OK8fEh1oXXydkg8hUlZ3+MEerNL18hDo yrjYOulZvfC8g== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:04 +0200 Subject: [PATCH net 05/15] mptcp: pm: skip connecting to already established sf Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-5-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1788; i=matttbe@kernel.org; h=from:subject:message-id; bh=vEBrXWE8EKUMVAFWC8MYLR3HoWGf3JejB4BAD7km5GM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWnYZ9Qx4kGIZpWYM2bgh5lSKBBU3bXhpVN SdAItDEIQOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c7kgD/4ojGfdWC2HTrt4TM4MofdNGWyG5KbJ/Y/Kg6jI5dEt2nFGX44Vb1HHrfhRcmZZjQ74f2a bjT7jYPRR4I09X5yoY4NB9gCfOgA7J3MiOKLt6BKOq2I2mTuMT5AeCLpQIGETh4C3X6nbupK1SA kLZLVE1ApXOQ0gq2LUZciI/xE0xjNGK1GKxFap/tPETMtQPXfsXyAdp/UETV6OuB275VY5rZld5 Tflvn/OAztDSKOOsdQ8o3UM+C1YK7C6K3zNRyhPn1c4lZFqWUr1jvnFyB7+kJa/2ZF2OA1ZFKd5 +ktsX217dN1hn0bWRH1CCCcsH1VqG/b9D49VW63Lhqw+g6vZUySglTa1O4WTJGQED2BIMpx+gmO UqjesTvBtaP4qDiu3IHs/pnOcrb9DQMg/pR3uDtRY0lma2wShRH07KvzzTmFulOpNqb9/uXAwuT Ax8/jBotQpzfHQTKDO4ifaQaBElpA7eeiHQ5s7wPv+eU4GV/hBuQYUpC0KD6hfK9nXY14T67zvQ 7IEMJWbJTNhObAq9aEg4LhWK4rm5Cl7YFobGbdKv8PtJV1ER/c/HWklsRvbS5rhBU9t5HvIS98D oeD8y7VmCGaOog97KEfNu1e6DqgoOnxdAeHs087Ubn3yIOzrmYqVekKeg6AyHTXe6jCwO/G4fpf LNq+J7ld1Nm21vQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The lookup_subflow_by_daddr() helper checks if there is already a subflow connected to this address. But there could be a subflow that is closing, but taking time due to some reasons: latency, losses, data to process, etc. If an ADD_ADDR is received while the endpoint is being closed, it is better to try connecting to it, instead of rejecting it: the peer which has sent the ADD_ADDR will not be notified that the ADD_ADDR has been rejected for this reason, and the expected subflow will not be created at the end. This helper should then only look for subflows that are established, or going to be, but not the ones being closed. Fixes: d84ad04941c3 ("mptcp: skip connecting the connected address") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 380647f7bc33..0c91d961f51f 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -130,12 +130,15 @@ static bool lookup_subflow_by_daddr(const struct list_head *list, { struct mptcp_subflow_context *subflow; struct mptcp_addr_info cur; - struct sock_common *skc; list_for_each_entry(subflow, list, node) { - skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - remote_address(skc, &cur); + if (!((1 << inet_sk_state_load(ssk)) & + (TCPF_ESTABLISHED | TCPF_SYN_SENT | TCPF_SYN_RECV))) + continue; + + remote_address((struct sock_common *)ssk, &cur); if (mptcp_addresses_equal(&cur, daddr, daddr->port)) return true; } From patchwork Mon Aug 26 15:59:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822940 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 2AD66194A66; Mon, 26 Aug 2024 15:59:44 +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=1724687984; cv=none; b=ZkKb9h5lLmlBmOWp5oU0Gq9vVp+9qmrVw8TpyUd5ZFUkoTCcYbKYC7YyWmYA/IzmvdXqR4D2vL8YAaRp9+rJrgE0IwwiLrNGEib1G0cG3vrvjuNSNYVWTQXlkwEVjR187ne8Yx0dHQkY+Sx8cG7BL+9+43ko2nby5gN41xHvacE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687984; c=relaxed/simple; bh=evwo6kbXTHDvZL769kxqmKta9GRw5JkELgYU6vCVGTE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CAgxWsUAO6Tocte+7je1iaPslq9OD7oWEC/7r6ciyVIRf5gff6a7QH9AiQWfFFy7hVavy1rmgFSf38xyK6fns0FANnGjzmdJYI6L/RZxKE8gZiZriH4kqRMzo2jjrJl4GVI/HPN/SnVR8Rv+b4xedei1fg9l5wxvLdRiv4OW2qc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rdfjhA8I; 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="rdfjhA8I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03358C52FFB; Mon, 26 Aug 2024 15:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687984; bh=evwo6kbXTHDvZL769kxqmKta9GRw5JkELgYU6vCVGTE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rdfjhA8IFap889T4R0aqp6ytsL80CZR2hG2R9NJJHrsU1NSo5ebNTDF74aBBEmGnb rhJ4RW8JjjYSLheFTwr1WggpanVQ3z2RKiP30LEHK8mZ8VP5PYdb69dIIXjXsXTZgG APp/Z06jbg6gv8KCBRFMkwgsC9CPkhzPyGjgJNOscvnwyYh+i9AduqK2w/cqM+Rols b4DNlcdopxxppp4I6nviybG25BrS99d4hDvsmQdLsOEZhJzDWA21/DMUHt6VylkdGF gJVKZdMjwYrDXowbTl4T/Rdxm4TXQhDMfOstugTj9N42j7B9982BfTGeyGIbLbHFMI TBJlcHpxNQ5sw== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:05 +0200 Subject: [PATCH net 06/15] mptcp: pm: reset MPC endp ID when re-added Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-6-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2747; i=matttbe@kernel.org; h=from:subject:message-id; bh=evwo6kbXTHDvZL769kxqmKta9GRw5JkELgYU6vCVGTE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWYkb3Qht76vaqFIznBJhEkvbhiRhVBBksC favBpVW/LeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c4qbEADpqnsFuioTV8gsm6wgxr/41NoGprPllcop9cJXy3NnvBRBkdQRxnyJfzA/F72gWrLJs4A 5wX0L40SEyGMmh7PiOYX6LyTZkablCgGDoTk3KA8xr0F53u/x7jk5EvlFXK91F/RsW6Fhdhtj/o xI0yuqXZBu0cJc1ygwWf1TV9BvQ/Pt7hABne+EEaYz9GIsOszDQA9J5Ez47rCHvoPXDk9BaUIui JAyrgLDbYMkjZUmwSdKlfekQH9vRWo9d21/08L8EEK+KTr0KRoQm9wZIAYOv5vlDnN4jIJo9LoX xOhGuCauvnjLLIqToDvFF9uP8fomplCCjbwm9BZQu6ygJNLoemqol5G5Fwy/V7OS/ONrJlaylws a1caqStuRVGqfiwLg7V6EzifDCtdugXNgxLtJBwrncI7hMjFbvEgxpJs47ckX0BpY6sa+0ijgcf oaBQE+C0d4OfPT30d/HqB10jyRKE9XYn5IO1TWeANqsoc9gON1Ocy73i/ZsyaSnuKJ4yWw9aK2Q 8RrCT2H0sht1oHyIcTISr3SDc2HC55MjFKahs4AknwhpaokmAwzvJgLOIH1hMNqrakotpblgKLD 2RTiGJv6V31evoS1g04TflH+wo3frSGD//0VC12RbrbEnL66CQibZ6vKadmjkXyXQAL7DpYoW57 Flw03PKO+6KerFw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. It is specific per connection. When a global endpoint is deleted and re-added later, it can have a different ID -- most services managing the endpoints automatically don't force the ID to be the same as before. It is then important to track these modifications to be consistent with the ID being used for the address used by the initial subflow, not to confuse the other peer or to send the ID 0 for the wrong address. Now when removing an endpoint, msk->mpc_endpoint_id is reset if it corresponds to this endpoint. When adding a new endpoint, the same variable is updated if the address match the one of the initial subflow. Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 0c91d961f51f..75c8aede7026 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1318,20 +1318,27 @@ static struct pm_nl_pernet *genl_info_pm_nl(struct genl_info *info) return pm_nl_get_pernet(genl_info_net(info)); } -static int mptcp_nl_add_subflow_or_signal_addr(struct net *net) +static int mptcp_nl_add_subflow_or_signal_addr(struct net *net, + struct mptcp_addr_info *addr) { struct mptcp_sock *msk; long s_slot = 0, s_num = 0; while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { struct sock *sk = (struct sock *)msk; + struct mptcp_addr_info mpc_addr; if (!READ_ONCE(msk->fully_established) || mptcp_pm_is_userspace(msk)) goto next; + /* if the endp linked to the init sf is re-added with a != ID */ + mptcp_local_address((struct sock_common *)msk, &mpc_addr); + lock_sock(sk); spin_lock_bh(&msk->pm.lock); + if (mptcp_addresses_equal(addr, &mpc_addr, addr->port)) + msk->mpc_endpoint_id = addr->id; mptcp_pm_create_subflow_or_signal_addr(msk); spin_unlock_bh(&msk->pm.lock); release_sock(sk); @@ -1404,7 +1411,7 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) goto out_free; } - mptcp_nl_add_subflow_or_signal_addr(sock_net(skb->sk)); + mptcp_nl_add_subflow_or_signal_addr(sock_net(skb->sk), &entry->addr); return 0; out_free: @@ -1525,6 +1532,8 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net, spin_unlock_bh(&msk->pm.lock); } + if (msk->mpc_endpoint_id == entry->addr.id) + msk->mpc_endpoint_id = 0; release_sock(sk); next: From patchwork Mon Aug 26 15:59:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822547 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 1C73D194A6C; Mon, 26 Aug 2024 15:59:47 +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=1724687988; cv=none; b=UAXyUp2SWKecnN5nkglK3UBgCmtbrXN5J4o8lSzNqFraqXY+NrOdhD0LpHxetOPFNd4iamv+qjEBek6++0sVMr6QN33Va/R6Db0XnPnv8rH3sZN1NYdaRY0QL4qudo5m1P4rd+nD6kF9iRRGaqnWEIRgW1z5emGBN+6l1xulMTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687988; c=relaxed/simple; bh=QjBJldRjzg2+T6Npi88LVkgmkn1gjQoFLBqrAhWQ8Kg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EvjJ/J/SKwWkNJfPHIn8FdW3D9sERBV04SK2Gkl/BB4DeSQFCJQ7YjRNdAIMoRjvZ9NlftaxGzILiOwVqSIcaRwzScxLK7Wxkghij6yjnB+Po8atx/CzTI+rpZo8J2I3Atjv5+/z8sCmhs8m8aRTV82eLs5ReCL+a0hSpNiQgE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P7LaEGB6; 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="P7LaEGB6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A7CC52FF0; Mon, 26 Aug 2024 15:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687987; bh=QjBJldRjzg2+T6Npi88LVkgmkn1gjQoFLBqrAhWQ8Kg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=P7LaEGB6zu/K7aMM79bCMQFGg/88qIrUf193QurHKZZt451zT4qM67HY92zNuZJP1 oYKY+ZcJOm7jJuR3uOmLcCYrk49z8Q6s1gxIVPl3O5TlHQpc2EPjYn0k+OXThDH3TX cMoydydC1jSekZK7h/TsnzIrHCPkSU3KZqNsKuSMGsANOEUFklDyIVM4+CHB6z8peV h97VpXxPxBfcr1HiMKKCpa/z27wi/npFHE6+4SE0hQNMqREZXW+PiCxsFLkeUnxJcO 8JSk70xsxdtzXbNoPcs7qCwYkIktrdiY6FC4zWzFd7xeWWlSU1lUIUelndZ0Jd6z2A PNv84oqsCjg/g== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:06 +0200 Subject: [PATCH net 07/15] selftests: mptcp: join: check re-adding init endp with != id Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-7-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2745; i=matttbe@kernel.org; h=from:subject:message-id; bh=QjBJldRjzg2+T6Npi88LVkgmkn1gjQoFLBqrAhWQ8Kg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWbCKTVemIPt+kSL5tK0bfNPdNsDsMkB5LJ coSfDBm8d2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c4HyD/4gu8mx2MYMqmgjKNUNUfg3rYKLwPemKZT9q8b4jC0hRP53zXWvWUNv8iMIZwuPGfpRvmL hjBxes6LraB7m3ya1iWwJgu1vjfnMwcba0HPDqalyWpQpoLzm8htdypeapgiQJpEnrbl1tCBFZv w71F3mtEEU24gaU8sxUccCkqD28kWyw1oNLEv7sMTW1C5Mfu4OuBe90UpVyiJs2JEXM20NhH+ob tWny39jeEzyoNOBEfz4HZ8rHH59faOB2m9mXE92Q5IZvXwvyORK7YCOo0B3rYV2AKrxh9coYkeA tiIO8awUL2ivsJ2hcZBe+C29FmG65h0WTb7+wTxe964M1rQq9CPSf9rpkQQ28+OTuA7nluTQeBr oParUzkSmZJA0fafOgf5iMTQU769orO++IM/DvgIU9wdgskgY1riBXE5fmqKRev47XUb2ebIB9h MpXBMIeI/rxIlpM74RPtFwSNDSB/9UIqQy7yb2UzzvTLZMCP6d7kpj/p//49bDIob7fIQXcZxqP b283XlUcgm8dPw8HVy4PlFyEZ5+ELJaLGGTsgF9ZSx1xU7XXKjKtt6dN0tttjOFod1vNEwWzgpH n7qIUnm/V92187N75ggY3NYcdkqdy+7YDrxFoLsw4mjBk3SM3u4/a2Zs5B2h7GtAT/V/4tGj82j 36KQN86Es8TMXnA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. It is specific per connection. When a global endpoint is deleted and re-added later, it can have a different ID, but the kernel should still use the ID 0 if it corresponds to the initial address. This test validates this behaviour: the endpoint linked to the initial subflow is removed, and re-added with a different ID. Note that removing the initial subflow will not decrement the 'subflows' counters, which corresponds to the *additional* subflows. On the other hand, when the same endpoint is re-added, it will increment this counter, as it will be seen as an additional subflow this time. 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index d2dd48a539c5..0fd4bd609565 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3630,11 +3630,12 @@ endpoint_tests() # remove and re-add if reset "delete re-add signal" && mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then - pm_nl_set_limits $ns1 0 2 - pm_nl_set_limits $ns2 2 2 + pm_nl_set_limits $ns1 0 3 + pm_nl_set_limits $ns2 3 3 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal # 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 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=$! @@ -3656,11 +3657,21 @@ endpoint_tests() wait_mpj $ns2 chk_subflow_nr "after re-add" 3 chk_mptcp_info subflows 2 subflows 2 + + pm_nl_del_endpoint $ns1 42 10.0.1.1 + sleep 0.5 + chk_subflow_nr "after delete ID 0" 2 + chk_mptcp_info subflows 2 subflows 2 + + pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal + wait_mpj $ns2 + chk_subflow_nr "after re-add" 3 + chk_mptcp_info subflows 3 subflows 3 mptcp_lib_kill_wait $tests_pid - chk_join_nr 3 3 3 - chk_add_nr 4 4 - chk_rm_nr 2 1 invert + chk_join_nr 4 4 4 + chk_add_nr 5 5 + chk_rm_nr 3 2 invert fi # flush and re-add From patchwork Mon Aug 26 15:59:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822939 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 8004D194A6C; Mon, 26 Aug 2024 15:59:51 +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=1724687991; cv=none; b=gVDOmd9SXw3nDngVqJL4S9piSSVDlB80WwIx9aUdDppBjmPwNwJR1486LzeQFr4RdqUjG6gdFZiO6USE3bb7eHPQrLJN1H1GpO9LPL1xSkdji3r+RGJtRY6PPQFu9YWqED36PmT9KZ+wUpZuhET2gem1L91n3MthOQd9Ax+8GbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687991; c=relaxed/simple; bh=KJeX440D0lgAaATQxMR6d7ml7Kmd14Njfgm9c+2vehU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kl0bvcIgfyIjwlUiHiJ0y4Z9N+Twjz/vKcmGsr64/L8RvY41k5nC2afzgMAVSaUe8WdrVVrob1GzEB/RlU3qTHzMB5HlJL7UaDbeqeMW8zvZJUjql6NkMxrA3TY3+vY/LFT01eVBuftoX/T0PkdQwbDyQQR9tWWQdfs8O8OOuds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lST0/Yzx; 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="lST0/Yzx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E20BC4DDEC; Mon, 26 Aug 2024 15:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687991; bh=KJeX440D0lgAaATQxMR6d7ml7Kmd14Njfgm9c+2vehU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lST0/YzxBw2A8dgKNlzdyM4ASHapmjmlHTbM5S1AZMoaU4CYzyjHp4yqYjxgPlUuA TDynITgyCkMCLorca76S+dizks0wf4PADvMLIioqfSvJPfRPrv6Q2PVrsxtNR/35cI dzWraOZIMt9PfSBUw1qrz6UP2A0TVfKgn/kpm3NMl3bF+V1pQuRc/fg+FG06rKpfDI 19Rl6wO1T5SFPhDBz5gaw006JIGxYkQJzebePYqK1EhLC9Gho7CpcXbW2g0Mff5vyL rBzS0sfPauTCBd7jKp/QwlF1lLIVU51QWleHC33ElaDrKLkDkUBw1YmZwXoK7dVHee kTz7IY4RrCE4g== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:07 +0200 Subject: [PATCH net 08/15] selftests: mptcp: join: no extra msg if no counter Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-8-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3270; i=matttbe@kernel.org; h=from:subject:message-id; bh=KJeX440D0lgAaATQxMR6d7ml7Kmd14Njfgm9c+2vehU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWMilAosh/GrvXhEjYKlHkZ09midWZh+eey SX42jEF7W6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg cyWFD/48d+q6ixKoZJQKgd4T1pLlcVbmdqNqTnqg6k9YZsU9hbqVZKv1Nhk/IGBD9bEKoMQjGIJ RdPm0MbGQStZcJkILvjYvx/O3iXnFEvaNgBf+XsUt9ZlRoxWD2AccjyQW7N+dbCpPBrsbiMhTDR AMJFVe7sJBveNDeyBSH0nG3tV9RHjJBgbXh394k/MnlZzHxgAlT6eMaj0qM5T8lDuSKcMrFpz/1 7FnCnSHetfduxC36IXQEYFlhj4CjFnNLRNSH515x1IgOIAS65AcfU1xLaAPeXCOXaUmXlj5wVpT yJI491yMLpy3dAnEH6ZDNuVDJAOioclbnsSmGVh1EE1COaGRD4m/yyBM95w3psa3fI85MICG0As DcjmJmiSLL9SFxQdzzqDp68znZNRvp2cnKY6/h8tND9jhev0js8epZnA9sWkJkgSoeQiAnmp7HF JL0HCKJShj0F+GxOxjqnR7XHyc6joj6sAtDVV9m+KEDu1/G8v2GT33621rNkgv+vOVDvuK61/e1 lEi2KvueyXMqmuwTj30DCTJwNq191jM6bvma0QmJrO84idQwiIfoDo3Xhng9lUsSYB+z5UiNP/O XyGi8EylBW54c4rjcZDdseBxEUk+DR/+qBB/AmxS8ikSRmVGaQWM6lpeozqx7YMQ+Er2OsFAFu5 rdsRPyyNtEzAO1Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The checksum and fail counters might not be available. Then no need to display an extra message with missing info. While at it, fix the indentation around, which is wrong since the same commit. Fixes: 47867f0a7e83 ("selftests: mptcp: join: skip check if MIB counter not supported") Cc: stable@vger.kernel.org Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 0fd4bd609565..0ffa6f6b04e2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1112,26 +1112,26 @@ chk_csum_nr() print_check "sum" count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr") - if [ "$count" != "$csum_ns1" ]; then + if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then extra_msg+=" ns1=$count" fi if [ -z "$count" ]; then print_skip elif { [ "$count" != $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 0 ]; } || - { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; then + { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; then fail_test "got $count data checksum error[s] expected $csum_ns1" else print_ok fi print_check "csum" count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr") - if [ "$count" != "$csum_ns2" ]; then + if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then extra_msg+=" ns2=$count" fi if [ -z "$count" ]; then print_skip elif { [ "$count" != $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 0 ]; } || - { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; then + { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; then fail_test "got $count data checksum error[s] expected $csum_ns2" else print_ok @@ -1169,13 +1169,13 @@ chk_fail_nr() print_check "ftx" count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx") - if [ "$count" != "$fail_tx" ]; then + if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then extra_msg+=",tx=$count" fi if [ -z "$count" ]; then print_skip elif { [ "$count" != "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } || - { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then + { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then fail_test "got $count MP_FAIL[s] TX expected $fail_tx" else print_ok @@ -1183,13 +1183,13 @@ chk_fail_nr() print_check "failrx" count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx") - if [ "$count" != "$fail_rx" ]; then + if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then extra_msg+=",rx=$count" fi if [ -z "$count" ]; then print_skip elif { [ "$count" != "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } || - { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then + { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then fail_test "got $count MP_FAIL[s] RX expected $fail_rx" else print_ok From patchwork Mon Aug 26 15:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822546 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 B296F199231; Mon, 26 Aug 2024 15:59:54 +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=1724687994; cv=none; b=LaYsBmDTGXpBqys4Mek4Lvq8T/h2oAyKOGTwu2nfVsQEXcfuoSj0/dU8dVv6yXeL7UjExl+d9HQuaiauLZ2mMRhBiIsF5Kmv5T0hf/1JABIkZyzFu2ELm7c20pDybxz2kqiNsbi3aDw4y5hsOpTCacZHGhGSPAr86vCoLdKHIhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724687994; c=relaxed/simple; bh=j7L54oZ5ZL6jITms2lQtOOeQiDYGlSxAE2X+7XTP8Z4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=inFUFlVLZY+Eag8zhHZMWnwyf0ZM1RIAqv1sXDIyBBC3lHl09eUBfuOGIoXfAMb8N2lNKdFYOCuePK72SFMKN1uHPKjHi4cOKsjV7+dX97O3G1y4E6l7i8DsbHC+EO0r3Digmn+HVRZZxvGGU9IJbVzmr49CTrLh3Giz63UCd+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ez6evKAX; 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="ez6evKAX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DEC6C4DDF5; Mon, 26 Aug 2024 15:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687994; bh=j7L54oZ5ZL6jITms2lQtOOeQiDYGlSxAE2X+7XTP8Z4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ez6evKAXQG9DkFiPL87Ov0JZX3yRzuPCR4M43HJiT8OLdIrwth3pVl1ilSiXNQ4Qm tH6hekqGm1XRgdkPPB06ZZ3nn+4NS85zAUym+Xl0Gd+1ijLScDBr+i5C4I22cdPcIB X4DvYLkxYsIlXpLCobmmJWioU/7cIYikcKIlnIBHPglOIZr7pQlqqf6GQFqTgoenTd 76HZQhxSt9b6B8dZyN6ENIbGBCxwRui2mmisqjqWNFDquxyUewJc33sRCdgNCXqUAN Tdkc3w+NAIPLfbrdUxD1+TdeBz62Xw7rk+p+1oAehX7rjE0skPh0XOntNx2Mnj9kPg Ksy3ot5XN40Og== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:08 +0200 Subject: [PATCH net 09/15] mptcp: pm: do not remove already closed subflows Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-9-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1046; i=matttbe@kernel.org; h=from:subject:message-id; bh=j7L54oZ5ZL6jITms2lQtOOeQiDYGlSxAE2X+7XTP8Z4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWmYh1TD7NzbYV1EDm90ceDNlnet6jA8MEy 6HlqSU5d3SJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c9UcD/9TVwYIZHzIap9G/HUXS7mVd6F4lfxrPqyE9kRRx7+DhyDji863NKZNNIhFJy4hRQ9KJiI HebxocXDgTmP+qmkNep4MKtfEojwUKdUK42n9Bu+XKmZAguv8pY411d5ASZ0N1i3fLqpSTgn1CH gEL94q0CoWzps7e3j1wzGRtvBSNzLp9Lh9jFpNfJPMhzmnPhQ8TL6e64OKLbKeytcXER4uT8ZvE ijKlkC6d6r+y4SacwY6mwGWM6ydzgBU+wOaaWYeCWY57oGQXynYqXJa0XhvVua8la2mwjdb22ZK mq5W6AZ2mx4ez9NIaupy+OHCd/gppsuHQ77dkzyBizQfK+FlkCEx2kSbIUnX+O7JwY4Hzz7Kk0y Nu6m6pCgIiAKIsOiDWzikx1vQjy5KHzRNe9lPEymyiGGcnMSK+UmXn0lT6C+7teZvkGq4vwnEQE gdwi/v7+FpipzdI4gn8K8JvfH2c9vpz0/exDSU05Fv+2VOg5t6BUpGZw8JrV15J7czCr4lFu6XL xIVBwtim6f7Nvw1Y1CH9PjGTjK3N/pnteeTk8QcEYxhClLsU0NR/14R7Jm+h919YvJL0MPBRw1h YKA8b8jLHsaF1XkZjAJOgiYTWlmzOo/w9uMdrUEhpVxDwbE8FcFzv9DFAyXqBYohq64qAGuC0Us qrdM3ESb/9PyGxA== 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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 75c8aede7026..90b7c8b45027 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -838,6 +838,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, int how = RCV_SHUTDOWN | SEND_SHUTDOWN; u8 id = subflow_get_local_id(subflow); + if (inet_sk_state_load(ssk) == TCP_CLOSE) + continue; if (rm_type == MPTCP_MIB_RMADDR && remote_id != rm_id) continue; if (rm_type == MPTCP_MIB_RMSUBFLOW && id != rm_id) From patchwork Mon Aug 26 15:59:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822938 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 0106D194C93; Mon, 26 Aug 2024 15:59:58 +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=1724688000; cv=none; b=B9Vwyp2nBsWz6pBLPeMitQ4IpltovSewvZ4F0H59nQ8WnFwvXWvaykpwctYgi7lIiexxQNVAsxjF7aCtqDIsu6I/vR9+V4FcaxoFipttVq5zjRCGC/HzQCTWkjnu0XyBQbfBN+878rQkt4blXRXcrCm1fe2vzHxzG7TrxdmSIZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688000; c=relaxed/simple; bh=uXwOMuW/G6+0zgv9AO6yFx2u+jhvgs/z/nmI3LCIdrI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ITgUEHQDsdwgFnL6DnGBHixbu60ANEwylm+LR1kRY1q3nPmWRaGOlpoJxh7BXPBacFo2461IWjWBlfOFFI7BJ4oDFNhxdjjdpoa1xbwMN3qMJphHuYcVMNj9pJ74ECP0rO1exxCox4SDgYgT0iID9oZCUfWx/1lSqouyLCvuHB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NCQv2c+7; 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="NCQv2c+7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18A3EC4DDF5; Mon, 26 Aug 2024 15:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724687998; bh=uXwOMuW/G6+0zgv9AO6yFx2u+jhvgs/z/nmI3LCIdrI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NCQv2c+75NLKvvlJljjrgPhKlzE913e+xVN6CRDrorAjVlZ8A9twCDYPPR/NwXKel h5zg0ZufxzNQo6OfRkyQCXP4ozypzxeoonWUYp/LEcMIXfYpnj7LGYX3OkryXt5+mm GS2pJLk/4zpomBglykC3W/FiKE5lbBvXwhOgVil6klcVxucGy0K3oPEB3DbCDo5e4k JdsasE1II/vsKheEaMR74WYK+qqZ3eoHYrarInupZAq1WHVo+h67B5nuzZu41oD7ae 1QRRECRMJI2pMuUG6EKFg9mMx/rMcLfV5LV5V8/ZoGEAXMK2vOeFPc56aF23PbVSiP cEWWG5Bqwghpg== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:09 +0200 Subject: [PATCH net 10/15] mptcp: pm: fix ID 0 endp usage after multiple re-creations Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-10-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , =?utf-8?b?QXLEsW7DpyDDnE5B?= =?utf-8?b?TA==?= , syzbot+455d38ecd5f655fc45cf@syzkaller.appspotmail.com, stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2308; i=matttbe@kernel.org; h=from:subject:message-id; bh=uXwOMuW/G6+0zgv9AO6yFx2u+jhvgs/z/nmI3LCIdrI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZW0d11ZBJN4Z+IvERhVx9LuJbaku85sDvf0 Wft/3oZzlOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c7h9EADYErk8pH+Gu/yqt8tfd6Bj/yopVphZBiIurDOCNJcz5JHzSaiisIoyFHNEmbgcWyCtXVL JUk6LANUIWRwB4WrVjzsDdTTceCT7+VXyKbtC74yj71lAm/8d8/GE+wN4VLzh50CUHoYYjUJ7cH CvkwQVeAj+i0fMzqV+OpATd87TZamPOj7upNBycclNHwz6EPscfx0mzQ7hlSWHUwC3PdCm7rPem XPrv5/kZZY4PBOilDXWvBJOrTAs8n0fxWWXFKKJEjfU2l0FzyAdlPv9dbymLSQdThFFgqVJFPOa aDIj3n3eUTLzZeSSeI2FJ54eZqfoU+smNN7yC8hOu2R/+fnvu7T9Qo00J1W+hSVgCKuY/g6qPQa QkbSSwjbor/KC//PWKzXkOy5ARc1SQSSbWzNTicplcuxOkO7taZAXbaYb/Wy/tpJeWMux5ElOik clcLa4JAkwMCc5N2QrfZLh0lBxqmF6213xW3xHPCp87TMtM6t0zt2eLZzHw4UwwmgpXDoOazj2N nehfJaSSyQ/BVQdZyKBIETfB2cuIIl9Az0zkYT+IxMjC7kgIYBVo+LSBBx/SvLaEZJU78OyIcAm 44Z7AA3M7vj3nhFMyB75m87GWFSlZmYJN4EKfKEDIBgIbhOSgn/ado/Y1WhBorwJA/v7bAtJxay XwhVCeqMWAFG6Pg== 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ınç ÜNAL Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/512 Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Reported-by: syzbot+455d38ecd5f655fc45cf@syzkaller.appspotmail.com Closes: https://lore.kernel.org/00000000000049861306209237f4@google.com Cc: stable@vger.kernel.org Tested-by: Arınç ÜNAL Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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 90b7c8b45027..591ae2ffb4dd 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -615,12 +615,13 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) fullmesh = !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH); - 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; + else /* local_addr_used is not decr for ID 0 */ + msk->pm.local_addr_used++; nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs); if (nr == 0) @@ -750,7 +751,9 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) spin_lock_bh(&msk->pm.lock); 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 >= add_addr_accept_max || msk->pm.subflows >= subflows_max) WRITE_ONCE(msk->pm.accept_addr, false); From patchwork Mon Aug 26 15:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822545 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 BF48F199E81; Mon, 26 Aug 2024 16:00:02 +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=1724688002; cv=none; b=rjwmMiv94yjeCgLqFNIz6D81voy7kXFEItxhCPYPMKGBZnaAAFXGjqn7tVuxvEQ5gXPYiIarXwL0HzZVMv9ML6wKqnC2/5/Z+5jEhmVTdQQtRHJg8tud69+h/Jrktd8GGElw/kvgXFmwBv2R9SCS+JlbBewv5RQURejtaYZtdwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688002; c=relaxed/simple; bh=hUqiD6tize0J9n0G4qdkSCPdVIDOqJXQoFvZCB47rv0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RDr7dvpc8xxwgdxBPDvWyZg+YRZ3zfh3nYrmRaySJgzh30qV1N0+Xg7lZR3uojD857TPrJaHfJqhOFhZwg4qhwsguEv7kdI0zHYvBKWZ+tJm17Hjln48U6g2tRY7WRQ2sz4ap3cgKUHGZ9GE0n3RUB0IjLllVPGpA2Z0Jk2NHuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P7ih0KqV; 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="P7ih0KqV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06DD8C4DE14; Mon, 26 Aug 2024 15:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724688002; bh=hUqiD6tize0J9n0G4qdkSCPdVIDOqJXQoFvZCB47rv0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=P7ih0KqVuMDnD9grVpP07IpdZsg6L5VINlSzzt0uvTyFRG09GmQpoOMGZUAFz6aRh kBiZzNOQFckXtJoUTsjdpM65hgU1ABiud7iFKj5MMYLktLX5npwIGdEarc3ysjTfvb LSIHmFCIYhq4WRp+1mIebqSQBDpojhHMSQ7uJpgh0WssP7ak7ltNkvkhVIxtrgnOVt xlx/Ch/PEP0CGp1YelTVuZQlmXf8rldfKcaiiAQ2g3hmRJk4fqYjnjbPRdNMLFPfAj 7Zww7Dm/wI9bg2K5jAbx3xMtcah7klsyY/cezm32ZQ80PV2k3tZoydkLQOly9eS+rM viDZp/2CItSTA== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:10 +0200 Subject: [PATCH net 11/15] selftests: mptcp: join: check re-re-adding ID 0 endp Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-11-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2251; i=matttbe@kernel.org; h=from:subject:message-id; bh=hUqiD6tize0J9n0G4qdkSCPdVIDOqJXQoFvZCB47rv0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZW+W4mhmxjqvN44yLi5kqvXK+t1f2cckD6A uGyAlNxqNeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg cymlEACA98B1Z6boTviuPDNQS+CeuDQb04t5NKihwaeoIBJp3Ji2FnyVik4dMHt7ErXIVuSvNij QUrXhQYEuBQAga+iqUN2KZ8PkYTody3pbOGWsv3f9THGqsEvn6eXQfcIa0s/NHkZ9kzV738GFX0 8E9QwJdYzYvWy3jWaseRXm62tFNI/8xHvug6r6o6d0TwP/qweC1YzbFV2veuLINkub8c+ue+BWs b4G+LZYCOD1UBeXXBeMal255XO+GrX6BIJuRBsKR1h39w+wKAhIHkbeOQEGWlPENCl1fATDhdxn hnUjH7xNSN0w+TQtSAzwkaRGDSmjWHab9wtuQdEO6Dmr8vWjvawU8wAtHLylISUt0pwxesSicri r+fFypsC9PnjvKTeQdCnMqlfk4RyhZmjQSLaIgm3chQwX00BjmN2aXzRNK5wXg0n80SdKzNjcNq +GPSYhsbwwndd1S3Z/1yJVNuishO+tMTEuhRRBur7sLEMhW95e89TygJBwnTDfvZQyvFe3Wdd04 PvB+wVUjgN+6pRMHMKfGLnvORl31ibGuzbdPFSPKZEBKCXPjq0JkVz3+/ZAlKiU9wawweV4v4W5 dMykqw5omYCadZjK6HEOJ6IrIcmr114AHedGRyOszvU3/oYv04y3lappSe0fdztLDYADA4/UTf1 oQiTcKQ52Y2Pgvg== 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 0ffa6f6b04e2..7708ac99ccb6 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3611,20 +3611,23 @@ endpoint_tests() 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 + 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 - 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 mptcp_lib_kill_wait $tests_pid - chk_join_nr 4 4 4 - chk_rm_nr 2 2 + chk_join_nr 6 6 6 + chk_rm_nr 4 4 fi # remove and re-add From patchwork Mon Aug 26 15:59:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822937 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 788C34AEEA; Mon, 26 Aug 2024 16:00:06 +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=1724688006; cv=none; b=IQZFqCCVs8SkY8GmQuu6SUVLEt4yKtiNNRvaHIXbDm3w/kW3lu01JjnR0fk8N04dXGR1+YTojzHcnkDVP4S4sw5r5krxfEzUM5NNJcEeVOdAfZuR7J5cFQycP8pjV0GbpZIY6fXqay4uHyJXkpRneHYxuptaZLsrolM8CmoKZzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688006; c=relaxed/simple; bh=DRU08/X2Z++25vJpUMrkICDjD03cejj1cIlvXeD6xgM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P50/rg2ZcA0nw4dVGiyPSIPNCQdXCE9FtejKSPcIdc4DYUSR99IJ0xcJvB9IXFP3u4K3w3RA8stjSeYnpNikn9oVi76NVBT77GFpsU/0mfM2T+Me09B8bNsFWmlM+q69WKGIHufOD0bGoGuKfc6zoKdFU+09DXHu5hn8g/DzaoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MwnIhBW2; 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="MwnIhBW2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB7C7C4DE18; Mon, 26 Aug 2024 16:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724688006; bh=DRU08/X2Z++25vJpUMrkICDjD03cejj1cIlvXeD6xgM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MwnIhBW2bFmtVsjy3NFHNSBMpcclqoPSHOLfa98HdSuxA+lYbSkrtmh4M4eRCwhUa plgFVgUMTEQk56Yq/u2XgBlm/9G5oJgSbUyuwnyjNqRyPKtgk0uGYRs1yXwv1Q8JQk 1lLQsMQ6HOirxXJln81CtVxQF3x0UmTxnsyOz8fA4wq3g1gALXHlzY18M/dq/2zbyA uFuyQPgwfW6f88+TnzwADW/8BcH4FBZliWxZGp1tTRWBo3pZzZGkdzx5wiaTaE3APy WWQHCTSCJbo+0KGdZnK5PXnvNEILRlOts52faihPn4yj5pJlYqughpuNA7ovmYZ969 5wi6c/hkrMFiQ== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:11 +0200 Subject: [PATCH net 12/15] mptcp: avoid duplicated SUB_CLOSED events Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-12-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2774; i=matttbe@kernel.org; h=from:subject:message-id; bh=DRU08/X2Z++25vJpUMrkICDjD03cejj1cIlvXeD6xgM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWh9sPB3KjkgOA8EIPl5a/iOvwqEnQEC+r6 TiX/Hv/XLaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c+qVD/9HWpsg31NqbSZr6SXsn8lecJaLM/PQ/gPwCBvkK6XHfbJ2j4Yu32YYj/1/j+dGlkuUUSS hWzbi5ic889C9bZyutB+QkNE7L08KXjZundCfgxj26swU9JyZp3MYHlOuOD9tv/7xJaVyetMd/U wQxHV/hT+XVBd69uczxKqLNa+W7alXciZk4fyRk2MOqxGb84U6yRtir2LVgziueA9oGmhwZs9dA oAEP7r2VRxKVN78qoPnbeK1S2hF3B4Xq/MutWLEtZP9HVkY6SzlQ2NJZr7j0dLJ7caa2SbxqRtO UY+ZlkplRLKnlMol1LTC1WE4hGmgdwLIXKmuUSDuAMCS7NNy3+woy7YBLY2s8KGMpa9QXYljTd+ qQGTdUxpL6qtvhm2AGpvRWSSZOyU42gN86a1dyVYH5Ubcj7qjdDv2ZpLCaaFRYOXkjpZ5iEudkR AuvSWeBdzSNqOvfIMGVWJnZ2v6BImX0cTwMWsLUrU9kRzGub/ykO7uI8EIJ/r9WYTmWAmmHx5D4 Q0Wg/why59xqV46YO3gDrasZfSBOn4OXwbC6K/p6DjZo1paItRAcYDzod21K7GX/G4V6P/ihya2 o508x29qr1k16J4OxJjlI2fRp+8u66rQUA4hNGuvT1tomde1jad8GOmJjeaWuItzCVAoZya6Vs8 FkSVSg7bebjGLCg== 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=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9 [ ESTABLISHED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9 [ SF_ESTABLISHED] remid=0 locid=2 saddr4=2.2.2.2 daddr4=9.9.9.9 # ip mptcp endpoint delete id 1 [ SF_CLOSED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9 [ SF_CLOSED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.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") Cc: stable@vger.kernel.org Tested-by: Arınç ÜNAL Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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 0d536b183a6c..931172382aa0 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2508,6 +2508,12 @@ static void __mptcp_close_ssk(struct sock *sk, struct 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->close_event_done) + return; + + subflow->close_event_done = true; + if (sk->sk_state == TCP_ESTABLISHED) mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index a1c1b0ff1ce1..7e934ce0e4ff 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -524,7 +524,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; + close_event_done : 1, /* has done the post-closed part */ + __unused : 9; bool data_avail; bool scheduled; u32 remote_nonce; From patchwork Mon Aug 26 15:59:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822544 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 D586419AD71; Mon, 26 Aug 2024 16:00:09 +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=1724688010; cv=none; b=B9yPngqdpZi3GS63Qw3HkcsOXdh+RClTFlbm6JFL2TV5oGgu8+eL3DLJ1SHWSxviSXbVPBd19C4STvRWDLJTbM+s8b3XSyPSewSGoPtNBwim4t65YFtrmvDVBFIS5MDX5ruPJqYh+g7HEAVZhPE48q7Lew7lAqB4Pi7Pg4+JJMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688010; c=relaxed/simple; bh=4r3aaWqCHbkENtzeXOKOApnAu7DESu9H4pZmgshijxE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Sv1FAghWtqEA7L/WLO5Hj7BmlLM/Pf6KJQ2GUoQZz+eabT6dpoDksQUh6INICLIWt1dJEyb7C3UAVjvz0CWwrjxBfZ8gFBvu1qvMyafOizO6+0fHvEIoUVMfHf5R9tfl9/o6pZKpSWZajBFTJUk6Jg0g2vlKRCgoLuPwJV1esgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zp98DFo9; 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="Zp98DFo9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A8AFC4DDE5; Mon, 26 Aug 2024 16:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724688009; bh=4r3aaWqCHbkENtzeXOKOApnAu7DESu9H4pZmgshijxE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Zp98DFo9bb35n/3cHSTNeMeGVxnTEHS7EV+o8YKd0ynH3EVHuoXoaBrWia06H7PiU tb6X4d9xFU5kwy1h1VEVvBVhyhI00lI/X45AG+JmkzUL0LkDquJnQzQsnB4SnaHORc hjwhcErvhOuSyPOxacaYFYzg2zMal/FfVtawAcRhoLu11a78GkklEI0dATDL6Cn1LH vP7HFQieeFpmKKT24kpJD6+qjg3wjsIKi3CVnojDUhFiyKY8Freq89bCgiyDGMI+V2 53191dMIc+UfUYMdGL1Jp39JfZ0tTtUdCremoZ07Mywu3yYc3p2eczdObJkrE+utSc QG5ya4sQzlzpw== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:12 +0200 Subject: [PATCH net 13/15] selftests: mptcp: join: validate event numbers Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-13-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5857; i=matttbe@kernel.org; h=from:subject:message-id; bh=4r3aaWqCHbkENtzeXOKOApnAu7DESu9H4pZmgshijxE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWEtqhIMPy0rlrqQ7EPOKWio83u65FlZukc 56WrFuFz+qJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c4MgEAC736SD5JYysrCIMSPYLBXA7NMuMP3zCiyIi80m8s9LCf22FI6iFYtf+WLyuOZcsgbEcE/ EOSg60ZWGHN64AtLrYOSX/EhiwKPqQhtxbGQd+eIJkwsgfaSLlSNbT0NB0E/CymrBaY5ehZ4Muh qrvqlTkfTpUJMAKQge8sKENSPOvgaoDV2W1rZC3bWww6CHsywX80rmmN1vzomgcRQjt8AsAfZq1 q0CHvd6v7zJlTf3MBNXLpDxatE1tZsU6er3Bar3ShbrLfZ+c42VNn6ieJWD7xnOyJxm1lf6lOBd ouddWhaE54GGc8lxu29IV+0hI3HXH9sY9/xrsOOQgBtOWkUp/E8OAkK4DEscDu4kvx6blQWyYg7 XSZuhgfQEO9pBhgx0uh8XokwDgaN0SmKK8oXLJ7Yv4Qm6YYYdawvIz5i3QRrWJNeIVa0M90y2bh /l3mCohP+4yAUsKsBtrVbjf5a4YZf7VCba/64xjltWZEIFCa1OyiSSZVhPEIl9F4qYKUF66soR3 KPY/fPV1I4ws2aKGOs9BTGtA5zL1AnLE5vfy5FzFoRmKNQLNw0dtw7iE9BE3pprw6WS7wrkjT+7 VbDhyWGE+cWdYoHUW/bBsjWIoBN7Hr1VyX+b2+41hwsygEz911RyteNp7wIq7Ul8x2fIyBnKw4n TjELY1vru11kNFg== 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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/testing/selftests/net/mptcp/mptcp_join.sh index 7708ac99ccb6..597bf928e8f9 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -420,12 +420,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() @@ -3333,6 +3338,36 @@ userspace_pm_chk_get_addr() fi } +# $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 @@ -3575,6 +3610,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 @@ -3626,12 +3662,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 @@ -3672,6 +3724,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 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=4 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 From patchwork Mon Aug 26 15:59:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822936 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 880551957F0; Mon, 26 Aug 2024 16:00: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=1724688013; cv=none; b=LAYlqwla5g0PHD1aCMKGYvsUXEZKo4ETs1TSTVSWKvI/AlSDfZoCpM8NC6ZOawAbye+uw+ZEwd+RevrrpUGREuMmdc9+2d6RO4Js5KSYfcl+FcHmbxgf70umM5PneYqRqKMCrlsuAZeVziCqewcCclHTj9eGNCKTEEr0IIiD5Rg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688013; c=relaxed/simple; bh=HGVeSxEulKGiClhby5tzwf1iAGyaIukOorl21Lj+wJQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vmfd2ebzctSoLqQyN4lbNRAmWLosNhQ1/rfMBZdWQrVl38cMIUsiqzq0D5sc6IZuDQXz7gv19jqkcG5P1Alt3WzKE9pJZG5Ut8QEZM6r1d5fkCDaw/PS5TwgHZpvXGHHOaVLWM5UL7hIyxdyBLUuZwVBufnaNHBNew/8Av3y+vE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=evCq5GcZ; 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="evCq5GcZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09559C4DDF5; Mon, 26 Aug 2024 16:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724688013; bh=HGVeSxEulKGiClhby5tzwf1iAGyaIukOorl21Lj+wJQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=evCq5GcZgDEaReWkuPWgSdSox2U+siWUvVEkYx0QbpDfLOrapnwlfeRtdvD9kZRQd cAfM4hiZb7C6E6THP7WFYW1qqIp8Wsd3e2YcqQBf2O4jsmr6AWc76i6fqkrXjMhSCL 6NaLZ2QpDN7Q7CrJAc1XZCKREwuQiIFyYhK7WTlur5GN1Jar0m5C+cH/Ftbn6BLooy n42p3gkMxcrSCDYuMGMZlxqd4hVqNvVwh0y3tEoEZRYkcwF4GFMhqbx+0wf2Of31PO OqbsIYlRpJlQIEpeS9JaiAzmTqSxZ11Z2D1/B3rgVjQ69CQFK4MlMnR0gWjI/JEkVL /X75Em1wgTLHA== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:13 +0200 Subject: [PATCH net 14/15] mptcp: pm: ADD_ADDR 0 is not a new address Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-14-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3331; i=matttbe@kernel.org; h=from:subject:message-id; bh=HGVeSxEulKGiClhby5tzwf1iAGyaIukOorl21Lj+wJQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZWN0lGhwYo2NLKz+xXFYlkCtxV23bPFves4 hykP412UISJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVgAKCRD2t4JPQmmg c18xD/0ZPHtQSOGIz6dWWtxiDac50V0cDztoUx1rkMEU3VX6gQ1d6I1UZSODUFnnSIkAQTUabHq EdsQBxokbnBeURQ6tSw46/nQt7OO4F9y0ep9proja6L5t4FNHexDjrfQ7/IPMQDBbqFUkM4ZFR4 mRP+OgCVJn7lY5rZwVUqWwmHyBpt44Gt4Eysnter+HLrhExeJQujbZ0HvsKLL3O4lP7XaYMoqoE AW3/F7LDDsQ3PJL48WtZvdJ0H7kYULFkhGuCU2NV3wj8I3dWLD81obP6oFeyXj2nhJSVZSDebsC uzmtBNhx3jE3yNP0uZKfQEK+/69MtnzWUK9SxIT5/DvvHcKCLQ2R8ot/1sC5K1k9UYDBsxwt0sq J5B8SdQaIP/6H/tQz8/VyBgsLVRkaSTMb6u+GT3NoClRgfeLqSZM6Obrsh1oQCuCr69u4l6zhxj IvtnwtpYi8wXMSiq3Hse5HnwuNpuNcV5ZPBOTKRQSwh011RU1n3zCiUA0TplB36TDmu/vMlRV3J XvGUB7E0pZP6OjOFLwVUYRPB+1XRV4MZqyFK1axmxNlAdWOQ7Mr+nIXwYqTemS+W1vPhyOOdPkg kYVCebg+Np/lg2S6BmwuGbIMoU0ERxMl/pKuX+a/MI1YG5rsEBfUNFUhRNziVKj9KcgRkvYYLjP DLEUdd+On8R1Ung== 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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 3e6e0f5510bb..445a9b445971 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 == 0 && !mptcp_pm_nl_is_init_remote_addr(msk, addr)) || + (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 591ae2ffb4dd..b5ff78464950 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -760,6 +760,15 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) } } +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 7e934ce0e4ff..b6100cc23cf4 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -993,6 +993,8 @@ void mptcp_pm_add_addr_received(const struct sock *ssk, 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); From patchwork Mon Aug 26 15:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 822543 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 BE499195809; Mon, 26 Aug 2024 16:00: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=1724688016; cv=none; b=DZFvzd7znF5Rz1vLI4wjRdwUNsASWMElUAcIaBhV2p3Ds+xLoyz2Sn14mMNPpnksJ9SQPzGEJyfSyz1J9nTqvjggcyQIh35J+EO37DPNpxWPdDKVSSS6wB0BDAzXRVuyAW80FIWaz8SvdkNkYxL7DaQCe1kJ+gaLmaQxr0mEM2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724688016; c=relaxed/simple; bh=bHzBRNjE/jIpOyHCtWJBqk8TBdXr/eJElLpmCO41czc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NSJXLU5B/VfSMLVQPRebbKu1dxkzNHptFdxaL8Mt0GO8pRQVNpGVG1o7tUuMZR/NBVisq25B0d0hajYRMLcGbu6Wsb9sEB7y08NJTgGzrSJNHCflYbkmdkkY9HJLSxa368g8yvsSIopKc0D7YsYahSOactorOqwThUnHfBiijS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jAarQ/kK; 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="jAarQ/kK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AFD1C4DDE5; Mon, 26 Aug 2024 16:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724688016; bh=bHzBRNjE/jIpOyHCtWJBqk8TBdXr/eJElLpmCO41czc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jAarQ/kK2nRoPLEndXOeMKwmWI5Taoj3piriwxpL2CO53/kkaFZdYYfxgceL+biy/ DWxbYC+e52eCXTRiCLRO9k8BK6FVySkoJc8K83wlxChq32jiIYAezEl/x82Qj9ySsg 35b/7DWwfZN+mq8hLZPVZaWNZZDJfoqMXrXVbC+niO7pME3tZzEdN3PT3lTakghTNp y/072SprndZdJ0TMqZaMtI32mHSHhuflVUqPeZc25NH36f8PRhcSXYYcuu22ib6qK0 9KbywxF/oQF7OofsjND2U9DABCooyDMW2PEWqGWWB8b4yDaOBwbtkQ7wJer0XhhjUo 9FggQUhmlsphA== From: "Matthieu Baerts (NGI0)" Date: Mon, 26 Aug 2024 17:59:14 +0200 Subject: [PATCH net 15/15] selftests: mptcp: join: check re-re-adding ID 0 signal Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240826-net-mptcp-more-pm-fix-v1-15-8cd6c87d1d6d@kernel.org> References: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> In-Reply-To: <20240826-net-mptcp-more-pm-fix-v1-0-8cd6c87d1d6d@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2842; i=matttbe@kernel.org; h=from:subject:message-id; bh=bHzBRNjE/jIpOyHCtWJBqk8TBdXr/eJElLpmCO41czc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzKZXWMyY/fkS5DCKZoeLUWw6g0fYZ4wI0QcAv A8jMi1SZu+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZsymVwAKCRD2t4JPQmmg cx1tEADvDwVA9GsZcOLjwIw0BvEcxMpbeYFe+NxW8WXaCqNR5JOWGmjyboD7cajfW3pGCw9j5HA F5biWAN7x0w0PWym6oqgR0uzZEDXKe4hHN2PUUA7wFEDuvASErxkhFZtBbFmKKVeYC5FYJmxL+m 96uywOU0EOzT8Gbf11AIT5nm1gXKrq7DRpJnIT/zBarDHIIfh8/Kalxk/G5BNH7HARHlpiyG5gI bceRQHtAgymIN+DiHqQztIuC4D/eO67yq+oMu8iQ7YrUbO7GE0uFZ26kVjrIPhy4EWkr8Hhnq5p tagWd4vmOtlQjxe6v3iGYNroWgmRSo+aaaYs16JAcwxkUeDGtTpm+3IkSaK1fzLfjVTKF+IwB4H DBDDDHM30Zmo5pWAt81Rzq2JUkJqhlcGJPnqwrtsyXiltbr8yQMntsVgPm5Mqq3Rnqa0GgmwNX8 kOiLwUGW8oHpJjAwcI2p2e06NL9AuXvV9Iu5+bz32D/voRfB8JQLP66pZsoRl7p2XBKbIIP447Q COXaGu8bzH82DFGOQLLHxHow5ni9OzFXLydec2awfBljNDbow6UxJJ/PKb5d6qilR0DBz7a0sbT fclXmEnM/EWRkTNt0VVe01GsxYd/uurmyB5l6LAWZ1YNKJtL356REJu2lcuhlCgE+FMePxNjxmg M9dWoTOPgr31GNg== 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") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- 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/testing/selftests/net/mptcp/mptcp_join.sh index 597bf928e8f9..47c89a16b6e1 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3720,7 +3720,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 @@ -3730,19 +3740,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