Skip to content

Commit f58d7d3

Browse files
committed
tgupdate: merge t/DO-NOT-MERGE-mptcp-enabled-by-default into t/upstream base
2 parents 88e46ac + 59bb59e commit f58d7d3

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

net/mptcp/ctrl.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -401,26 +401,30 @@ void mptcp_active_enable(struct sock *sk)
401401
void mptcp_active_detect_blackhole(struct sock *ssk, bool expired)
402402
{
403403
struct mptcp_subflow_context *subflow;
404+
u8 timeouts, to_max;
405+
struct net *net;
404406

405-
if (!sk_is_mptcp(ssk))
407+
/* Only check MPTCP SYN ... */
408+
if (likely(!sk_is_mptcp(ssk) || ssk->sk_state != TCP_SYN_SENT))
406409
return;
407410

408411
subflow = mptcp_subflow_ctx(ssk);
409412

410-
if (subflow->request_mptcp && ssk->sk_state == TCP_SYN_SENT) {
411-
struct net *net = sock_net(ssk);
412-
u8 timeouts, to_max;
413+
/* ... + MP_CAPABLE */
414+
if (!subflow->request_mptcp) {
415+
/* Mark as blackhole iif the 1st non-MPTCP SYN is accepted */
416+
subflow->mpc_drop = 0;
417+
return;
418+
}
413419

414-
timeouts = inet_csk(ssk)->icsk_retransmits;
415-
to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback;
420+
net = sock_net(ssk);
421+
timeouts = inet_csk(ssk)->icsk_retransmits;
422+
to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback;
416423

417-
if (timeouts == to_max || (timeouts < to_max && expired)) {
418-
MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP);
419-
subflow->mpc_drop = 1;
420-
mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow);
421-
}
422-
} else if (ssk->sk_state == TCP_SYN_SENT) {
423-
subflow->mpc_drop = 0;
424+
if (timeouts == to_max || (timeouts < to_max && expired)) {
425+
MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP);
426+
subflow->mpc_drop = 1;
427+
mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow);
424428
}
425429
}
426430

0 commit comments

Comments
 (0)