From patchwork Sat Jul 27 10:01:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 814802 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 C7FAD59164; Sat, 27 Jul 2024 10:03: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=1722074606; cv=none; b=dDYu9w1ZfLMDU57R2wefjT+8HldlQ0M7s9sZVeoAnpE7Dq/iXH1HqjVArKJG8sAfD0UEUa97b0vycJGwvstFQypxDq4Ues5QPF3txUzqGfPR/ybmkoKY/Ku3wTz2s0ycV+s74brfOXrtsfFGvrFhACNhDimBp1oDDxswDcO1EAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074606; c=relaxed/simple; bh=CTR8gewU45gvgKEmuXT6+SEcMEUMSca6hJ/huUAc6Qs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fdCzN8f+jnt78f2sydNoK3eN9+7FlwcVfosqwu4yG/vCfESSt+jlsLIMnL3khRcFjtZvLJ328xD5W1Hql0loN7WHqPGvAplWHA5FWISi4Pk6FrtTHZ46H3k81e3Hlo4AtIM/JoYOP4ZQ5HhRR/0P70JgYA+bjtSmesyotkQOBqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JTv0zcme; 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="JTv0zcme" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF75C32786; Sat, 27 Jul 2024 10:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074606; bh=CTR8gewU45gvgKEmuXT6+SEcMEUMSca6hJ/huUAc6Qs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JTv0zcmeog67C7bb8VAnToMDxxvCq0h4WlJkI+swrmTCG12ND6Dgs4UXe815gke1I RM6DP7FCJaYKiiIjBey4lNdB7NAM4+JIbO5BBW6cY383pSg0nUs6YsgXffHwsoAPgt cBQW0LEgyVzrGfUF+/qmcdGehOYZZkh89VszyGA2PIpLUAiitMYuXwP524TJc957s8 UGDJDJ3Ld3d0x3SM2RRIaR8Pgh+SgSaknUaaHciHNvFlQdUgz05h48XldVd7aOHoka ySHQrxcE1lG3ynnmeCDS1X9hAkWQEWESar6bChfv+qWEv8zMjg1ZERaiNjtfsiZAug cTv5JfR6Z3XvA== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:23 +0200 Subject: [PATCH net 1/7] mptcp: sched: check both directions for backup Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-1-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-trace-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3069; i=matttbe@kernel.org; h=from:subject:message-id; bh=CTR8gewU45gvgKEmuXT6+SEcMEUMSca6hJ/huUAc6Qs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXljQzK46ZBbvKWMgbuUfFw/J5D3FsIfpAgv /dWr6A9NHyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5QAKCRD2t4JPQmmg c131D/0VgKZjBEl/VO1L6HiKYnWh8ruH6wVt98Cvix/y+by2D3zFS8aN/iv8VtDJHNDy0onTiZA Iwqz7YvxKR66Q8piZMqV65/C5TW0KwSOqHgmRx0vZqb3gnf3S/ke6LD6E8tsqKgCRbroAOQrvxf 1BFi4ZijEuWb24FOq0hW0AdFSqO1pD4NHMa9asspvRxCFHjTNrOWOdXZLRsGrhQSQVMxMfBaD0Z n1sYmwYmumo3Fb90p1KyBJ/2qPyqtAP2nHCuC0nAKsHAvehwIGTV+hvCoST+zBnByWyQv3X6NT5 2HC4GZjAZupcIPnNZYYmsMv+YnjpkEx4U7kNqyEJAGC8apfmU6WpybTMD+24KdIHdFzF4mooAu1 jlijtoyQo8yp0JRg1OtVwyqPpIex8m9BUnK6ZwpZDB+wq1v+DrRv8CTeeG9cAEye5T8FYnp4ZId DNHf9hiqVJK4ALaJiNVhNkgx6l8ybTepQL5BmyIxq78GiX351+sbHtYxypKdKHxxOsT0VCKH+rl bfJfJwqLK9MAr5EvHmwccR8IFxnPSlI/iDHkUMUYIgHC5XxVD9wMK4U6/dPFDB1ynEGV8+bGJOS pKRRQpuV3AYTGuaga+ldm6dPOLkY58PzDqQcIDLmQrKOhpP4dq0wdJwdIyGXeuMaozxBBBt/ke9 THaO5iTZOiO56Rw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The 'mptcp_subflow_context' structure has two items related to the backup flags: - 'backup': the subflow has been marked as backup by the other peer - 'request_bkup': the backup flag has been set by the host Before this patch, the scheduler was only looking at the 'backup' flag. That can make sense in some cases, but it looks like that's not what we wanted for the general use, because either the path-manager was setting both of them when sending an MP_PRIO, or the receiver was duplicating the 'backup' flag in the subflow request. Note that the use of these two flags in the path-manager are going to be fixed in the next commits, but this change here is needed not to modify the behaviour. Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- To: Steven Rostedt To: Masami Hiramatsu To: Mathieu Desnoyers Cc: linux-trace-kernel@vger.kernel.org --- include/trace/events/mptcp.h | 2 +- net/mptcp/protocol.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h index 09e72215b9f9..085b749cdd97 100644 --- a/include/trace/events/mptcp.h +++ b/include/trace/events/mptcp.h @@ -34,7 +34,7 @@ TRACE_EVENT(mptcp_subflow_get_send, struct sock *ssk; __entry->active = mptcp_subflow_active(subflow); - __entry->backup = subflow->backup; + __entry->backup = subflow->backup || subflow->request_bkup; if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock)) __entry->free = sk_stream_memory_free(subflow->tcp_sock); diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index a26c2c840fd9..a2fc54ed68c0 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1422,13 +1422,15 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) } mptcp_for_each_subflow(msk, subflow) { + bool backup = subflow->backup || subflow->request_bkup; + trace_mptcp_subflow_get_send(subflow); ssk = mptcp_subflow_tcp_sock(subflow); if (!mptcp_subflow_active(subflow)) continue; tout = max(tout, mptcp_timeout_from_subflow(subflow)); - nr_active += !subflow->backup; + nr_active += !backup; pace = subflow->avg_pacing_rate; if (unlikely(!pace)) { /* init pacing rate from socket */ @@ -1439,9 +1441,9 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) } linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); - if (linger_time < send_info[subflow->backup].linger_time) { - send_info[subflow->backup].ssk = ssk; - send_info[subflow->backup].linger_time = linger_time; + if (linger_time < send_info[backup].linger_time) { + send_info[backup].ssk = ssk; + send_info[backup].linger_time = linger_time; } } __mptcp_set_timeout(sk, tout); From patchwork Sat Jul 27 10:01:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815526 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 0AD316F2F4; Sat, 27 Jul 2024 10:03:29 +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=1722074610; cv=none; b=E2q6FyJaiUofvCTSXktmE2qrDvpWT6M+2/s0CRZnsiIPN0aubgi8QDIduU+HTzYOH1+gyi3IvVkR5mIC+B6MMfk3+RUvNo+yzt0iRFBC6WuJnMJ6iksjDdQGR9ExjO4qsNuflKrQVrrSwjbkPtCqh9v7lu/RypU8VQv/RUY6Dfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074610; c=relaxed/simple; bh=KregD46JHMeDBGYPvMEUJHE+xqSjZTW69dC5EAyRguE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FAiKIRKLwuQdp+4nggA8jhIVcHnMZM1cpFj9UzffpTjryCwvTWmOhJzjzDyvvIFk1bTOaSp+VVDE5hD1jobCjT/su29ID0XKho4/8L26mPUZIT5BHSbEog0LtI/YlBKJ4S9tstjvgbOJl2w23/thkgSQ7zom/V7M6H/VwoE9qnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N8uTqsdd; 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="N8uTqsdd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B93DAC4AF0E; Sat, 27 Jul 2024 10:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074609; bh=KregD46JHMeDBGYPvMEUJHE+xqSjZTW69dC5EAyRguE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=N8uTqsddRqHiS4SyleUuB9hQfuSF5tiFwWCKcobuXYv80fRfxJ50GIHYWxQ3kUIKi WrKJc0np7wjPPFrWhY1fBWay3C4SodlWz1gZ5mLCMnWw9uuVVW4rQxJVds4WlU4Vvt s9GxuegDiAOMgitGWOjxtc3Z2Wlr1nLChh5Ffgw77upHq2HRX6oYWwEIOEpRSBrgVo ylsiEq6xJEfpSpuP/6Yt1YvjHk2PLV7agtgyqK741MiEZJ3I/Uxzp8/E3UFcxIZ3QT LYZwH0NYkH+1FqWD7lJ/i56I1jm6OV0BZq4hbYOsMnXhkwg2W+k7ge5o5HRUeEUDx+ e028SongCtLng== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:24 +0200 Subject: [PATCH net 2/7] mptcp: distinguish rcv vs sent backup flag in requests Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-2-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=2323; i=matttbe@kernel.org; h=from:subject:message-id; bh=KregD46JHMeDBGYPvMEUJHE+xqSjZTW69dC5EAyRguE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXlc7TT260ExETbRS3kGsRuQLDLvefwiewI+ kNP8iox3VqJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5QAKCRD2t4JPQmmg c3OwEACNtET1mfVHYlMCoF1MiI5UUqOK97bld/5Ao0EMbEKukaxliiOW+rQYSXzcvI2PecAXjPN Iw+P47TWc0ynwGEEpY88o8hjdoi96zHXrQMDDsdNr5ZPSshH9xBQraoUjGHWnYdrn4i/JbizWYD FyiniDpTEFaeVR2LZiSrFU0Tb9Q+Ua2Wihx5AMwUJc+f13dRMSn8XcUpuzU1tCP9qgUNyLXtG4d 0KofJEDF05e/ydNPWf8WRi3CAsGB8peumWQM0saSWVFO6ZGVnPUmZKfMEozylfsQbH1n4h4EJzf uTVf+7mfv6WkiO6DAE7UQq1cXAngtcQQHCbLR0xGiT3ozZf3FkUb+ZbZLrVVkE7JuTQFPSok97R 6TrUYNV8PrWiM15oNd4BJgpm0kZjEy1UrSVSLjaiCe2/dngNvyp9AvZQUhGsIMzfyKeNCOWAAD6 HYLQFcWP3L1HPy3UCfHZSrXtS/oHG5UQXoKqyfZrZdYwwR/iVex4XALtdA7nQHaqctjx+8n3TFo msOvt/jER2wcuVvHOVTGGm0d9/TSM583F24JRnLLGYgwg7FWg18ViXhW3jyWYZvtINV0nS8UZ2D cMZHvi4mYRvBBWuri0cvb6tlWeORJnlilJvsqvp5T0zmwRv68ij/cn7amPtJaFrTZ0nYQ0Y0XEu M8OydleRTaeLxCA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When sending an MP_JOIN + SYN + ACK, it is possible to mark the subflow as 'backup' by setting the flag with the same name. Before this patch, the backup was set if the other peer set it in its MP_JOIN + SYN request. It is not correct: the backup flag should be set in the MPJ+SYN+ACK only if the host asks for it, and not mirroring what was done by the other peer. It is then required to have a dedicated bit for each direction, similar to what is done in the subflow context. Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 2 +- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 8e8dcfbc2993..8a68382a4fe9 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -909,7 +909,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, return true; } else if (subflow_req->mp_join) { opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; - opts->backup = subflow_req->backup; + opts->backup = subflow_req->request_bkup; opts->join_id = subflow_req->local_id; opts->thmac = subflow_req->thmac; opts->nonce = subflow_req->local_nonce; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index b11a4e50d52b..b8b25124e7de 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -448,6 +448,7 @@ struct mptcp_subflow_request_sock { u16 mp_capable : 1, mp_join : 1, backup : 1, + request_bkup : 1, csum_reqd : 1, allow_join_id0 : 1; u8 local_id; diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 39e2cbdf3801..a3778aee4e77 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -2005,6 +2005,7 @@ static void subflow_ulp_clone(const struct request_sock *req, new_ctx->fully_established = 1; new_ctx->remote_key_valid = 1; new_ctx->backup = subflow_req->backup; + new_ctx->request_bkup = subflow_req->request_bkup; WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); new_ctx->token = subflow_req->token; new_ctx->thmac = subflow_req->thmac; From patchwork Sat Jul 27 10:01:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 814801 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 65302757F8; Sat, 27 Jul 2024 10:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074613; cv=none; b=OiPKtmm2dOgQMKdZWuQgU5FbowwVOpc+nTSOqJVJwlq1lbMaY8/zUTy5jeIOBw6a0BsPC2bn4uB39Nhj2SIPhcS5eyB/uYQFJHkeZ+RX/m9MI2D5GHOh/vOJd5hJFF9LNZVkqSQ5kv6hyEs2zEGLTjjrl0Rd1zPvpzhjmo2OUOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074613; c=relaxed/simple; bh=C5TD7jO5JZLbE0mArucprAaXqsRm106ZTDt0FgoYp8E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M3cxs+slyZ/jpS8Gcu8PbPmfyN0q7DAETB6QTbhk0lI0wuZT2xOZmmiePMy8iVnkwmjflTsaT6huhvpJJuJC84MDXmSowPZQxb0VMLKTlL487N6jkX8olEKkEpjeSw9vX56O7wj9wOc3HTjYLCzmKEsGBY7Zy/TmBDYFJFqsVeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tOuWBRU/; 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="tOuWBRU/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13F35C32786; Sat, 27 Jul 2024 10:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074612; bh=C5TD7jO5JZLbE0mArucprAaXqsRm106ZTDt0FgoYp8E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tOuWBRU/eh9emtwVWPZ35lmnByrz3jSdTxs+94uyoNe1TX5SF2aJ8MvfL9QdS0vt7 ImgAaTXS2uyBmpbvxNOqsdI8GJd5U/vgVRvnbzRXOSNEPdViXlD2XPjdx03Sn+pBZJ mi50j/GWcWYSm64Pef/AMh7c4F4jeG7tQlVu08n5+QNy/yHXEr9hXTIYJprgVhF4zS 2l3z/JbNKc8q/WXSSUigIX/r2oLwy2CG39xaKzOiK+4tuIhsQsa8KE+O/P4iML0Psh TL37fXVi27ddW159Vn8fgZV5P2bD/HJ+1opulaD3/HUwfwLfFSyBgnV2mKAvI29o6Z FFsQudaDZH21A== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:25 +0200 Subject: [PATCH net 3/7] mptcp: pm: only set request_bkup flag when sending MP_PRIO Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-3-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=859; i=matttbe@kernel.org; h=from:subject:message-id; bh=C5TD7jO5JZLbE0mArucprAaXqsRm106ZTDt0FgoYp8E=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXlxIUksVKZwR1M+GSCTA+PtKUrIMDwE0Ryr ZXNfEPvSoCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5QAKCRD2t4JPQmmg c/FdD/95Dnlp8mvqRewQNqChUwtjrTLHhVcEDguBcEksevqd2dSVCaa4vbSLx8CRBCSWJ7WP4ls mBd4KOeZNJ/DxpWyQ0AZ+xTeVgdWpIHydKeKEbM3liRWPYbNJ37/6cm3fGVIBkP9ilJ5qaXZG2X 9cYfsMBtXdonFCWE/VUhF5nljIY8bpwXm29//jMaaYmSDOErzpDaUWEjTgK+dy6OI64+56JDQ7A kY3pPXq9PXINTIn+C9p7hXIZ/FS5xhhLttZC4QZQ+CtrLrN4X0O14VB/Xju4u4LG6+VdULDv+RK hyxvq6TXChr+sRt6bDcK9aLHkl50/w2Nf1cnMVy2m+rwAbDRpmaN3dcUIEGu52RR2QmlINN/uHf Qy5I05DsZIF0yyWTbiuAfGvxoZ5IiUdLGF/IzjtC8OYIYLoTykblzKNnaFgayCZCMhHJBDbJN/O Kxsxadj9W+O1ytvtejskMcz4LUo7TfAsE8R1wGFt9Gdb6ALVkxCO4Z/EaavO9TrNNnW2RdHKdHv NgrjOUO/vjBS5Zl++lHm/nbEVkbfP0jX1tTLTewp1zI0VXUQv32NZX2zxJR+mPL3kUYLTzCxP6b 40eGiC09xmIcYIkA6Y18ewdYaH8PiN8+P0I5+2+ng7xPlaXtOjSKiW8A3GKjdKrfO6VjRPcGiM5 tx+RyzDOWNiFvrA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The 'backup' flag from mptcp_subflow_context structure is supposed to be set only when the other peer flagged a subflow as backup, not the opposite. Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ea9e5817b9e9..59527335c68e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -471,7 +471,6 @@ static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_con slow = lock_sock_fast(ssk); if (prio) { subflow->send_mp_prio = 1; - subflow->backup = backup; subflow->request_bkup = backup; } From patchwork Sat Jul 27 10:01:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815525 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 95BC2770FE; Sat, 27 Jul 2024 10:03:36 +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=1722074616; cv=none; b=SPnksevUG660sqp/7TNwUZKjAoViSiNeCx2MUsWCM/gFBq0eagsHjGCoZjbE+3uS/aXxT89wdQxZPD5okr7uipHgaAs4WnmoG5EmyRpQOckd9sJC7sNZe9WiY2YVteQSvBQiH82JrdvSdvx6xDMnE9oooaZ9osMim3UOvbS7/dM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074616; c=relaxed/simple; bh=S3BOardd1gbxkdBklEMqtmAn9Qoa/XdOrTRw+hlcIHU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pq1zfqUE3OVT8sFOE0pbCheZYf1ECuzrJ4KbgVGntb6VL10K8bFQN0VX37SR8Vgm5L6mTPZrzovXr9tBwozEsaVviydtJkrisV5nhShpX03cjOsurplWefV6xlg+lGtg730piM+SQWOCLF8fMZFPXDC80CkWHBpW4sCY6oc1E8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TK6UPu2J; 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="TK6UPu2J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6157CC4AF0A; Sat, 27 Jul 2024 10:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074616; bh=S3BOardd1gbxkdBklEMqtmAn9Qoa/XdOrTRw+hlcIHU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TK6UPu2JUih/8euTpl2LUBO6XMx/7G3lJ2YOZmvptl8HE+rAlLbEBFYaYeFRlVFsU JdyQsepnaXclc+uiuAQDqp6GWKVwShRA8dcpnRFlu44kGQXGX+mq+UJVMuCs9PJ0y1 isxTR9gXPI7cOhXpHR5aakagz8+7rJfkYwrVZYhiyoqR1qB4cCPgBZ5gVCM50AP4PX Rmh0ylbPIS5cvqZKggPnx6qz0RXsnVu6Jfu/qhG8iqkfnK6v9UUQhuD46iLwrM0AnC A2/tJI9oF32K0e5nB+gzolj6KRHQzURBh6U0T19pC8fs5jwtQnYjzh0QRfwYseN5Qn JTv1oZ+dhrQGg== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:26 +0200 Subject: [PATCH net 4/7] mptcp: mib: count MPJ with backup flag Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-4-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=3377; i=matttbe@kernel.org; h=from:subject:message-id; bh=S3BOardd1gbxkdBklEMqtmAn9Qoa/XdOrTRw+hlcIHU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXlqp+4odKrubnIo3kMhdI8liJLkAEojtOIq WuXkvQ8hSuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5QAKCRD2t4JPQmmg cx9dD/4qqnD6pDRLRzYH7YQayFjTirFLo3CNZkv5AV9p4txmEml88k0IboYDcwE1mDc4AVhuQxr dh9uoKUvmEXEElBO32hbCCjOBxyHrMnS0spSTMB9fTWujs8NthAtf2ebsEmZwCu0bBSAe00ah8U VFlpmVhTRUXT4ULY6gvcy4xf/PJZ6DarJpdEfB1jbC683WF6UkwV54ZcSEuefn74okrvEvmqM7h QolNJ2MYa4EtpuXQktrj5TW7n0uvaLQY0qkvXGYZ6Pt7693W8YpMYaW/z+45oUpENrTJoYv7hcs VdLVb0PpgF9r/TRlmQdkUMYAhbQr4oWWwQtGW/eMu1yfgDjfUDVMr8yAjnVcF/vW/aFs+sxBkbG 4vT9foOKFynenhxf8SznuK/RYt03YySfpeeWBGEX+PbKMgK5T2mB4nC79CE1nQjS8qvPmRXl8Lo 33Dq7pY7Pd9Va1psNdLSxgohpT1Qz79kF7VgLPyOcVukBeQfLfJl/cC7Yx5AUX19vR4BZ9O20yn x8DV7hmBOy6ZpvNJIirYoVxUJ7k7/wJv2YcQEK33DOvlb3t1ccCdo5tZfi7UwxwIeCAT8JKaALq W0N/N8fotgL14ZNsWR9JVUbhBbny0rNaDu0ZeAJOM/Jpw2aZdbaGB+IM/lLJuu0S5fCu+3goLmb y0vnflNGQq68AEg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Without such counters, it is difficult to easily debug issues with MPJ not having the backup flags on production servers. This is not strictly a fix, but it eases to validate the following patches without requiring to take packet traces, to query ongoing connections with Netlink with admin permissions, or to guess by looking at the behaviour of the packet scheduler. Also, the modification is self contained, isolated, well controlled, and the increments are done just after others, there from the beginning. It looks then safe, and helpful to backport this. Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/subflow.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index c30405e76833..7884217f33eb 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -19,7 +19,9 @@ static const struct snmp_mib mptcp_snmp_list[] = { SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS), SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN), SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX), + SNMP_MIB_ITEM("MPJoinSynBackupRx", MPTCP_MIB_JOINSYNBACKUPRX), SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX), + SNMP_MIB_ITEM("MPJoinSynAckBackupRx", MPTCP_MIB_JOINSYNACKBACKUPRX), SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC), SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 2704afd0dfe4..66aa67f49d03 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -14,7 +14,9 @@ enum linux_mptcp_mib_field { MPTCP_MIB_RETRANSSEGS, /* Segments retransmitted at the MPTCP-level */ MPTCP_MIB_JOINNOTOKEN, /* Received MP_JOIN but the token was not found */ MPTCP_MIB_JOINSYNRX, /* Received a SYN + MP_JOIN */ + MPTCP_MIB_JOINSYNBACKUPRX, /* Received a SYN + MP_JOIN + backup flag */ MPTCP_MIB_JOINSYNACKRX, /* Received a SYN/ACK + MP_JOIN */ + MPTCP_MIB_JOINSYNACKBACKUPRX, /* Received a SYN/ACK + MP_JOIN + backup flag */ MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */ MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a3778aee4e77..be406197b1c4 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -168,6 +168,9 @@ static int subflow_check_req(struct request_sock *req, return 0; } else if (opt_mp_join) { SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); + + if (mp_opt.backup) + SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNBACKUPRX); } if (opt_mp_capable && listener->request_mptcp) { @@ -577,6 +580,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) subflow->mp_join = 1; MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); + if (subflow->backup) + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); + if (subflow_use_different_dport(msk, sk)) { pr_debug("synack inet_dport=%d %d", ntohs(inet_sk(sk)->inet_dport), From patchwork Sat Jul 27 10:01:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 814800 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 EC74B78C93; Sat, 27 Jul 2024 10:03: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=1722074620; cv=none; b=QoGWOhQGOrAKYwU30Q0yOvhu6rVo/Fxtm5xBE9tDx6BFfRNnAVmLp2qSDUm05Rr6p8PX2gmqF62Mp4ekN1Q8W5om0dUSk4Elw2oRFsBnvxGnwGdWg/+7p7vBOjnWxqXEP5taqabKAPRlSSWQBN8OMcZMgEeT5WeImfwniTjbMPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074620; c=relaxed/simple; bh=3V9TCGueaEZQUXkdU2VKu/SHC9HRI7NdHfFI42aBr3c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ESNeoSuRGrQ2rfh8G1XqTtouzEZIHXdOAh+L7Ee2Yk9WDm2s1RDj5i38i0hzCw+m3x1IlkKys1lBhrhFCa80oLuOFCQm8afZd8HAW+jW210725TvgLobXwS1NoZlmWf18gkzk7pNiVLZhIk/2EbHZGAsVfKQ2ZIGApsS3OgUXcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FlFCClXx; 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="FlFCClXx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B040CC4AF11; Sat, 27 Jul 2024 10:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074619; bh=3V9TCGueaEZQUXkdU2VKu/SHC9HRI7NdHfFI42aBr3c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FlFCClXxcdg8jw1/Hef4qSfXxS2c7nYIpwxlIx70apQa7WHk1EB8fiAp5HysJVWIv V330Pdgo8TArOq5I61DO+zhBYs764XziP7cyXUC55g/XZFZ0vwlecYlC6ksS06c2GW tpUkMNIOVytTXwpfQhzM8VWKm+5VG5EcU3OLfbXsFBksTBa913GovnhQDqSI8+TyUp S9LFv4moG6pppdRaidMiADnWN+JUaSsG5FO1zdeaTY/0bt5DnjDMJO9xmtCY8GyEFj QZX+gsVnQnsHnvBCXItasmmOYEEzS84UiCOR3mza7Ihq6A2n8tNIXsf2KzRAe6duEy U6b6/rzr2zaCQ== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:27 +0200 Subject: [PATCH net 5/7] selftests: mptcp: join: validate backup in MPJ Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-5-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=4226; i=matttbe@kernel.org; h=from:subject:message-id; bh=3V9TCGueaEZQUXkdU2VKu/SHC9HRI7NdHfFI42aBr3c=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXmLht7kjPPpRzQKMQGD7RbCYnNkQ+UMCqTB uTRx8bJ+EmJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5gAKCRD2t4JPQmmg c4i2EADL4Znu2EFJ/Cfo5a3oN7fgCL1ZZpEFYFztNQcodxiJ00nYUruG0B1vUxGT3ppz9QRpi1h A3Vtc6l8ZEGPV25tlMU6fP1MlNdCJ1j5OE9r4fo21WvQx33dzLCBwVZCnZtCLpNzLJjlSXBTapE rxnAOzydeAjK8FkAC9VnkwRDN3OR9s6qwPsk+4ZchdCwjc2p/ONvUeM7MbkNSBA1UNbl/JyMQ2x 5mSDgDABw1eWOgOQZQtTvTG/N0+5h/jrfzcWvRrHdAEjku0i49bwr+cTyGDNKnutd7JmyIuHOKO 8HmIJjdusL1wz1LKjLFAx4QUC95NKSSPuYZnEZNsgFHiRKv2XtQnHk8RUpbxfrdhJFzFCCi/9fP tAKkETZcocq0RLqCys61MXJHcWEh88L9ZmghpzudGk5bUByXn3gZSy7AaQour1nwszwfCA0jx1p VoX/WG8iBvlv455n01NtrH1VBzS19jybdlFcBk2XMrgkiHDK+jHmvutWpBVuCcZJKryWeibjJmy 87fGxSZniDnaJp+a3o9cSb4Haoe1nwzWY2E8+Jr+4xBnF2mzzJ/hg5EFA1vWm0fG7Hgh25iBsXf g9jYQ65/5WQWpKPbgweCKkFuJk0j85pS/++NHW5A3yLms0C+VjwX1nfWN/UvllPs0oRKWskEsAm ZtSg02ltsmczc8Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 A peer can notify the other one that a subflow has to be treated as "backup" by two different ways: either by sending a dedicated MP_PRIO notification, or by setting the backup flag in the MP_JOIN handshake. The selftests were previously monitoring the former, but not the latter. This is what is now done here by looking at these new MIB counters when validating the 'backup' cases: MPTcpExtMPJoinSynBackupRx MPTcpExtMPJoinSynAckBackupRx 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 will help to validate a new fix for an issue introduced by this commit ID. Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 42 +++++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 108aeeb84ef1..655715c8c6d9 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1634,6 +1634,8 @@ chk_prio_nr() { local mp_prio_nr_tx=$1 local mp_prio_nr_rx=$2 + local mpj_syn=$3 + local mpj_syn_ack=$4 local count print_check "ptx" @@ -1655,6 +1657,26 @@ chk_prio_nr() else print_ok fi + + print_check "syn backup" + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynBackupRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$mpj_syn" ]; then + fail_test "got $count JOIN[s] syn with Backup expected $mpj_syn" + else + print_ok + fi + + print_check "synack backup" + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckBackupRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$mpj_syn_ack" ]; then + fail_test "got $count JOIN[s] synack with Backup expected $mpj_syn_ack" + else + print_ok + fi } chk_subflow_nr() @@ -2612,7 +2634,7 @@ backup_tests() sflags=nobackup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 - chk_prio_nr 0 1 + chk_prio_nr 0 1 1 0 fi # single address, backup @@ -2625,7 +2647,7 @@ backup_tests() run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 chk_add_nr 1 1 - chk_prio_nr 1 1 + chk_prio_nr 1 1 0 0 fi # single address with port, backup @@ -2638,7 +2660,7 @@ backup_tests() run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 chk_add_nr 1 1 - chk_prio_nr 1 1 + chk_prio_nr 1 1 0 0 fi if reset "mpc backup" && @@ -2647,7 +2669,7 @@ backup_tests() speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 - chk_prio_nr 0 1 + chk_prio_nr 0 1 0 0 fi if reset "mpc backup both sides" && @@ -2657,7 +2679,7 @@ backup_tests() speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 - chk_prio_nr 1 1 + chk_prio_nr 1 1 0 0 fi if reset "mpc switch to backup" && @@ -2666,7 +2688,7 @@ backup_tests() sflags=backup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 - chk_prio_nr 0 1 + chk_prio_nr 0 1 0 0 fi if reset "mpc switch to backup both sides" && @@ -2676,7 +2698,7 @@ backup_tests() sflags=backup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 - chk_prio_nr 1 1 + chk_prio_nr 1 1 0 0 fi } @@ -3053,7 +3075,7 @@ fullmesh_tests() addr_nr_ns2=1 sflags=backup,fullmesh speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 2 2 2 - chk_prio_nr 0 1 + chk_prio_nr 0 1 1 0 chk_rm_nr 0 1 fi @@ -3066,7 +3088,7 @@ fullmesh_tests() sflags=nobackup,nofullmesh speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 2 2 2 - chk_prio_nr 0 1 + chk_prio_nr 0 1 1 0 chk_rm_nr 0 1 fi } @@ -3318,7 +3340,7 @@ userspace_tests() sflags=backup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 0 - chk_prio_nr 0 0 + chk_prio_nr 0 0 0 0 fi # userspace pm type prevents rm_addr From patchwork Sat Jul 27 10:01:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815524 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 5653A7D3E4; Sat, 27 Jul 2024 10:03:43 +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=1722074623; cv=none; b=H4GsYOCUMRGAprVQl82HExPlof4Z7jPZP7Zb4czPLiAfXpLJuoi1JSzt35w6gvAT/JQISMaQ+pJxnhgQyOCmXN2Vn/gAW5Tb7mTkBeW3NnJPlJ1iIsxG7PL0n7yAfiBoZVQHsRLG8RFUZG9yVOY+2XWBfAtvJvJs5L71VwziNa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074623; c=relaxed/simple; bh=3eBeJjC4t1puEN/DFkciKEIb9P2a1z/Rqf7oJB53lzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WQL35Q7gxKERfKwS2sYqyC1w85Nginl0CeURb4GSD0pmcMbQWzaT3dcqn/kA93t2AbxqwgXM6VlTTrD7rZftsdE808J/jJw1mqjwBl1Ec2FUVcx7Dq9ipQpuRYXJHpdyZIsYqr7i+gHtorKqiuF7/lUuXB/7izvKZPzwkkY+3aQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mqmi80Z+; 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="Mqmi80Z+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC07C32786; Sat, 27 Jul 2024 10:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074622; bh=3eBeJjC4t1puEN/DFkciKEIb9P2a1z/Rqf7oJB53lzY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Mqmi80Z+YcU/hMOVO9dxBKFa7YmZ+uZKhxDHD6ImR9OWBcl9jtYA32hoBsm2f/v8u iw7OzS8ihbYN4bNU7cDWQVCB8f4uqHtOvc1yBZTNpOR9tlj+iLW5Yc02JAx8NK/Xzr ddb6MNMHybIUn7wCiQlb3tSD/eTn/hXVdrAMTHz01ZmoAPE6FaamXnU2UcRqEotCh+ 9/cE+iVPT8LuxG9rojFw3ZKD5La0Ibkb+50gabk0vhB4ulaEUUvSrwtDeLoGZxcxjo JdUpc6KAH8EjBBDdVrw66QJ0YxSi0xzK13qgZmkzmTqHWGKvH4Rp4Pdj+lPqgj3ZSo rVgRzdGRSKwoA== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:28 +0200 Subject: [PATCH net 6/7] mptcp: pm: fix backup support in signal endpoints Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-6-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=5482; i=matttbe@kernel.org; h=from:subject:message-id; bh=3eBeJjC4t1puEN/DFkciKEIb9P2a1z/Rqf7oJB53lzY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXm48IiIoe9TbUuJLqVBqHwCV4EWiQHsBIjZ oqKlwv1wDKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5gAKCRD2t4JPQmmg c+upEACoj2je6IWxQFx+/Dtzy1HWILngsJ9yAq/LzaEXW7yz7bG6SHpGCu8ad2/KpOOc0R8e+1K mh/u+KbGedjxmArJgxoxf/TOucdQNW8jKnwvpnDQAedPE53p/5/h5gKkeVZZfgRBjzWYZe7p3MK r4xkPJeanEPuL4uiwylcDJw/MdbKOvRLJmxI1XSZ/9hLU2gNvD4hn5ZuZuPPgnyxEm1vx1FGNGs SWLiChvFUUoOjJqwecb9UqBVFCduzt1Eh8zidElb5P10FgX5/kwH3YhanaQ2wio+rb3QOTQ1pxQ dv/McdigEHDcxBjioiFIjBUNJRvErdKHT0hcVygEeoUDEPpknhf6ce1IVXJXe3Htd3OgqJVzsvI 51NuIQSpORum2JawUAaxdi/Aibqjx6PY6GUiEtk7gQwMtA9Yn1gg6Dsvly/q3fIK3kJbK2xStfK Rfiq4YH2vZiHHtG+FLVIJyr4x2Gnounc3Aa1XkHg4++6jULdN9DXHw3Qw02wSAGmDlPK5a8ezOp 9R26ak+c2UR5skCY24l63xvxM/Dn4vnv3auoxd4r4RgNl+77F1HGDMQ4RMorkQblwe3Ez0aWfcO 7GxaxXZVl3Tl0ElilMLnU90U3e4BimLXb7U512D1kJmYNE1oitcrwYwpotxeol4fYCggArwKyoF uPEX06czsp8cnMg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 There was a support for signal endpoints, but only when the endpoint's flag was changed during a connection. If an endpoint with the signal and backup was already present, the MP_JOIN reply was not containing the backup flag as expected. That's confusing to have this inconsistent behaviour. On the other hand, the infrastructure to set the backup flag in the SYN + ACK + MP_JOIN was already there, it was just never set before. Now when requesting the local ID from the path-manager, the backup status is also requested. Note that when the userspace PM is used, the backup flag can be set if the local address was already used before with a backup flag, e.g. if the address was announced with the 'backup' flag, or a subflow was created with the 'backup' flag. Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows") Cc: stable@vger.kernel.org Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/507 Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm.c | 12 ++++++++++++ net/mptcp/pm_netlink.c | 18 ++++++++++++++++++ net/mptcp/pm_userspace.c | 18 ++++++++++++++++++ net/mptcp/protocol.h | 3 +++ net/mptcp/subflow.c | 3 +++ 5 files changed, 54 insertions(+) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 55406720c607..23bb89c94e90 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -426,6 +426,18 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) return mptcp_pm_nl_get_local_id(msk, &skc_local); } +bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) +{ + struct mptcp_addr_info skc_local; + + mptcp_local_address((struct sock_common *)skc, &skc_local); + + if (mptcp_pm_is_userspace(msk)) + return mptcp_userspace_pm_is_backup(msk, &skc_local); + + return mptcp_pm_nl_is_backup(msk, &skc_local); +} + int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, u8 *flags, int *ifindex) { diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 59527335c68e..85346db71d0f 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1101,6 +1101,24 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc return ret; } +bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) +{ + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + struct mptcp_pm_addr_entry *entry; + bool backup = false; + + rcu_read_lock(); + list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { + if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) { + backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + break; + } + } + rcu_read_unlock(); + + return backup; +} + #define MPTCP_PM_CMD_GRP_OFFSET 0 #define MPTCP_PM_EV_GRP_OFFSET 1 diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index f0a4590506c6..8eaa9fbe3e34 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -165,6 +165,24 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry, true); } +bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, + struct mptcp_addr_info *skc) +{ + struct mptcp_pm_addr_entry *entry; + bool backup = false; + + spin_lock_bh(&msk->pm.lock); + list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { + if (mptcp_addresses_equal(&entry->addr, skc, false)) { + backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + break; + } + } + spin_unlock_bh(&msk->pm.lock); + + return backup; +} + int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) { struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index b8b25124e7de..60c6b073d65f 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1109,6 +1109,9 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); +bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc); +bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc); +bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc); int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); int mptcp_pm_nl_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index be406197b1c4..0e4b5bfbeaa1 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -100,6 +100,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) return NULL; } subflow_req->local_id = local_id; + subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); return msk; } @@ -620,6 +621,8 @@ static int subflow_chk_local_id(struct sock *sk) return err; subflow_set_local_id(subflow, err); + subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); + return 0; } From patchwork Sat Jul 27 10:01:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 814799 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 AA44457CAC; Sat, 27 Jul 2024 10:03:46 +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=1722074626; cv=none; b=OMdCmNvKgCOyMjeT2kTm0u3XjIMkHV65FAZvrnEedGslevaUVqT1LQFc/Co3RIjFyuL0SsNQvRA4N6+etcljiD+bQc8/DwCT3zi8cGGMW1duUFQ2zLPnJobtkpqJmzP7YkesO/xKmAvL7rD6LlNC136I7WM0MqAcWUOQuLuKwHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722074626; c=relaxed/simple; bh=B2vhK+0RBBQJO+CkqazxYwoIfSfpFJCq0O68Tg4d5m0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VQ4NtPFiAVCC/gutJPw8m83wvrmNH4d3R0erG1ZBWouVam2LSuMeS64PHwop1phbTT+QwnAjYQFXX06+u9gVN4M9M+bSGbgYajRDQHUY1jzTlWNookDNBY2doulHeSeuGuPbVSi5M0QCBIa3w0pWaNHW1Ex1Urrvv+mnn8FCrQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RdVqDUwj; 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="RdVqDUwj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A790C4AF0E; Sat, 27 Jul 2024 10:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722074626; bh=B2vhK+0RBBQJO+CkqazxYwoIfSfpFJCq0O68Tg4d5m0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RdVqDUwj4I/Mb/qdteXi0uD7bg/HXL9bqVg9UsM8vZZAey0WtwwBUc42TNwwV72KT s9l15zbeQ6hql64CLydekW5QHaHSlni6FuS3TLfsqsfdYMWzbhG71ZO9kHBWDnJox7 pY2UIjsnju+ubfUg2MKuOuJpr0sAdIqjOrjHmFs+eIrJaRUy6YRjNwCrG+Y2xBeapS XpXSB+5VrPTuB0llYQZhydq4JxxtIm3Wr3qNq4L59FbVH9Y729C1Y4n+4If4dPMX4U PQ/LixXAGPXwNMwkrKbteis6a3ktSm/xuTTsHBQlvkAhBURmL5zFETcXaRB8aCDhTj 4fQ4EqOFkvMKg== From: "Matthieu Baerts (NGI0)" Date: Sat, 27 Jul 2024 12:01:29 +0200 Subject: [PATCH net 7/7] selftests: mptcp: join: check backup support in signal endp Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-7-f50b31604cf1@kernel.org> References: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> In-Reply-To: <20240727-upstream-net-20240727-mptcp-backup-signal-v1-0-f50b31604cf1@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Shuah Khan 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=3761; i=matttbe@kernel.org; h=from:subject:message-id; bh=B2vhK+0RBBQJO+CkqazxYwoIfSfpFJCq0O68Tg4d5m0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmpMXm5+RoMvMHoX9uSbfCV0l6chDQbp4wHe0+n KM+1XYUaOyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqTF5gAKCRD2t4JPQmmg c5f3D/9jwEMQsW92OQ4X+b2puhWmRoxg2fhuoJIECewgRDDWjb/W0+wywo1SPlKREk9Qd5G8Jht XwFNuQ0bvICTFN5/mZ+3uk3B0fPAo8AK86T0A+cTQT8xshLhsWRZmjA9lJlGHqynXPRmS7NzwhL jF/htRv0O3TN8kKfNjqCK41JqYxrCPEtNoaiwJ4BQfHnVZKaVjR+aX7H1V8i9pkNpTA+VF/+3Bq 4lA3j+gC/8V4ftGkdVrd8vAgDU9L0GZSPeF88EbaURZMuHzPkjl5bP7wx0f6MzNAHkN4yrvxiLR y0BtlmavYPI15vFuuZFprhq9FrioSpg/rTqQ92/iNC4UmNQR6Y+6LA2qZ5IMZOUUQ3tCk17ilB7 BuFamGHh0zIWiSjqO4fM1eVRITYtPPL8pkk+Yl5yl+DbE/gYgEnnDgY/dudbEYy8sbW+QtSqqzf XPR5QTSJ0wqUZb5SAnIZYlQl6zlMCBdZz6y82q8Cd/lNJvHvDigR3WM+uUT5y7a7AN6Yu3OetpI OZAbtA7263pb3EJss5ILLFPNuzG9O5e0QcnvAPEu8JCBpCbbF7zsS8MQ0SGEra7gwK1pFJ7l8AH s+TvNbSbFENuboBPanz30UaqEkNvKt8e9wELwbn+sA3Lc29ktMI8mEHO0A+JnhyfcXS3ysH1WEd pFLKIVnCc61O8Wg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Before the previous commit, 'signal' endpoints with the 'backup' flag were ignored when sending the MP_JOIN. The MPTCP Join selftest has then been modified to validate this case: the "single address, backup" test, is now validating the MP_JOIN with a backup flag as it is what we expect it to do with such name. The previous version has been kept, but renamed to "single address, switch to backup" to avoid confusions. The "single address with port, backup" test is also now validating the MPJ with a backup flag, which makes more sense than checking the switch to backup with an MP_PRIO. The "mpc backup both sides" test is now validating that the backup flag is also set in MP_JOIN from and to the addresses used in the initial subflow, using the special ID 0. 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: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 34 ++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 655715c8c6d9..9c7d0ab106d0 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2639,6 +2639,19 @@ backup_tests() # single address, backup if reset "single address, backup" && + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then + pm_nl_set_limits $ns1 0 1 + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup + pm_nl_set_limits $ns2 1 1 + sflags=nobackup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 1 1 1 + chk_add_nr 1 1 + chk_prio_nr 1 0 0 1 + fi + + # single address, switch to backup + if reset "single address, switch to backup" && continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then pm_nl_set_limits $ns1 0 1 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal @@ -2654,13 +2667,13 @@ backup_tests() if reset "single address with port, backup" && continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then pm_nl_set_limits $ns1 0 1 - pm_nl_add_endpoint $ns1 10.0.2.1 flags signal port 10100 + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup port 10100 pm_nl_set_limits $ns2 1 1 - sflags=backup speed=slow \ + sflags=nobackup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 chk_add_nr 1 1 - chk_prio_nr 1 1 0 0 + chk_prio_nr 1 0 0 1 fi if reset "mpc backup" && @@ -2674,12 +2687,21 @@ backup_tests() if reset "mpc backup both sides" && continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then - pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup + pm_nl_set_limits $ns1 0 2 + pm_nl_set_limits $ns2 1 2 + pm_nl_add_endpoint $ns1 10.0.1.1 flags signal,backup pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup + + # 10.0.2.2 (non-backup) -> 10.0.1.1 (backup) + pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow + # 10.0.1.2 (backup) -> 10.0.2.1 (non-backup) + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal + ip -net "$ns2" route add 10.0.2.1 via 10.0.1.1 dev ns2eth1 # force this path + speed=slow \ run_tests $ns1 $ns2 10.0.1.1 - chk_join_nr 0 0 0 - chk_prio_nr 1 1 0 0 + chk_join_nr 2 2 2 + chk_prio_nr 1 1 1 1 fi if reset "mpc switch to backup" &&