summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>2024-07-27 12:01:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-11 12:36:01 +0200
commit09176f80995105c62939728fbad5c437d61e7ff4 (patch)
treeee495fa6cb1f1b97032a70003a63fe02f06269f4
parent991b26e1109a5163ba7fe6df8e99787af019d406 (diff)
downloadlinux-09176f80995105c62939728fbad5c437d61e7ff4.tar.gz
linux-09176f80995105c62939728fbad5c437d61e7ff4.tar.bz2
linux-09176f80995105c62939728fbad5c437d61e7ff4.zip
mptcp: distinguish rcv vs sent backup flag in requests
commit efd340bf3d7779a3a8ec954d8ec0fb8a10f24982 upstream. 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 <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/mptcp/options.c2
-rw-r--r--net/mptcp/protocol.h1
-rw-r--r--net/mptcp/subflow.c1
3 files changed, 3 insertions, 1 deletions
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index a718ebcb5bc6..daf53d685b5f 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -904,7 +904,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 eaed858c0ff9..a2b85eebb620 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -400,6 +400,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 f1d422396b28..77f70ba40a45 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1876,6 +1876,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
new_ctx->mp_join = 1;
new_ctx->fully_established = 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;