Skip to contentSkip to conversation

mptcp: disable add_addr retrans

PATCH Superseded Geliang Tang 3 participants 6 messages Aug 6, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover mptcp: disable add_addr retrans

From: Geliang Tang <[email protected]>

This series enhances MPTCP's ADD_ADDR retransmission mechanism by:

1. Adding support for disabling retransmissions when add_addr_timeout is set to 0
2. Modifying the self-tests to leverage this new capability

The first patch implements the core functionality change in the MPTCP subsystem, while the second patch updates the selftests to use this feature for stabilizing a specific test case.

These changes provide more control over ADD_ADDR behavior and improve test reliability by eliminating race conditions caused by unexpected retransmissions.

Patch 1: When add_addr_timeout is 0, skip retransmission entirely Patch 2: Disable retransmissions in "delete re-add signal" test

Geliang Tang (2):
mptcp: disable add_addr retransmission when timeout is 0
selftests: mptcp: disable add_addr retrans in re-add test

 Documentation/networking/mptcp-sysctl.rst       | 2 ++
 net/mptcp/pm.c                                  | 7 ++++++-
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.48.1
author reviewer
#1 lore raw

PATCH 1/2 mptcp: disable add_addr retransmission when timeout is 0

From: Geliang Tang <[email protected]>

When add_addr_timeout is set to 0, it indicates that ADD_ADDR retransmissions should be disabled. This patch implements the logic to skip retransmissions when the timeout value is zero.

The documentation is updated to explicitly state that setting the timeout to 0 disables retransmission.

---
 Documentation/networking/mptcp-sysctl.rst | 2 ++
 net/mptcp/pm.c                            | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/networking/mptcp-sysctl.rst +2 -0
index 5bfab01eff5a..1683c139821e 100644
@@ -12,6 +12,8 @@ add_addr_timeout - INTEGER (seconds)
 	resent to an MPTCP peer that has not acknowledged a previous
 	ADD_ADDR message.
 
+	Do not retransmit if set to 0.
+
 	The default value matches TCP_RTO_MAX. This is a per-namespace
 	sysctl.
 
net/mptcp/pm.c +6 -1
index 687dbb59d084..5dec018fdda2 100644
@@ -274,6 +274,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 							      add_timer);
 	struct mptcp_sock *msk = entry->sock;
 	struct sock *sk = (struct sock *)msk;
+	unsigned int timeout;
 
 	pr_debug("msk=%p\n", msk);
 
@@ -291,6 +292,10 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 		goto out;
 	}
 
+	timeout = mptcp_get_add_addr_timeout(sock_net(sk));
+	if (!timeout)
+		goto out;
+
 	spin_lock_bh(&msk->pm.lock);
 
 	if (!mptcp_pm_should_add_signal_addr(msk)) {
@@ -302,7 +307,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 
 	if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
 		sk_reset_timer(sk, timer,
-			       jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
+			       jiffies + timeout);
 
 	spin_unlock_bh(&msk->pm.lock);
 
Signature · 1 line
2.48.1
maintainer
#2 lore raw

Re: [PATCH mptcp-net 1/2] mptcp: disable add_addr retransmission when timeout is 0

Hi Geliang,

Thank you for looking at that!

Quoted 5 lines · Geliang Tang

From: Geliang Tang <[email protected]>

When add_addr_timeout is set to 0, it indicates that ADD_ADDR retransmissions should be disabled. This patch implements the logic to skip retransmissions when the timeout value is zero.

I think the description should show there was an issue when previously set to 0, e.g.

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".

Quoted 2 lines

The documentation is updated to explicitly state that setting the timeout to 0 disables retransmission.

Good idea!

Quoted 1 line

Thanks!

If it is seen as a fix, you can add a Fixes tag corresponding to the introduction of this sysctl knob.

Quoted 32 lines
---
 Documentation/networking/mptcp-sysctl.rst | 2 ++
 net/mptcp/pm.c                            | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/networking/mptcp-sysctl.rst +2 -0
index 5bfab01eff5a..1683c139821e 100644
@@ -12,6 +12,8 @@ add_addr_timeout - INTEGER (seconds)
 	resent to an MPTCP peer that has not acknowledged a previous
 	ADD_ADDR message.
 
+	Do not retransmit if set to 0.
+
 	The default value matches TCP_RTO_MAX. This is a per-namespace
 	sysctl.
 
net/mptcp/pm.c +1 -0
index 687dbb59d084..5dec018fdda2 100644
@@ -274,6 +274,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 							      add_timer);
 	struct mptcp_sock *msk = entry->sock;
 	struct sock *sk = (struct sock *)msk;
+	unsigned int timeout;
 
 	pr_debug("msk=%p\n", msk);
 

net/mptcp/pm.c static void mptcp_pm_add_timer(struct timer_list *timer) · line 297

Quoted 6 lines
net/mptcp/pm.c +3 -0
@@ -291,6 +292,10 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 		goto out;
 	}
 
+	timeout = mptcp_get_add_addr_timeout(sock_net(sk));
+	if (!timeout)
+		goto out;

I think it would be better to patch mptcp_pm_alloc_anno_list(): without that, it means sk_reset_timer() will cause mptcp_pm_add_timer() to be called for no reasons. It looks better to prevent this, no?

(In fact, it is maybe enough to only patch mptcp_pm_alloc_anno_list(), no?)

net/mptcp/pm.c static void mptcp_pm_add_timer(struct timer_list *timer) · line 313

Quoted 13 lines
net/mptcp/pm.c +2 -1
+
 	spin_lock_bh(&msk->pm.lock);
 
 	if (!mptcp_pm_should_add_signal_addr(msk)) {
@@ -302,7 +307,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 
 	if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
 		sk_reset_timer(sk, timer,
-			       jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
+			       jiffies + timeout);
 
 	spin_unlock_bh(&msk->pm.lock);
 

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#3 lore raw

Re: [PATCH mptcp-net 1/2] mptcp: disable add_addr retransmission when timeout is 0

Quoted 73 lines · Matthieu Baerts

Hi Geliang,

Thank you for looking at that!

Quoted 5 lines · Geliang Tang

From: Geliang Tang <[email protected]>

When add_addr_timeout is set to 0, it indicates that ADD_ADDR retransmissions should be disabled. This patch implements the logic to skip retransmissions when the timeout value is zero.

I think the description should show there was an issue when previously set to 0, e.g.

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".

Quoted 2 lines

The documentation is updated to explicitly state that setting the timeout to 0 disables retransmission.

Good idea!

Quoted 1 line

Thanks!

If it is seen as a fix, you can add a Fixes tag corresponding to the introduction of this sysctl knob.

Quoted 32 lines
---
 Documentation/networking/mptcp-sysctl.rst | 2 ++
 net/mptcp/pm.c                            | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/networking/mptcp-sysctl.rst +2 -0
index 5bfab01eff5a..1683c139821e 100644
@@ -12,6 +12,8 @@ add_addr_timeout - INTEGER (seconds)
 	resent to an MPTCP peer that has not acknowledged a previous
 	ADD_ADDR message.
 
+	Do not retransmit if set to 0.
+
 	The default value matches TCP_RTO_MAX. This is a per-namespace
 	sysctl.
 
net/mptcp/pm.c +1 -0
index 687dbb59d084..5dec018fdda2 100644
@@ -274,6 +274,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 							      add_timer);
 	struct mptcp_sock *msk = entry->sock;
 	struct sock *sk = (struct sock *)msk;
+	unsigned int timeout;
 
 	pr_debug("msk=%p\n", msk);
 

net/mptcp/pm.c static void mptcp_pm_add_timer(struct timer_list *timer) · line 297

Quoted 6 lines
net/mptcp/pm.c +3 -0
@@ -291,6 +292,10 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 		goto out;
 	}
 
+	timeout = mptcp_get_add_addr_timeout(sock_net(sk));
+	if (!timeout)
+		goto out;

I think it would be better to patch mptcp_pm_alloc_anno_list(): without that, it means sk_reset_timer() will cause mptcp_pm_add_timer() to be called for no reasons. It looks better to prevent this, no?

Quoted 1 line

(In fact, it is maybe enough to only patch mptcp_pm_alloc_anno_list(), no?)

No, I guess it is required to patch all of them, just in case the sysctl value is modified in between.

Quoted 12 lines
Quoted 12 lines
net/mptcp/pm.c +2 -1
+
 	spin_lock_bh(&msk->pm.lock);
 
 	if (!mptcp_pm_should_add_signal_addr(msk)) {
@@ -302,7 +307,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
 
 	if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
 		sk_reset_timer(sk, timer,
-			       jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
+			       jiffies + timeout);
 
Quoted 5 lines

net/mptcp/pm.c static void mptcp_pm_add_timer(struct timer_list *timer) · line 313

Quoted 2 lines
net/mptcp/pm.c +0 -0
 	spin_unlock_bh(&msk->pm.lock);
 

Cheers,
Matt

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
author reviewer
#4 lore raw

PATCH 2/2 selftests: mptcp: disable add_addr retrans in re-add test

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

To prevent test instability in the "delete re-add signal" test caused by ADD_ADDR retransmissions, disable retransmissions for this test by setting net.mptcp.add_addr_timeout to 0.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
index b8af65373b3a..82cae37d9c20 100755
@@ -3842,6 +3842,7 @@ endpoint_tests()
 	# remove and re-add
 	if reset_with_events "delete re-add signal" &&
 	   mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+		ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=0
 		pm_nl_set_limits $ns1 0 3
 		pm_nl_set_limits $ns2 3 3
 		pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
Signature · 1 line
2.48.1
#5 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Unstable: 1 failed test(s): selftest_mptcp_connect_checksum 🔴
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Unstable: 1 failed test(s): bpftest_test_progs-no_alu32_mptcp 🔴
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16778650073

Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/eaa0db57b54e
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=988603

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)