From patchwork Wed Aug 28 06:14:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780704 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 61075156F54; Wed, 28 Aug 2024 06:14:39 +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=1724825679; cv=none; b=JFxo8VVcWJa4KSJkiS1LYYvZlMb8nTOSkL7AUzyMhH8s2CG6Cb27Qq7wxprvykhEK57G2ft3DaOLAXh0Zo3T98PdtXIY77en6HZLcqKTT/hA3BUQOnfnq2JQx3JZeuUFdxRUl5u0J2dAuS+HRXO1KBvcdDcfoHA4uqs1gF5kqLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825679; c=relaxed/simple; bh=uBgQXn45PSoGn3B85BZxeuEjozCCLSXYXLxZViAD8zQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JtgQzeJXHF8A51/bDrXGTIcmNvS48R0+jDf/V8IWBMEdYyaZoMNqm3Sb4YGrIja7GEgadfF9xZvdQjhwDykMTdLJWH3X1UAbPm9CFdfh9syRwdomhTnQ5gKd84AkzKGypv8sNz/avSkKbbGXJHClzWq+F39rrrQQA5CUmJVqEwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PgC9grp8; 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="PgC9grp8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CEC3C4AF64; Wed, 28 Aug 2024 06:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825679; bh=uBgQXn45PSoGn3B85BZxeuEjozCCLSXYXLxZViAD8zQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PgC9grp861R+uiOxXOBVLAz5Ptm1ArKQngSDoDfmByhxqmOyKuaJ7qnzanO0rSi3F vmr8na8muduCUSBlYr/jMak7K9yV1LDZz442LSPcxkKsf+AUsICyZhLMmCWVymsJRG gQhtacnGvSZHwDiBOY+QJtTWv+3L/0HebA0zQsuF7JreIs+EafTmNx7H1ffXsYbnHb ocCrjjOGHlIsrzYNj2JZPoacCD9kJ76ivwDpfvLdeucfJhIqFmpudQAfziu8BzwjmE jMDVADsQRO37+AQasCPwFUtZdnU6rioSzOXv7sTuOxND58kPp1qb0ilqTxMz4svTtw GNFtgn11N21SA== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:24 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-1-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=uBgQXn45PSoGn3B85BZxeuEjozCCLSXYXLxZViAD8zQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHExP4VpBpF16uGH0QfOO8iDSPgZ8D7U7LN 8dwpONuo2CJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg cx+eEADpL8T4COShp/huXf21uQ5m3hPAZJ+m2vplvau6BaMP8tmljPNZjgxQGbrnpDpTk0Tuzrx YbfLwsg+JFcv2la1bjsJIEsAc0ADs7aERn9w/ooPMbHrf50BAFIm2Yw8bEradBRVpT9bd4QanAV 41pId4d/XyA+W6troLjpMg2Up2YS5cXfAuULJcx70f/pKPVGKugBC2GSg2kS0ezt3Vwp9kx0M5v W7hzLOF4seodLVGadgHM5CpOO5t3TAWhERmjd3P3r7IkokvFPY82uNO/xPKUtwVXcyzZ/FAPWnY GOOIVHIcIICMvrgwp8jXEuA811Qka8wR88Zcgj85A2p8Agnq+mAIrdZn+gf3NU/tNf5Evz4YrnQ 2A+cpHZXsHYaMNxDI7vsk+fJr54Pq7FKqY/fWZatthsUtN8BCyL/ZSnmAQQxTBEa/TDwPAVCOYM fFsBYmnOYApIxeZqVaD2xVLJTjNse280VG6lHGTk10JmeKHUrehBPt40dlZ0aT3EHgO6mLVN90X yi6wCfcCRFnQqXkCOmH1d7YKBq6Fws7pxdciyWvfVsCC4CIAxKDId5J115rczh1OETugcSqhtFK O5KiTi5zhKI/sX5DuaF2tivVI3pl4iZAa3dxPwyWmULQzVtcGcaET6s+omX/jUeBFr9VlSvb5P0 mQWNHb3LBC70ouw== 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 8d2f97854c64..ec45ab4c66ab 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 Wed Aug 28 06:14:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780705 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 131031553BB; Wed, 28 Aug 2024 06:14:42 +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=1724825683; cv=none; b=bSL7E8IZjWy+XyzFBPWwJ9IW4TlDG/c1eJJsnqBL5QzqSNvIMFb+J5+8hMf94j2SJbstR0gCnbEfokL6MjzK5nXyqr65P6wdODaYHGc3m5DP2vZiTSTXM9jDbYSy5LnQutItf7IkZoS5Us+LGT0l7iedCToRt4hWkdErV0JYmzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825683; c=relaxed/simple; bh=53z/tJGrwfftOJtkqVESOfZkmshP3WMv+7Y1+hRdczM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=utDLzZf7LCLfKamd66eD9nVLgHg+jJd4zepGfu5v1UaUKmFfgmlPU9VO+gWr00XLN4RT2vd64R7I4jP9Rs5HvX4qEw/lMsXa2fiYGDrAPl01tCzRR7HZ12KIFyRU8Ogf/LWdIFLuCzw9WihQMPyT/8Wkcz1wygRFgItrgdxj1UA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L3XKHtD1; 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="L3XKHtD1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8F8BC4AF0E; Wed, 28 Aug 2024 06:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825682; bh=53z/tJGrwfftOJtkqVESOfZkmshP3WMv+7Y1+hRdczM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=L3XKHtD1wI1UkNygSSE3d6pBxBnxNnxNW+Q8BuPXyFC+Wx9z/McaKV/TodYKIX7q+ 1Bj8bYbQb1ZcwDSzw/s1AojpBuintXCgEM8BliFoTv44L2pwVDGx76HREcp0LPp4wR oGjKo0x6lJjmjxgf+N5pgGcsgLLyc8MlQTS+zN4sZZ/NdgH4EFPWRNncV7zxhpOglw s9WJgk3SOSVrEMQR/XrCh8GTCkPn7o/4UC3p3FqO5uuH9DTYtVBOEsmOWMmnUIWKvv v1DS3YXDMaIXruLTymyduEI8j8VhZm646JvtXoy/fGaMRYw+AE7kZcHYTtooMz/nuX ejzw7XO2KnhIQ== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:25 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-2-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=5045; i=matttbe@kernel.org; h=from:subject:message-id; bh=53z/tJGrwfftOJtkqVESOfZkmshP3WMv+7Y1+hRdczM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHmdvAGSl3tvubQFCC/3AuHXncIRBBgLPy4 1fkIG4UzlCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c/S1D/9VGsN9FmWlrzGQC3v/mdf7v9euPJxP3T6V+dI2WTDhqDpY5ir7ms6imuiOh37ObvXwaXf BaQJLWvnNaH1i0mRxkbPe5xl5YWYt6f/lCqdn5QaX3g/zuH68uOqV1A6idgak63p+OF9rh75gxI Kh/erl7VO83yRklNJfK6ydT0wiNd5cXoyMwCjgUEnFmdTPsYbgCddzXHSkQlKMdSMQh1jCfnseh pzjLiO1o7TQ+tlDns+10Tefh3wS9Zp9+Kg/xjKW/neYIyQIXf2LQXkCv3FConKcLuNIvs/tr6wm aI22iMrKKqAp0Q4PnAhOCRP3IVMB4PFW+Q2zDWc7DFFvvlisrNz/DVrutOERubZxd+7fdiawUjd 0nVqx3CxiTEYCaknfxLmGSnoSp+70mr7M07c3YXWgvXM+q53G2cCMwTiOFcpixdUo7x//oKcjmW jFeK/MXuK+5SW9I6td5Yrbjs5hzYUIiZixGnC/sDwtrjgk8NPiLxz+twTCXYhxG4Txb8cypjSM+ /Y6UxvlM83dMtKRvsAtrLLo8p+94p9IlbLbiXyYO5M7h7uXyvXm48C2A/6jcVFll7DEHuL4YHZS 4n9MoF0udEmRIYXbX5nyBI2sC4nF2x6zLL0x1muZP41Oxz86XWKAzi1mX5pH+lTE0irkghxXeyF zoCu00NEq8dsWyw== 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 ec45ab4c66ab..42d4e7b5f65d 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\n", @@ -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\n", 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 Wed Aug 28 06:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780706 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 4AABD15884A; Wed, 28 Aug 2024 06:14:45 +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=1724825686; cv=none; b=IMxw16Y60sdpTqF6VhEnZS4vArZUUum42DUAP0H8bTb9bna2OM1AqpQOuLFuHBKNg8JcagYM87sBxyBRIGKXr5ABafLjqXJHtpc9fEvf0BSbPH4eSGddnuhC0cTDMLWgblYwY+5DEMfO8D5d9Zv6a2kkvYwb3HHUJfOpOAkIHno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825686; c=relaxed/simple; bh=rspq5cltJ5/aifzNjtqUEMqUuelynLyRkb8+PcXCIe4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XcPKg3SkXmfusw2NfOpe0jIHPhwVzT38PbwLmkLwYAdu81fw66m+25XFAUF9CFUC7ykXh9zGmmCMlNmx/GNyBhPDKYzqdimPVyMcjtCEHNC5holoE9vRsNFXWXpn5KRfCL4YC42fi8sBXED4bRnqnT7S6La8q1Me6IBS0TrJ2BA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ebgrqZ58; 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="ebgrqZ58" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03E3CC4AF5F; Wed, 28 Aug 2024 06:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825685; bh=rspq5cltJ5/aifzNjtqUEMqUuelynLyRkb8+PcXCIe4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ebgrqZ58tUl7ggI5/sAk+G+otME3m/HgV7LdCFdG61VnRUsmrDUipRFYgmDKNM44G /Q3AI257ggdFFN5vh1TfTePRZjo8p0/mLpgIN20R6VPJETesvxITKzTTgBd0ROy2eb 391CWXKxmHDkJKSQnfd4lXo0FKXNhse1ZvoZ4IG2Y9gdiaFuwL9lA5h01HEsUDUyvX XterDaKD2GGitvUt3byiRcraFhm5Z6piqWleIbJ5wfLGfRKFRDoB3K7KZigKQBfJmy 92Sx9iugY60p6mVc7kpxZXaf4jjFRrnipNd5IhMv9pzstPIDzeHIzjTb9zDtenRgDo xWSqRWsHqpBPw== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:26 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-3-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=rspq5cltJ5/aifzNjtqUEMqUuelynLyRkb8+PcXCIe4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHNmtrl15+KSCwAF7mPxDMRkoEedQFvv/1v Q+mvyldXYOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c+tREACpBRV5wpmC/d7ezjr3zKn9PjveOcI7LVbO7GbqaFXnd1VVgcH9o/5V9LAI7tv8AQX1VN/ 85o+TtIb773GjkPV1gj/+LzFVH9UZdmWYFPJWQ9pLutScwvgjFJMrhr4uvxJ8DAhh47ZjaiwVwU EhmeXNfrl/3r6WZWLG4W5BJm2Resg0qKJx/wNkcXHcyB+kqrC7EWgD5qPWMtZ6oIMtGPUHV8rGg f4dIWrOn65cGJLAAV8xHwq0Cx2U7S2DJ+gy8AqAk/vtv7CdLryNs34rlsdtgsjW8P2ndwvHQ5SZ r0ugJ7/ejXhC7WDjGI5CLtBbdieGu4b2SkDPzjPTaxiEBxbNTQBXGx3bbSczS4XGVPXJCTTbF3A ujzzmMRf0nT3J0IfDSR+7+C0WD/DLnlv3dF0xuSfUNsTHa3xGOyVF07rI8f6vw39smFkxDEeXmQ i0CqJHqA1xnXt5jZ4hCGFgyQzM8JUsjRq3rvt9t6vM15hcm43YSD0c9s+ayLAs/c5l+faflyxbW UgUW1gXEhEWq8CPGy7GE5MCzjaLZUIxdIsMqJsmrW7jHNwRV/XGa7mh8y/44GPcG4PynK4c86Xc RWRs703oAyJ6JYWgO1uWAsAmPMQBl71s/0R/1pRNs0PgXSAiU8MGXxUWLWUKLfP/kyLbiu++iOg Rt3qB5J4Xq0m81A== 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 264040a760c6..8b4529ff15e5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3572,8 +3572,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 & @@ -3582,17 +3583,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 @@ -3607,10 +3608,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 Wed Aug 28 06:14:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780707 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 929121591E2; Wed, 28 Aug 2024 06:14:49 +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=1724825689; cv=none; b=HFKn/fYCUFr9cThjhK1ySnwm/hu2rsqr3JUrD+iB6JfkqpVkoqtNJTVL8kdlriO6u6ZyoCv0noQeMDnjUKB1NXDSOeqWTuFCA+mcvamqlqXdbgnIjuOhROGFM+WbZk1k4jfPkq4jGF51/2xtMiBGWZe0CjAQWmBp69ZIK2Y2e60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825689; c=relaxed/simple; bh=/MonwW2ScW/5kgkZiEMOigLO/IShhzyhY+L59U5xLlo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BlU1NYTD0ga14qBds4vnHGRqR0A0w2OYaZMkTKXRJEGAFjpe/3uPuGKkwxsseNcddR4riXdwLJXQixGV2q84lHx95UjKPsx5LG0g1sHR06xLZIvtL7nXtv/0hl+Stnki7T8HQQs8+hf5j/n8Ev/IUB02Z/w6bYwcf/tGSWtashQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aXojYHaR; 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="aXojYHaR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F525C4AF63; Wed, 28 Aug 2024 06:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825689; bh=/MonwW2ScW/5kgkZiEMOigLO/IShhzyhY+L59U5xLlo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aXojYHaRK+yAlWnGZ+wN7sYQg2Ekb2I1rg3kGRKG33Npskcs1jZLP1t+4PjaDnfvR OpYCV3p91WjVRvbjzFxGne4I9V4ihTVu7kKmtwy7nqlsIZ5YTq8+u6fYc2Fdz6E+02 DH3wp4DOTGJl7VInLfRTzjNLrPtkCloRX4KgVobTYEf/wAicDrh7GHf0qPalec8Q/1 GmvOV4JrwypOHHdrHLk/lFviRWb5yPWNO/8EjP1tcUpi9Vo9qfaqsQ80IYh+rlmlXG dQQetlNaj3onaplTCNVZy5Fjjib+ql5pJusl+phZwfnRSoZBd8NBMRgJiQ/wpach8T dQykcYxf3wKpw== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:27 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-4-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=/MonwW2ScW/5kgkZiEMOigLO/IShhzyhY+L59U5xLlo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHpdIgOPBOYPG+V4vJJ0nUDF3XeUkNf5bR5 Vty9TZxaZqJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg cwXXD/0U20KBA4UblZsJghoO/jmAgMGsD22GEcoVNt1YyPTanEawTkAOCiizDHirEqY3HzK6J+o 7oDicZXrT764hAMErYgLmnrTxDnuMhjvKzegx4mkkbBHg0/mPJ6CEjsjta4OOUR4MoufyyOimdp b+JTkCC5aK6Unr7AkAa2A5DF6iDY9gTHqbMAGO7RR9gJSmlIiCZZ+7LBnGqvQMA1+t7TeHTE9tg oSbGoeviqjbdcyB7J4xMX7PCTfYSJIlMAgU4NrETL76d/qO0055wRCnabCRenyCbXnWwVLNjJHL EOfELjFxibKe2Rt29pCJpQHMak3IT1rQXabohSJUJkpvbcp6PoikNqiGBpYm3y6eRwI0tND7eiB 1T1dOHFZscfJp9tr45jN6CtZIN2PfpFcxpRhITZJYyxqzudcpR4bYOF+sgLIsb1C1T3gk/4YQjF MlktGoEWBJMX3W84pPxj1qvqitplgPEXtPl1upLIe/+1U0DlgO6zD/mM1xoyoQyI4jlQJjteGe4 oaXV8+MtLWnTLtCowmpEXT1xI8DtGX6yWkx0z82+BEkExB+1geJeQfhmZ/TA7fTKxqKU1Lkxhix KV/yLnL12rdKEmYVw40EQZle3NSX3rh0LatELKkdUKtYQAL2s2Jn52dBtS67Bjzxa5b1EoI1NCg yGSiB866mAHmpzQ== 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 42d4e7b5f65d..ed2205ef7208 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 Wed Aug 28 06:14:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780708 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 DEA5915A84A; Wed, 28 Aug 2024 06:14:52 +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=1724825693; cv=none; b=KF8tkkT7j4OgNAgS8uG36UJGhdyBxqXIEGICDCkWdtHLLe5pIYXfJVjsdKg04vx57vbpx9gk9OVuMw895kV8sPFWjrhfEwmDiaxknejpXt23x2b56jXd8+ODXDRNZ+dcsHkrAt7I6Uh0smbmjYQwehjDOnCQZXUq2IRbxoiTYGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825693; c=relaxed/simple; bh=qnbnrR81GAF8Bj7sJdSNyDd+ji6i9sPPwydt+P/sbIY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qhdVqGMBM9vn4c55E9tSa76MtD/y1j1ehT/DEbdlZ2OZWIPmiu5Biskdj4MfklrdhQH4Gl43MlDcQ/Hd9C5vWj7xiSzDNFAACXDNyVWIN1gn2YDxi6qwRcr9Hv3Nf7PmlW4v+SoOA3klN/9P69OlVJt2utFzOsloBZ20LTvtuIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S1MAjpLG; 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="S1MAjpLG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B02BC4AF60; Wed, 28 Aug 2024 06:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825692; bh=qnbnrR81GAF8Bj7sJdSNyDd+ji6i9sPPwydt+P/sbIY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=S1MAjpLGeYLkuCv5KXowkW3HGBjXUfA6Z561nsFBLZPU5VVNkQAno1dB8vpwiw+Jm SebFC1Xe8ci2ptuz1Qf7Xh/C65yjrwJyMIdTM7RjN0UtyUf84loBJEz/vJL643lYo4 uPNXd2CSNmPCkZ/hQH+Ox2no/fQa2AygNp7sFK+sURfj/6Gbqyg3RwuyvdyWVQGVVb qqvy/qiFoeoGY/mMrgRHROC7cR16EsJ5TbOrXAnT/Z8C+dyJPq61KwYLwnjjs6Y7Lb yRaQzlRAahJUfDPyEIr2+LqgRiGVGkKw0z8ced+O5MY7S5pisFFf2anrPohCrmD/PB ogZctcPvo0Hjg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:28 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-5-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=qnbnrR81GAF8Bj7sJdSNyDd+ji6i9sPPwydt+P/sbIY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHe0L7LQj+ZMAw7uoDyJOIbEhbKJ7U1ev3V t3mRxBocKyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c5/0EADTkyYLH2BlAcbnjygLqERNrbQcXHxxzwVofyRuHs7/B/sxigRUw64jUQmQ/lqBl6GYw1t AKHicf5V/8zFuAdRQeJ+eOqyZjkTvbXrOEGyViVMPMSXiD2ddwbSXoN/548KLwxVagROl/13YET oaq5d7iJVH5bG9bk8+6s1BPXtHp7HDOTCOYMWh+iWRa/6lhbMQWXVpI4sVBQX2NWpAMBPdEsuAz 4s9HyLLhuJZ1KIb5sDnOkq1U0dXy869Q/Ftg2507PExlLRQ1Dl9aiM/pA6TDAS/jPh564DzbLBh xzwPHw0yL+3f0jNJtTCn1sN7w8PQXL6V72O43yQ0SYJ2rCBBp327OcTRpZ6vpOSFSScHYymPUlt dPnw20w6LefW8nNoMH9htD+0tHGpofht7cLlVNbmFsBasEW4o/Mee6LETafghXuR31FopNRDm21 F3b7QeUDKPfmNEkup3cpdeQmO3F0BPfIdWQoVwtLhHKqUN6hULeDg6U+hn7Y3oqVW41yMr2pcHa sUrHUISwP7haGMb+aUhkcTvOv/foKu/FYxdXg3nXspHmknvQbJhzSWNBePXDEOk1x6FdCE/uOeQ yHuZJc02Eq4QTcBKGFfLEaHvcwb62FQVdsVjjkYMkt6gwivEUwlWdgCNovBTgjPAZ6lVUTlQUgj GkY15qDhCRObm8w== 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 ed2205ef7208..0134b6273c54 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 Wed Aug 28 06:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780709 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 3970C15B0F8; Wed, 28 Aug 2024 06:14:55 +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=1724825696; cv=none; b=suN+ApDwzVnB8mYfZB6Yhf8vY3wt9cdcJE8Tv8b8MgwsnYE5iMThFW2j2FBrSktvUeCv1oQE/SJXqx7fvCSTfkvR1PFdlSwH0VWRnuqG+lzcJKdvspLm0F5nCbi8V8+mEwl6cQn7ACVIonGduN87UlP9lObg2tJoSbk9NslJKOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825696; c=relaxed/simple; bh=T6SFDsF5FaPC6VnjZh/IuWMsfOwbCw+rgAtK7pLX1uA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pYq31yiORDBJY2CRN0Vc3bBfZ1+JPkFhFmLLYvc/RwggY6xxKwEQhYnNZwzFVHKKE0fUYzY4j9VyBRCdmoeGp6HVpKadwy7cuYDmvDyspbN1xlHBc8D4W3+dy2a3qnvxK+PZdhRUr/EOFNfDNxXaQWPT+Ogp8GnuCNV/u3902AA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t5/+9co/; 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="t5/+9co/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E591AC4AF62; Wed, 28 Aug 2024 06:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825695; bh=T6SFDsF5FaPC6VnjZh/IuWMsfOwbCw+rgAtK7pLX1uA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=t5/+9co/gV0YO2WLAruhndG/wOpT9etFhmi+3SiPOfQk9hCox6SnxgJAkFMUB6HSh GRwffqlaL6bMnnNfZrJZ1az2244KHzp7G7lvXz/CNBz475ME28nqDk9nJCjW0YR6TP Rf7obIKZGO+ZBzO/wrp8z/A7/Tt/kQh/YP7LEE/p6NSX/gwZfkZMecY3GDxZgPNWne pvfEID61OcrDz49iXl7nIKJ1wmv3y89Yhr2/C8Pza76McuIN8xfFm1SyUeUIz/t1H+ oBUlp/ABQtEHBwaoSnRQA4NNSuaS3dDxpO+7oXfL1ZqeLLnCAd+DNUHj7CIyIa/z82 ovukok9SzT9Eg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:29 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-6-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=T6SFDsF5FaPC6VnjZh/IuWMsfOwbCw+rgAtK7pLX1uA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHf3U/OHnlSa2s01CAn3boHlTP4WK6fCLGL 7tRG5y5/OiJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c3uqEADLkUX4Pl7IWwDTnTj5NRMOFvsQAHofmOuct3dFVF32hYaTAsIeFtdnGPvxEgnhvu+SFfN gmXfoO0LXo1LN0cPeH8ilICezFeKseR3zM6UVZJ13Hl85McC5ZvmFH7sqvd3A7YUG1KKlXZtjat jfEAgzZsPkhsV8ECsRQlaKQwrDIr6hFWmzM4Vg1S6+JB1vdhpHc/lBzReZeER/lidcclnvjOEG7 jgsT/Ae+ZKat0MApLg/JQ0fAk14yphU8byoQRGHi1I8FhtNPYAOPzZ7OTVcJ3tk7DCgnNPhujmw tnFW9/SY+mgClxyzxGnlBQlkY3CE/wpLJTHek1+TNoFjCVzZSJernqX/CTN8q/AehWUPHJZTK8u BSQD/3c6UhBCjIQnbn+nf8nAllUIS3csfE9IIony+B73VgU7YWe/3Nitvnzsi85nEbluz0HwYlq c2tETm8Q7sU6WFoX5Mvypqsk4aqXd+evnxRs0vvhpEt1PQdGNxoaeSwm49Ez2p3bqfOjuDLSzKs U/hKqjaKyVdhx49/BJiCNqVe1pOazauLLOHT5eURbcM+msV0HDjBh1JhwYaUyq75pdhKryTAcP3 HCmw5K9L3eZQLUbszBqonweR35psNx0ftv305H/ynPAoPEG36XV5tmdGAhbCqzTKS7/W+w1tVar RDekbZRJOrZE8Zg== 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 0134b6273c54..5a84a55e37cc 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 Wed Aug 28 06:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780710 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 815D915B96E; Wed, 28 Aug 2024 06:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825699; cv=none; b=WEhh2FDIq9SzgR3iipa3LgathmMO0t5BqObxYBJ5LOlr6MBcE3H7mcDDp7uE4+QALqRX26OtqOiVwOPKdGgdICTB0ObokW8NEnthYZ/5EAZulXiAW90A95DK+IAANCoi8ZCB3O7dbO4BM+vNJRGiL1g+RC4dP0mYcc05RxJr6pQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825699; c=relaxed/simple; bh=vMJXgtNzCq1MQ/P3LZ4AgVWlu+IqbJo1RQWHkx6fSdc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HoJJjn9vSGxazMoyhc637UaMHaU9wS1uugbCkNFKXOfeM1dfuO3uga43AxkkVk4CZ0N9hNfqy0syDZ2X52e4z4XF9KV8DUieEMTRlwETdabCHJh06QPuqU6DfpBGbnv7nzOHa+c9Y/ClhQrSZaZM6IBlHbkVe+tRVWgCkX50d1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K9HTfTWW; 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="K9HTfTWW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7DCC4AF5F; Wed, 28 Aug 2024 06:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825699; bh=vMJXgtNzCq1MQ/P3LZ4AgVWlu+IqbJo1RQWHkx6fSdc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=K9HTfTWWpCR4yH7bXBB1gZoQ2ZoaAk4ccmOyWRsIySpswhghfNbGTSBJ8k6UiOApH uJoYKsU51czjmAUtA7zEDAztdcuJNoaDbUZezDkiLLsVJ6axLtmJWQHY6pQiQRwp0q ixWQ79xsNC0N+7RP4HakX7tmbF/xMaw8kK6YpH8FTP0PfitBNOIiVapPQMxCjMqIzy bcqU+7IACF/ifHJR19F7uVm3xoY0wOHHjTLiylORG0Ghwf2Jqs06yWj8QtgceMAoz8 VRndJfbZ1C6feGxBHujWLGPuQHlzLRfrwiT8UnP9Iod0rS0FusnLBT7kuY0GslORDR qpOOIVqm1Giow== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:30 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-7-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=vMJXgtNzCq1MQ/P3LZ4AgVWlu+IqbJo1RQWHkx6fSdc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHrq0KXsPkE93oNUQbn11HLPdxjvWwctViQ QsZH3k3DISJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c7AJEADWJId7u+4+A3rKcgQtvJXqw47+9yxkIu1zNXntEKBXqYXoWVM+66F9DvNyZo2PyDFdjr3 JfIuqtPP1LFJs21GHgIYcq/R2M86C8CPQ6S2GJYaTJlZVpFc8xkQiQEOks7jctNvHH8SqYGgaRd XccGFQL8U5EiWxYTB1KnH169ONLsYAzb3mz9J4yUTG2udQd+bWEKDpSaKrFOm/dYvM4N/8RURn5 NjxLvAP/HNRu39tC9aBjQ8oSrSkwpcAPE66Ib5a0KI7tQUQ4nwbdXRXQ+HPPE0HIiUEH+4ADfkD xgtuRfzKthHJ1WCrFB4Tp2vn3RQ+KbEWljHUyZIux3eqH/A+T5QMu/893u47orY1a8yDfDiDp4I iS9uzw/Kgv9PSTcpqlZs/1bMiYN5CmCmQpz5gc6g7S2a+dFJLuXIPXeRGyUvpwTDYM2/ELQFJFS 5G51vswLUR1jfY/wbwQ/AfUE8LqnkSTg2mWQRBgECwoLd5MEvxl2da/2kx//0PPtfYAtTOpBZCO RaUAhg/xWEZ1rvbPiW608TlhxmpZLkU90V3oBZ+5T1hSvy30CFApEcVWgfY5xu01DAHsAAFwcn9 rqTm5eQUjwTvjtfocM2caD+3QWFXElmsWO6Yd6qejwBR2nXU7QGBfg/m8aqPmh4M7Ncvd6LyMiE s2vWxeJpNdW42jQ== 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 8b4529ff15e5..75458ade32c7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3627,11 +3627,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=$! @@ -3653,11 +3654,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 Wed Aug 28 06:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780711 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 E0F1415D5BB; Wed, 28 Aug 2024 06:15: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=1724825703; cv=none; b=DPlwIr9kkXOuiFAr9yN3mrQs67XdXZGPhMaCIXa8OQemX3KIyYktkYLoeRgzcm0hPfr9gl56o/bMFuUxXqIXxxOaSoijmAaoyTjfd1pmbzXpcQQFY0PKgN+zMlAueRDOLzRM/XVLqtHB2eXjvASXObNhsFKGl64rv5sZuE7TcV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825703; c=relaxed/simple; bh=zD14IgkrP7F9qwGDtpw5DaWjyzIIBMIxJcVVx+IfUhg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lNHFXerFQX+FjwCNQn0vL64BOkYzEvFXT3j+Ar4V+QjAX96s/H6AAmVu/iukSFLA0ZgKFdhdFnHXVwjBjxSwYhMaD8rxGRegkgfVAu8uXQkLj6jCQVgkkYKgg1lIkN+LMkMkA3mptJ2xFtutxcqiecKUgajowRU1hEK1OhGqTW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=An6nV8IF; 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="An6nV8IF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88D92C4AF65; Wed, 28 Aug 2024 06:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825702; bh=zD14IgkrP7F9qwGDtpw5DaWjyzIIBMIxJcVVx+IfUhg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=An6nV8IFGFLbtVS9sYfmFzSEKimxlgdF7zS2RZZXzB89sX5Uu6gTT4Nc4VJyLbn3n Ugus9oOc7P9rE45eAcqsQ+qVGfUYi2H/f3mKieeTdSngMVbMAV9wXnY9kjfO737mtt 0vtapQEe/KZMkGHWw8Nxchx6Fyo0TV+wpElxdltfGFLJ+KebpjPZRCXvActl75tF1W yfq2A2T1YoTiyq9dWPttKIOMYNrvUIvGcX+3UrswzmW6v+VIyGSKwgItj3g8f0rU4t 24q9TVq1J8AUgbCsVlWWtRDwtQumBMcM93FAwhHSZuG5/9UihDkFb4MawqcVwd1znP 4EYiTftt1GujQ== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:31 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-8-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=zD14IgkrP7F9qwGDtpw5DaWjyzIIBMIxJcVVx+IfUhg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHURmRg1OCRlCYFNTVLv52hb4Ntq3OT42Wv gVeb4/ZHfSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c+06EACsiAC+u38CZcjgyOs5BHlbt8mPS5txOHGL7f8xp6uL9RfUI99xoAsV/osmVBn9qQESOX2 M7JfyHF2qaK+OaJBM/CUN+EicrPdt+bLX5qK198yAdYk7irYoVVTJ7Y/Nm/LeENW7Io1WNwGrKK xuaaaJ5Jxib/JaEMqJ+F3gnsLlDOA86vCsdSqo3n5MZXWD7OkE0h9OrbzO9OyzhYkcEewguetiv R3hsH9O7i4bWSPqTQdlI/Q9ErLzS/8EYjVonqypxmQIv6I/sb/BZu/HbpFVYOaZBEA/GcrQ8OjG 0983QGJvYC1E1fVOEddnrXq7cjfUUZ63NMVCFutBtAQSjDLgahhymvovI0VjGzu68OiobsDvtup 7h2FBRX2zufZT6MaTTLRhNPPfsrDJPOxbFZIB5iIyTSt8ZVA4VN6esrG9oAPzlWSgQEuP9Beylg f3KtDmUvso7yNwtsxUSf2L61yedkMsyNIUp1Yun/sIQNxPJtzW6X4rsuIkTbcupCthjWEU+bNY5 Rlvc1gpSrveo5Hzo+7vzcMIL7oC28cyb6oF6QuUUkcuCEtSVe1FGcaQuBgkmzFf3+icMDf2ToVZ xTk1lP3stBtO8rqj0XrwgHntibYUB8LXZkI+Emn2xL6DJma1U1w/9aGycRStTDrqY0jlccJoq3M TvyA+NtsHiWmLSw== 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 75458ade32c7..a10714b6952f 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 Wed Aug 28 06:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780712 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 313CD160865; Wed, 28 Aug 2024 06:15:05 +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=1724825706; cv=none; b=n6xIXpXG2nu2n7a6nAF1m4zAmuqfrv8UbGwbFCiJ3KBuBvW2TL30/QnMNQQAC8I1+qmT2o5/HVp/q2NE418enJKg9G/PUllI33qU202BN7n/VbLTchymp/Pss7yzQFfJdQS5OWuUCj6Pb9hx+kMrM5V5HcJGyRlr3jzBDq4iWUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825706; c=relaxed/simple; bh=t18cAZFBKR5PZAJDXnlkhw1VSFnUb5QipvZp/exIpos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fGiKMOf9dY36g5LQggrYlWCV/OfQdoeQZWOOoFpxrrJ5jUBzF1MdY2HsfGTLofJG+Aqh23SfoBjrFsW7utgJG4tC+jagyl7bS2645gR4e/MNn93tkGEFf3+51gsbNci/EgKL9MWIllhbiJIqup2fCUq0oOO+EOVPmL6lEHRO6MA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iz05o5Sy; 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="iz05o5Sy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D706CC4AF62; Wed, 28 Aug 2024 06:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825705; bh=t18cAZFBKR5PZAJDXnlkhw1VSFnUb5QipvZp/exIpos=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iz05o5SyLn2L/S2PbrG8UciFzb5/kyXy9jYcYlki4tcn88U3dxg2qCbVwkOTlTVXL vGTQbvRsrzy9XN4muG9tNFLJwXrrjefx8SkpP3BvG3+/0kHComOHbMqYEWnP8zkz+a rJfq0dBPKpJijQ1FxNvKvq9yFzdGFVDKCVWReqs9ybuuuekItpqv7yh4G6sfPy/dPy MmmEPIyDKOZqAl28VQhFOaLvjgR4x3a2bMaww/pWJDKcgsyV7j2MP6g7Vy/5XG2Szo Y9cH7Q2B2ST5w7rVJhEL42YT/WwFXnisTPPcLJGUFTm+AZIUMN5VVWfUW8rLAxOKhL nZ8AYFGInspxg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:32 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-9-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=t18cAZFBKR5PZAJDXnlkhw1VSFnUb5QipvZp/exIpos=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHZNo6DRBLyahuAKxUFW2F/sWwU2w5hLMPA xl4uJrEuUuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c11bD/9UgWbrEUHFbBWA8RhkV3T62QkRvCPDc3lv6dXv5LNWvsoVVrrsZH0+8fb3YiUucA8FcAP 6ojWg33vNZ5bmsZLTdn5ltbzgzC2+zT2al9ZramFZpUAsmO5+sa8pOcG+Wbx/RUPlHQN6bgY0kD 3CslxJP1lXHTDoP1PlytbHg9WnaREzmT0t0oC3UcUrY1L85lY4p6lBcYtPna6aK+S2fMqTRJ41Z TPOjy6J6DCQRssD1QKlUu81L83sygLhjrBQn4vHfjZllPhrwYJkorPu50ryVuIFnS5wylZLXtRk SMsUOvBLx9zWKTFB3TU3uoPwq4P0p6ooep+dJOsOo/+9sZF+IqfM0xfoJJRWNZdv1aO9xK536AX /kFqD8GjIsnhLE1LuKOTeseYHQOGqZUzXt+7MEs7418yMAnZdvj6GCBPRZ5Hm/fXEN/Dxww0vhk xKYxOrGCWOHbQMJV71wbZNlKzPaJaLiw9PLR1IIV8/2PBJK72/o+vC/7vA1lJUDvvW4SBNYU5p5 DIyfaAaaG1xyfA3gyUj77pnYZD99pyyZzfvObh9ZR34+qKh7POVkaUYuRv+DHlEH0X4k5nsjsCx LhszIUOweFk7VDU4kfuu+Ohy9tR282WNeAN+F/OLhaXuFWkcxHtdGyjqjetnZaA0OIbmI2puBFu w6crXf+bYfeS/9Q== 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 5a84a55e37cc..3ff273e219f2 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 Wed Aug 28 06:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780713 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 D472514883B; Wed, 28 Aug 2024 06:15: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=1724825710; cv=none; b=ga/7SqBzu1mHxq9NDqgBhBL5BBvF4m1TPUVru+pXILdj34pZQG0gysrL/2QsHBwHN3YNX+S3R0TzXs0oeM5Tsp7jwfU4Ygel9kms0zvpC0JuyeZmReptjGX7/RFoSzU68EPpeYIuupZGKeqZ2baAXOcsdM+Aih3Qz60pptthV8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825710; c=relaxed/simple; bh=9H3YWMjD4jyQ1Mei85a4WkXll1ThuEk4wCuo9BcThtE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OsRuW2+lgUXTbGQpKBB9tgIVXyb05IoSN2Qno96FKdoXczth5q6/CThVaQqaKi9yEG1lcJNcF0pEJMsT8k/ZKyJjrNNiuvy57N7N8HOcDJUQa4nFeJYUT7E5xhxzRllI0Ubt/4Vqf+d8/G8zaOdV13RH40td+OKwpI+Do5gWXmc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E3GsNZ27; 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="E3GsNZ27" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CF07C4AF5F; Wed, 28 Aug 2024 06:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825709; bh=9H3YWMjD4jyQ1Mei85a4WkXll1ThuEk4wCuo9BcThtE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E3GsNZ27cD653eZH2sRv2xmHKQ9OMFGjoMkMpv2j8CzmY8NaZ082vaU2mjzUh6OhF bMy3o6XH5TqzdniDm5fhe8oHaY2ZamZ7meYrO5N0QtLmbLBULQ5dzSWy/H0EEN6kB5 C3JHfNXc2Gu5Pon5pV1B4InV/jE7M7mg6gD0rQjdb1yd6x9/lq74GRrBuVYuqWsx2W XV4VAki6qukGoZKFsmPk2GSWEuUVaOikW0axiaXX2JVgtdNTtaYyIFRqYtm1sKpBLK UUXYbE8UxI1Sd8yAyif0VSmPxYheGNz9DhfmWARNv1i3qm1lDbjJeKZvIoepDrGcm7 UTj4+zQIAfVRg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:33 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-10-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=9H3YWMjD4jyQ1Mei85a4WkXll1ThuEk4wCuo9BcThtE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHljJG4wnjeg31WnPzjrjJHDFvG8MvE257X duBT+VmvY6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg c6NjD/4rY1GH/+dGM3ofqnsjUtHVrSkafv1uv+qfYnVsSto3k6XufQ01fN/JCluFANrF8ta2Pte Sy3mB4K6uHgB877N3HPHPokKjKSq04OAumENJWwcjXnIdfP0oSpMun9ONPz37EDxKZg7k0wN9Rl Wz8TBjtuifUBUoKFY6H/cRXnhUy4+HQaZxEatTYcqfCeOFufwUDSZXPNHY8aUDKCd2+tuWU4Kga D82+wAzy8RKPuSFZ5bt/X6glRsmPptW0GRIIm+pS4ONJC/FLlywE+ugJqaGZuidkRSn3P5vTdi1 5ua9ferotaGCY9dF8ZLApv1+g6oVBsDb484NYHwNpKCda+Nc5AzPyqkZ/l/KAtu079yT6VPFfAp jMuh8v5kD34EEXQrJ5EW4nwUVWMzljditthTGk+x05/MaIMZgCrXX9eRZEUTT4bsf5U2e5iAlMQ PPPmzomdE6cTOpzB7JVU9BhAfDJ8aVNcwy7My5hycpoUTtnH7B7dAAlEyCIeiTHLERuZO6i4j6m 9QsAXKjJvflgvPLbUNYAbMzGZYF4mZk7aSdTON9Ge2Rs5SBOJb21OhDMP7mAxmXTBu7uHCgVHbd A0VlQwuYNORNA07TUlERRQFa8rHj7DkHiUyBpyDKveep7eZSishx6bRFZ+oxsxy9JUq6FsK1WGC i9XZDsPLBz5sUNQ== 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 3ff273e219f2..a93450ded50a 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 Wed Aug 28 06:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780714 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 2A5F514883B; Wed, 28 Aug 2024 06:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825713; cv=none; b=NRh8+CNYik5BS85V23fxyph5y573SmYISVbbQZnQoTBDNT5/g4mKyloKJ0kbEnTgf+QsNW8pw2kNZ1zwS56PIPc90EcQF1zj+/4R4AgLfYoaPZmPzCkt8GYe9xA+WAcp7tAJGFXNGnvooXWwX9UTchNgJhREdz7+vG1AUk+yBg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825713; c=relaxed/simple; bh=A1J0kbgQ6pNp+/oNsxHOqRSA/QlDKuy6GV2otIOgtEI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T2GASbIcMvw63i0RvjV0M/NJSg1YsMcrh9oBnh5TMe2Cd61DKjbKPIRQNLV0ErXgg+uWVngynJKNC1ybCxXxPIa2Eh+yUOeSsyP2KVFMLyNvHA3l+bD6rmVl2za95YcEx6AcW8lsSD9sELivo0zNXox5bc0SmYDfDb+YGKdq0lc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bgxyixyy; 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="Bgxyixyy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6E39C4AF66; Wed, 28 Aug 2024 06:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825712; bh=A1J0kbgQ6pNp+/oNsxHOqRSA/QlDKuy6GV2otIOgtEI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Bgxyixyy9dcZRyyoTyMNvpocmLlFg3pubncIp7vtSgbayEnOKd3xDQFFiDRF+QUSv wzswd6nSblmanQ8OBwmMoLcRfM5umTi4NpHfbzVy3etnqVh9wk+DEQW8gIEZot/R3T M42HwyW0wQ76z3AQ9Bv2yRfBGUws8p62ZWXLoNCGJwtVXwIMkmRSg+Z4usEgymsi7t H7SViZOZt+yOevIwDGpLlxyi1ZYE7Ovc1he57CuJaRX28dnSpbxgJ7URlpVHkLUU62 FqJ+VV7+BUORNjgApzMVfx9AaNIdvUGVkRwoqvWIzAiRV4YkeYCb9D8pE25DotnO51 O0bJeWRJx6SXg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:34 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-11-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=2831; i=matttbe@kernel.org; h=from:subject:message-id; bh=A1J0kbgQ6pNp+/oNsxHOqRSA/QlDKuy6GV2otIOgtEI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBH8RO6crlm5euDAXMbP1l1+bs9XGQ/Zcl9B 3k0mk4DhGKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg czaSD/99XeouTS8j4WDpJj6fBSGNifIE/Ma45+LbcokQNEMCygFcIvEdLL+TgQgvNZDqjhaCtGs FvdFUz/EKfN+jZsw7bI+yFzX1ZdoAguFSe3puGrPZZ57M4QfapMu2tK1/XF2hEP8py++oz1JFBF RsWw2/uIfNfbRnqIZi85rSoD9WaHe2xdObHUZAas4aaMyIfwsSobbCcPpJcLPHzoiiayV/VNZBb Rt0asXYck+nhofDSR5blck7JCUQiRbMTniu0aNWtB1adTY0Lthk2GzhnVksEG8faGTn5fUGNpQg bLUjHGKNjwNLZlK3uXNlEGmz7pruFKnPxyqmSWSwbgb0UEYzh+h/0NaKrDfLyn6ZxsIAVt1Tm7f H1la3Nnin8hhxAY5bpeeqPBFzClY1InlxIN18ixw5LHfS9GWBqPpeXvaJPeA4w/35wo/XdUOHBS 2YITBygiMzdBUVKlAYmCJN708Ry4x8Y3fVSm2pt7QzDtBfv99FIihunP6GJJw8JGg7JCya3lEvx j6HUiUIBhZnBuFJnxtWKgrdu0aYBmL4SsEtcEDwbXQ38CzJANYUx0n9T61cZRZWz7yivTsh6gDi +PORGj/DHNxXysN68mKDXoKN08AvuyEZOAJnuvueZ7VaYCOQLSGXaMQLa41DczHD7fQa9N7ADuf fmeV2BnSiOG4/CQ== 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) --- v2: - Make the connection longer, to have time to finish all the endpoints manipulations when executed in slow environments. At the end of the operations, the connection is killed, so it doesn't make the test longer. (Jakub) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index a10714b6952f..965b614e4b16 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3576,7 +3576,7 @@ endpoint_tests() 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 \ + test_linkfail=4 speed=5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=$! @@ -3608,20 +3608,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 Wed Aug 28 06:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780715 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 58B6C166F25; Wed, 28 Aug 2024 06:15: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=1724825716; cv=none; b=bXe44LA3z/vCUKvmIkUy4GPkmGX0VHS9JhJwGtMciwgkf3sE9+U7U0AnP9Nr+nCJv3ouUkv4YO0ZTJo5XCmwvTYpKoBaalc2qWXmqG7KAgFHz7ntapHCcpnF2c2zWKFHRn2KnK7OyY95RvfX45HaqhfT29drHuyXPmXrm/WMV2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825716; c=relaxed/simple; bh=b9pW0NpN2cusaKPOAAILmTGRKTXjZXbZC7Jt+QGLOKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DLGy1wmBtDznGmgHSkhHieezzAfRP5dAi702WhjejwdDZF/2pHvWQrBhOyuFW/j/oqoL1vYTAaoVO19den3WO/LVf8aMPKk8G4CkwvHgq0+c6IumUCoo/TLAsRNAhZvgAkYnHChTvkazgM6/LEKydDZgLTpCC4ZGlqH0g4Y2KsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qechXARc; 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="qechXARc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30093C4AF60; Wed, 28 Aug 2024 06:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825716; bh=b9pW0NpN2cusaKPOAAILmTGRKTXjZXbZC7Jt+QGLOKY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qechXARc72RwP5WqypQz+LbZExyOtRBLSg8Mw5zPsi26edVSSceGrDGWHzmkdXvbb 5sSmFbFVho1B0Ssn0fkZd6RuDtj/pmjvqbQV9Du+JejthMxdrkiQZZJdlVPphYFy3N zPgzOEtyrlVKYpSHPIe1RmjafxKOOfHPiJepdga0zC5X/QDUH9Hc6OGU67whilfZDc tWQ/RaXlWCClaa3k9AAauxy+r+bDJ9jWYQKnwzmqYtDdyR2Cz4ADesppszjj0InVIr HekFEPUuX/Zzu4E+sIQ+mgyUYPVf0llDBlRXXEOlrQK/oH7R62XhfyfA0oGWLqE2LS N93x86bOYrJ2w== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:35 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-12-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=b9pW0NpN2cusaKPOAAILmTGRKTXjZXbZC7Jt+QGLOKY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBHRJZiKlm9R7SfwCYWB6BvnEhZeFNfVfeQ9 oUFpmAY18yJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ARwAKCRD2t4JPQmmg czE4D/4qFNdxd4SHTu0rxIs1KQvDF2NOSYjGJI3+bkvcx4x/tyD1TihZLvcvpD9UllOv+A7L6bK qirDwvBwhxPh7Sg1JkvRMO0Uq3hXa9Y5BbU+zNsG+83MHdoRHmUddYNg9nQZqubuYK2170xgrJk jRHiKENOMeG5h/X2cWWaXev+zxTvvhQuugK5DjGXUW0ZRJTWB7Z8FrPCR1efzjuAWBotMVCmjs4 KOATsV3CMeV4lAI3BNqSBl7aVakizmRPo0AW8mi1cY6lY2J8gHhI86VlAfRtPhuqHbWizkdRL4U W4F18XYHOk9iCC6kX56k+766Kl2QJYLAthIqlQM3CXHDwCMIps4dhFXGGOVA7E+YuyuIvjT6geQ HX2YNxYV4WZhpebQEpPkKYd5x6Te3x0v0BOBLrzyv4pm877qO7Tb7qoFi77+uf36/I7pK/MxrjR HpNJCNNVsCgiyoW7BkxqZE21tab3MJ70f7FwVX0dYzRIUkInCJ9CwOjoS8CCnY+R7mHjt8q/TgV F/3XSM2p584XaZROFgyoFPQ/bU2e1MCZpx5iv1R4T5mce1UwTcLjaA0wkPFmL4OCwpqB0eBuTrX snxsNbD1mHz6BPvhQ5s5hJIjldRNoCz639kIIzkJ8EdMRRIV7zQ4FmU7j7x72OwuyB5/NJRhDzG 1bc+o+uqeBoyE8Q== 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 b571fba88a2f..37ebcb7640eb 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 240d7c2ea551..26eb898a202b 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 Wed Aug 28 06:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780716 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 041FB156C71; Wed, 28 Aug 2024 06:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825720; cv=none; b=dXFPpPBE4WkXvCyvWGKeNKNH7v1Mphm42peiCr+RglLSFAoZCBjm65aZvfS+hVJhelh/NCR1uhE4uedXa48jtEd4ifQbud1IFn+HEUD4v8Azeu2cj9sc/38ODHV9//GE+c7VXFJ1fVnkeMpajQK0cjCZzoh9vyYVFwnoXonwFIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825720; c=relaxed/simple; bh=T5JQ2jQuJBeGelgGm4sE2GIq90zYbpExmqisJKuPou4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dJmOr975JrIBww5QrK74VXwDwyk6bj+KQWiYD+nb/P1ZGWvqPlASQ7radWfWc87r9wVoU1YQM00gtA9xL58c7+GjgBTpaZ4IxZHMGpdYOtkFTltu7ZHg9yL4JOA4wtugzuNc9ggx/OFJh3UOiJhqJ/kXjZxLZ6kFwM9TZQ1AcaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EJSeieQu; 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="EJSeieQu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACBC0C4DDE0; Wed, 28 Aug 2024 06:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825719; bh=T5JQ2jQuJBeGelgGm4sE2GIq90zYbpExmqisJKuPou4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EJSeieQupaE3K5CAivAntNIEs8j0oS9vTYKTUGfuU0dzPYfJffG2LvLg8jZu2eU4f QR18rMdoaZJ2hL4CVDjl2JyFVjSTNLt739EEdQEppzftmROdxmQ5eCJ/7Y4MTycK7S J/u7ZbI/3Crky5ks2vboZ0LtP71MKSTa/T/aGoO278/YUMtLVsrlmRrXT5ZN0eubrH hpiZnkY2+BEnp3IltMTvOsGrRB1ynoTp3qp3B4bhUbhdkJz51Fs/L8kbFMk0DUsa4J Jjg4IMweG8OyrKNa0SDYrWs7H7nRDTpSaP8sSptXD43ckn2IFdTjLIFuZpeh5x3RuX 3C+1e/f+TupJg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:36 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-13-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=T5JQ2jQuJBeGelgGm4sE2GIq90zYbpExmqisJKuPou4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBINqzXv/yTtmQTKb2rnSD38oGyJFooIkCnT Zr+p9NY2xWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ASAAKCRD2t4JPQmmg cx3sEACMgloaKVy4PsHeImpyJ0op28TtB3c3f0oWqYhmPVSN6kd+yBac3hZSkXIn3QhsFPvQdJN cV5gbpkmIoC7ABJuQAVkviWT7AniswxCirZe8PiznycqNXZ2SqwYKxwU8XezgY/N3JEPpPSnSSz ht8IGO0ZPyobG16Lt5jiBfRP8x6nZ/HAGrOYCrG3/Zpl1cmg2h4r6smBoFt+Hhg+RNT+6DBsxRq soDqklp0ZgwFRF+jp3x4yVJCm5NBJqcyyqyj2U+dWAcJM0z6y2f4EfiINY8BBj7WNios5nlTuoz waih2i5ZtOSR9bqcTmZNXT0oRjrL4R2wCvU0p0zTHALiRb2M7oDFfBiW0WEU5VdVizCyIO8TBoH G5ZoxbhaFmAAWs8miFG8tstoBWywh8qwEdhI6WwAIGldaOT3xbj3bZKazLXprCcl7aCY3uhxX9M J9foiceEzrmqQr+UOhLQaGwomJg1Gud4nqq54xN3Gef4EsFh8yIKEjfBvwfaxxEcN8Qa281f2g8 Mf0+uuUneaYqucWqqpDngJvirziutLbf2GBsemEOQ4IIfNR08le8K/OI84rWhi7ZmH80BX53i00 Czz45I55wZh+YHFjBhA/G0GeVUTQ5HI9K+Dy8to1pA2g26M6KEej4WYtf0aqxzw9wXwfKnQe+Yh +QYTIpwFRkFtw6Q== 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 965b614e4b16..a8ea0fe200fb 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 @@ -3572,6 +3607,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 @@ -3623,12 +3659,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 @@ -3669,6 +3721,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 Wed Aug 28 06:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780717 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 0398915B133; Wed, 28 Aug 2024 06:15:23 +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=1724825723; cv=none; b=oug3Gl4b+QIUUjHoIz1B4n8ZMWtrS2PmbQhh/o0OmWqVsF+LhT2ldRb0uLyl1PVahqxFEfYRiVbb7YMrBHbkKOAJWntjGLNqrt9FOTEWrvZmfkIQyZNc7IRMT1rrKJ09oHYIrexBoEu4z3poGd0dKGS5x5PEsq0XQegxNVc6YK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825723; c=relaxed/simple; bh=x2XI6PON5WOQFb6mZEp5Ok89/mO30tFpl7Gk3FKdepo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cb4pGJnPy8Sa91xsYAfen2Nem92jRoMKplNQMAH2DjaQw+RAD1qI7LBgp9BYyGME/ezr3LvHeiEjpM/3+woPznfOlp9M9ko5xdBtmyLpu/p1Uoqfk+F2Y0yOWotEB+gO8igAsyuVP2+nFn5buCpIoTZbZNiOWXYQWCcq5VsBktE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S9BMlxrR; 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="S9BMlxrR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D7AC4AF65; Wed, 28 Aug 2024 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825722; bh=x2XI6PON5WOQFb6mZEp5Ok89/mO30tFpl7Gk3FKdepo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=S9BMlxrRml0V8fM1rpbF2V9LTjqTq4LGSsJ+Ok8rwF8ZZH80Ygvv/oIKkY6yYEYsL /0DnOV5frXICkbrzBjh9RzhS//1r1zTRFakVdSSdIdjhZAC9ZcMZiFP1qGTrjql6PU EZf/3W7eoe7kiNktwACfiTJMacmqZbgAppPcprUvPLmFDona/gU9bPcn784deXmELf h9YQ2UpoKrgEm/T5uUwdUnJoD+9lFFSD1w8z3QrhYgmYvSOrqy9wEkCeTFmKHlt63j MVapvj4jENVKLGmXxsv9iTwAoj8mhxWJLMfsJVCAAm3cKlfWbsRlN3cos+7jxhatIl oaLGc0WBw4ieg== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:37 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-14-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=x2XI6PON5WOQFb6mZEp5Ok89/mO30tFpl7Gk3FKdepo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBI5Ogdp3UUOrnKJxfx0erYNh7pOpOWLEWwr gDpolORX2SJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ASAAKCRD2t4JPQmmg c/EtEACe0CP08TTONl4SVkVWq0E7suPu2+U8P9Ugdx46vTINkt46XGOW56MNfn/ZXFD+UqIs73p 9CVDJnzeIerdIRLKKRiQN39IIVxu4zfGX9mIcxIy/ltUlCm/l7KbCDwN6eaY3VzzmJ8K7uFH27b x+P9yl1GSMso2P012APnwlT2AZrvWlCti0PRluNwVYzGWm8VvLZoJoJl/2ItfVmcbfYx9aD1SQi EcXUa2YoeHxW7qGJrdmNZijI0FpcR6gVSA+qNOe9stNMxMfJiyYgknnYTRsFJgM2W/AWEagoOU6 ZGFLBVNAEmsJkKyPlY6o9TwJpG8csu9dZh+4ZTtdXPKwLXOAFlj2PvWpeAKnLH7Oz5elCx39t8k wQmwVvy+O9CFvhhtKnZcIR7oVDyloA4Qp0jaOfr5fHxzd1SKJxjrYzaKWTSYoCadYml/3y7+gyT imBySSvlKxlJR1nBFWmkYsnr4nngAqooj5K+P3x659zZVDGC5kk2cg1WGJkoBlOwDnup4zBxU/K HdWEvhsAk7ns/Ecm6PJaQUCYR4r3VcXaF1jh7wHMomFtcEKhblYwCI7tFBSbG1p5Hxrmb9aT8Br FKO/JY3up9mqme2wPHQnfaekpYJywXFrk3EiNhHLnOOMcKGorXD9fQxxUz+0MfusVHTya+hBo9/ BY7MekPPkIUkmOQ== 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 3f8dbde243f1..37f6dbcd8434 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 a93450ded50a..f891bc714668 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 26eb898a202b..3b22313d1b86 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 Wed Aug 28 06:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13780718 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 56FE41553B3; Wed, 28 Aug 2024 06:15: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=1724825726; cv=none; b=GbmceofggP81zLgazkWGtUiwXP+QtqszWxLekEBg2UeiLqQYFD+7wa4PuWvYTysPPq1z9W17zDNIZ16wutZfDy1rKe/zJzjzIYBp6aeWGebWHfW1xylkOKJ83WDl61S2zuCzNW1zESM6JYkad0x5R7kY4awO8lX/hEdntOoHeUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724825726; c=relaxed/simple; bh=xdzWHXYy5hg4851VghxZtTa4uJdKioKLDBgA8yThRTc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bnQrFlTxidsX7Me3gtQxOYBSUOOwG+blwClU3+VVVgtZWxmF6dTL7XPwt8IllsxLvpUqk7KvVtZ/6Tf6NkPpN4EmESeomCsyCOzw5L7jtxdU9BbODD9FGBuFa+9Aty6dsGBWr902hgmSIiz04Qzjqq9UI+QCCBXzDSWRF2XGV1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g4XmCGIA; 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="g4XmCGIA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5670CC4DDE7; Wed, 28 Aug 2024 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724825726; bh=xdzWHXYy5hg4851VghxZtTa4uJdKioKLDBgA8yThRTc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g4XmCGIA8JRCWo2DCUYF3dAOF57sHTLh3PKdvU0uaMbXqQE4clkxNDAvZYnUXRBSC aHedtX18rLY16Roclo8r1/iflLswXeayKKGGRQ1j9DKvp+b4iPZFxCStUOEQ935jvi eB3DGYx9EL3EAY7tOFlG3ZH6ckxRNdRvTetM3UeKCYmd33B3LRAeBDqCmFlQjDUkEk otl1Ttgll38XuZy1j80GfsSbR7sFYq915Bl2jXOZxVK8ElNiNH7cODKkFhq4Tpwvme TlCRw/xsEpqALHWzLAsZTbR9MQJixW+4gwVEO+cc09rIVNwBDmb0OwnHVsr9AC6ugD 221WWGRddZAIw== From: "Matthieu Baerts (NGI0)" Date: Wed, 28 Aug 2024 08:14:38 +0200 Subject: [PATCH net v2 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: <20240828-net-mptcp-more-pm-fix-v2-15-7f11b283fff7@kernel.org> References: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@kernel.org> In-Reply-To: <20240828-net-mptcp-more-pm-fix-v2-0-7f11b283fff7@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=3437; i=matttbe@kernel.org; h=from:subject:message-id; bh=xdzWHXYy5hg4851VghxZtTa4uJdKioKLDBgA8yThRTc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmzsBI9ajw0YtF3NaFy0RSMeA+bxN34HGKoIdcx tY/ONk2nC+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZs7ASAAKCRD2t4JPQmmg c/GkEACZ/z1eBGLnvR+vJJgv11yemk4KXWMWMssCkCIB9qwJqbW/dM+X2ffJYAP4ha1OvRlQr3e fib3Auiyw7F6Y1Zih31FR6DOQWL+wYl0twVDdEVHJYqwPrn7z3UOzsLwDWWnexl+ygqtBbd8k8X TaCPR5N5+udS9w6LfZ5SnmEVGbtUDq7ZoUKPrchSzQPPqoEaaAJA/4u3vPlXvNF0U136By+Tj7Z 8vBmZxq0fNn2DwB5x0Ckt4Zz7QLi/NzZQa4Jfdu7vez6NCOMuYXmyeV6cAvtx2/UCGvkqXJAaw2 D8zZiGtyj71AY4Xfw4zdWVuQ/zHQO70Rj69a9mEoVAR65saNZCD4OVJDDEBT5MNsj2596ka/67M 2y5TyRcPzeAE30pA1rPxtbrVa1oBlkILsg0r/efXuQtC/QyxqdDhVcaYLDZnD7E6alqWZBhPxey kqbBNAcnkdF1YtuRzk6l1CZRfSf4jTSZ5B99EqEkyPyPLHYG+U+ObB1Ug0xbK7usAhttLMl+gYO vAjYbrhX9pyeymmffl1tVzZ4olGfN47IEnH3Bx/BcQn38yXCmKi4eKHGcG9MQkeuk84WbaGbWU/ TNHWfDQf0mhFHYfDUgpPrrnDD4IKugbN/ZrHHVt26Y8yKfGWlojBayrdN66x7P+/ByO38WbWHBT Ai7BpuvWy6fDnjw== 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) --- v2: - Make the connection longer, to have time to finish all the endpoints manipulations when executed in slow environments. At the end of the operations, the connection is killed, so it doesn't make the test longer. (Jakub) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index a8ea0fe200fb..a4762c49a878 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3688,7 +3688,7 @@ endpoint_tests() # broadcast IP: no packet for this address will be received on ns1 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal - test_linkfail=4 speed=20 \ + test_linkfail=4 speed=5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=$! @@ -3717,7 +3717,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 @@ -3727,19 +3737,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