Skip to content

Commit f5ce071

Browse files
Geliang Tangkuba-moo
authored andcommitted
mptcp: disable add_addr retransmission when timeout is 0
When add_addr_timeout was set to 0, this caused the ADD_ADDR to be retransmitted immediately, which looks like a buggy behaviour. Instead, interpret 0 as "no retransmissions needed". The documentation is updated to explicitly state that setting the timeout to 0 disables retransmission. Fixes: 93f323b ("mptcp: add a new sysctl add_addr_timeout") Cc: [email protected] Suggested-by: Matthieu Baerts <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/20250815-net-mptcp-misc-fixes-6-17-rc2-v1-5-521fe9957892@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5d13349 commit f5ce071

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Documentation/networking/mptcp-sysctl.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ add_addr_timeout - INTEGER (seconds)
1212
resent to an MPTCP peer that has not acknowledged a previous
1313
ADD_ADDR message.
1414

15+
Do not retransmit if set to 0.
16+
1517
The default value matches TCP_RTO_MAX. This is a per-namespace
1618
sysctl.
1719

net/mptcp/pm.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
274274
add_timer);
275275
struct mptcp_sock *msk = entry->sock;
276276
struct sock *sk = (struct sock *)msk;
277+
unsigned int timeout;
277278

278279
pr_debug("msk=%p\n", msk);
279280

@@ -291,6 +292,10 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
291292
goto out;
292293
}
293294

295+
timeout = mptcp_get_add_addr_timeout(sock_net(sk));
296+
if (!timeout)
297+
goto out;
298+
294299
spin_lock_bh(&msk->pm.lock);
295300

296301
if (!mptcp_pm_should_add_signal_addr(msk)) {
@@ -302,7 +307,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
302307

303308
if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
304309
sk_reset_timer(sk, timer,
305-
jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
310+
jiffies + timeout);
306311

307312
spin_unlock_bh(&msk->pm.lock);
308313

@@ -344,6 +349,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
344349
struct mptcp_pm_add_entry *add_entry = NULL;
345350
struct sock *sk = (struct sock *)msk;
346351
struct net *net = sock_net(sk);
352+
unsigned int timeout;
347353

348354
lockdep_assert_held(&msk->pm.lock);
349355

@@ -368,8 +374,9 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
368374

369375
timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
370376
reset_timer:
371-
sk_reset_timer(sk, &add_entry->add_timer,
372-
jiffies + mptcp_get_add_addr_timeout(net));
377+
timeout = mptcp_get_add_addr_timeout(net);
378+
if (timeout)
379+
sk_reset_timer(sk, &add_entry->add_timer, jiffies + timeout);
373380

374381
return true;
375382
}

0 commit comments

Comments
 (0)