Skip to content

Commit 9e365ff

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: drop MP_JOIN request sock on syn cookies
Currently any MPTCP socket using syn cookies will fallback to TCP at 3rd ack time. In case of MP_JOIN requests, the RFC mandate closing the child and sockets, but the existing error paths do not handle the syncookie scenario correctly. Address the issue always forcing the child shutdown in case of MP_JOIN fallback. Fixes: ae2dd71 ("mptcp: handle tcp fallback when using syn cookies") Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8fd4de1 commit 9e365ff

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

net/mptcp/subflow.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,25 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
431431
struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
432432
struct mptcp_subflow_request_sock *subflow_req;
433433
struct mptcp_options_received mp_opt;
434-
bool fallback_is_fatal = false;
434+
bool fallback, fallback_is_fatal;
435435
struct sock *new_msk = NULL;
436-
bool fallback = false;
437436
struct sock *child;
438437

439438
pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
440439

441-
/* we need later a valid 'mp_capable' value even when options are not
442-
* parsed
440+
/* After child creation we must look for 'mp_capable' even when options
441+
* are not parsed
443442
*/
444443
mp_opt.mp_capable = 0;
445-
if (tcp_rsk(req)->is_mptcp == 0)
444+
445+
/* hopefully temporary handling for MP_JOIN+syncookie */
446+
subflow_req = mptcp_subflow_rsk(req);
447+
fallback_is_fatal = subflow_req->mp_join;
448+
fallback = !tcp_rsk(req)->is_mptcp;
449+
if (fallback)
446450
goto create_child;
447451

448452
/* if the sk is MP_CAPABLE, we try to fetch the client key */
449-
subflow_req = mptcp_subflow_rsk(req);
450453
if (subflow_req->mp_capable) {
451454
if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
452455
/* here we can receive and accept an in-window,
@@ -467,12 +470,11 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
467470
if (!new_msk)
468471
fallback = true;
469472
} else if (subflow_req->mp_join) {
470-
fallback_is_fatal = true;
471473
mptcp_get_options(skb, &mp_opt);
472474
if (!mp_opt.mp_join ||
473475
!subflow_hmac_valid(req, &mp_opt)) {
474476
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
475-
return NULL;
477+
fallback = true;
476478
}
477479
}
478480

0 commit comments

Comments
 (0)