Skip to content

Commit 30cf211

Browse files
committed
tgupdate: merge t/DO-NOT-MERGE-git-markup-features-other-trees into t/DO-NOT-MERGE-mptcp-use-kmalloc-on-kasan-build base
2 parents 79f5381 + 0ee8041 commit 30cf211

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

Documentation/networking/mptcp-sysctl.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,19 @@ stale_loss_cnt - INTEGER
108108
This is a per-namespace sysctl.
109109

110110
Default: 4
111+
112+
syn_retrans_before_tcp_fallback - INTEGER
113+
The number of SYN + MP_CAPABLE retransmissions before falling back to
114+
TCP, i.e. dropping the MPTCP options. In other words, if all the packets
115+
are dropped on the way, there will be:
116+
117+
* The initial SYN with MPTCP support
118+
* This number of SYN retransmitted with MPTCP support
119+
* The next SYN retransmissions will be without MPTCP support
120+
121+
0 means the first retransmission will be done without MPTCP options.
122+
>= 128 means that all SYN retransmissions will keep the MPTCP options. A
123+
lower number might increase false-positive MPTCP blackholes detections.
124+
This is a per-namespace sysctl.
125+
126+
Default: 2

net/mptcp/ctrl.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct mptcp_pernet {
3232
unsigned int close_timeout;
3333
unsigned int stale_loss_cnt;
3434
atomic_t active_disable_times;
35+
u8 syn_retrans_before_tcp_fallback;
3536
unsigned long active_disable_stamp;
3637
u8 mptcp_enabled;
3738
u8 checksum_enabled;
@@ -92,6 +93,7 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
9293
pernet->mptcp_enabled = 1;
9394
pernet->add_addr_timeout = TCP_RTO_MAX;
9495
pernet->blackhole_timeout = 3600;
96+
pernet->syn_retrans_before_tcp_fallback = 2;
9597
atomic_set(&pernet->active_disable_times, 0);
9698
pernet->close_timeout = TCP_TIMEWAIT_LEN;
9799
pernet->checksum_enabled = 0;
@@ -245,6 +247,12 @@ static struct ctl_table mptcp_sysctl_table[] = {
245247
.proc_handler = proc_blackhole_detect_timeout,
246248
.extra1 = SYSCTL_ZERO,
247249
},
250+
{
251+
.procname = "syn_retrans_before_tcp_fallback",
252+
.maxlen = sizeof(u8),
253+
.mode = 0644,
254+
.proc_handler = proc_dou8vec_minmax,
255+
},
248256
};
249257

250258
static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
@@ -269,6 +277,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
269277
/* table[7] is for available_schedulers which is read-only info */
270278
table[8].data = &pernet->close_timeout;
271279
table[9].data = &pernet->blackhole_timeout;
280+
table[10].data = &pernet->syn_retrans_before_tcp_fallback;
272281

273282
hdr = register_net_sysctl_sz(net, MPTCP_SYSCTL_PATH, table,
274283
ARRAY_SIZE(mptcp_sysctl_table));
@@ -392,17 +401,21 @@ void mptcp_active_enable(struct sock *sk)
392401
void mptcp_active_detect_blackhole(struct sock *ssk, bool expired)
393402
{
394403
struct mptcp_subflow_context *subflow;
395-
u32 timeouts;
396404

397405
if (!sk_is_mptcp(ssk))
398406
return;
399407

400-
timeouts = inet_csk(ssk)->icsk_retransmits;
401408
subflow = mptcp_subflow_ctx(ssk);
402409

403410
if (subflow->request_mptcp && ssk->sk_state == TCP_SYN_SENT) {
404-
if (timeouts == 2 || (timeouts < 2 && expired)) {
405-
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPCAPABLEACTIVEDROP);
411+
struct net *net = sock_net(ssk);
412+
u8 timeouts, to_max;
413+
414+
timeouts = inet_csk(ssk)->icsk_retransmits;
415+
to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback;
416+
417+
if (timeouts == to_max || (timeouts < to_max && expired)) {
418+
MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP);
406419
subflow->mpc_drop = 1;
407420
mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow);
408421
} else {

0 commit comments

Comments
 (0)