]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: distinguish rcv vs sent backup flag in requests
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Sat, 27 Jul 2024 10:01:24 +0000 (12:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Aug 2024 10:58:02 +0000 (12:58 +0200)
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>
net/mptcp/options.c
net/mptcp/protocol.h
net/mptcp/subflow.c

index 8e8dcfbc299382454cf715a917c0f876ad5c35d4..8a68382a4fe9104c9bdd787669b801dc868e3973 100644 (file)
@@ -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;
index 7aa47e2dd52b158f022da0aa2747713a811ac596..bd7fe1db21a00b10c10d9a307b7670d35ed3d263 100644 (file)
@@ -443,6 +443,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;
index 612c38570a6426655dd7be8b7e140b8a72dac7ac..616929fa29924c9ce5e776b805dd7376965e13a9 100644 (file)
@@ -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;