]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: distinguish rcv vs sent backup flag in requests
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 9 Aug 2024 09:06:08 +0000 (11:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Aug 2024 03:45:48 +0000 (05:45 +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>
[ Conflicts in subflow.c, because the context has changed in commit
  4cf86ae84c71 ("mptcp: strict local address ID selection"), and in
  commit 967d3c27127e ("mptcp: fix data races on remote_id"), which are
  not in this version. These commits are unrelated to this
  modification. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/options.c
net/mptcp/protocol.h
net/mptcp/subflow.c

index 3b4ce8a06f999580c02128726de3b13de74e5d3e..4d8f2f6a8f73f9a22279a8157fd106a4e08857fb 100644 (file)
@@ -877,7 +877,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 b4ccae4f684971c3940d6052f7aa978cedb11c4e..d2e68f5c62884455ef88406063e9893ce33b88e0 100644 (file)
@@ -370,6 +370,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 f96363d83e679f5226dd5eb353aebb7ff2fd2694..2fdc7b1d2f3285ac352323f65f3dd6f63e165a77 100644 (file)
@@ -1766,6 +1766,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;
                new_ctx->local_id = subflow_req->local_id;
                new_ctx->remote_id = subflow_req->remote_id;
                new_ctx->token = subflow_req->token;