Skip to contentSkip to conversation

mptcp: disable add_addr retrans

PATCH Applied Geliang Tang 3 participants 7 messages Aug 7, 2025 – Aug 15, 2025

Subsystems (4)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v2 cover mptcp: disable add_addr retrans

From: Geliang Tang <[email protected]>

v2:
- move "remove duplicate sk_reset_timer call" into this set.
- check add_addr timeout value in mptcp_pm_alloc_anno_list() too.

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: Remove duplicate sk_reset_timer call
Patch 2: When add_addr_timeout is 0, skip retransmission entirely Patch 3: Disable retransmissions in "delete re-add signal" test

Geliang Tang (3):
mptcp: remove duplicate sk_reset_timer call
mptcp: disable add_addr retransmission when timeout is 0
selftests: mptcp: disable add_addr retrans in endpoint_tests

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

PATCH v2 1/3 mptcp: remove duplicate sk_reset_timer call

From: Geliang Tang <[email protected]>

sk_reset_timer() was called twice in mptcp_pm_alloc_anno_list. Simplify the code by using a 'goto' statement to eliminate the duplication.

---
 net/mptcp/pm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/mptcp/pm.c +2 -3
index 687dbb59d084..b66126692ac1 100644
@@ -353,9 +353,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 		if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
 			return false;
 
-		sk_reset_timer(sk, &add_entry->add_timer,
-			       jiffies + mptcp_get_add_addr_timeout(net));
-		return true;
+		goto reset_timer;
 	}
 
 	add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC);
@@ -369,6 +367,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 	add_entry->retrans_times = 0;
 
 	timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
+reset_timer:
 	sk_reset_timer(sk, &add_entry->add_timer,
 		       jiffies + mptcp_get_add_addr_timeout(net));
 
Signature · 1 line
2.48.1
author reviewer
#2 lore raw

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

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

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 93f323b9cccc ("mptcp: add a new sysctl add_addr_timeout")
---
 Documentation/networking/mptcp-sysctl.rst |  2 ++
 net/mptcp/pm.c                            | 13 ++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
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 +10 -3
index b66126692ac1..e6dcc5b62645 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);
 
@@ -344,6 +349,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 	struct mptcp_pm_add_entry *add_entry = NULL;
 	struct sock *sk = (struct sock *)msk;
 	struct net *net = sock_net(sk);
+	unsigned int timeout;
 
 	lockdep_assert_held(&msk->pm.lock);
 
@@ -368,8 +374,9 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 
 	timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
 reset_timer:
-	sk_reset_timer(sk, &add_entry->add_timer,
-		       jiffies + mptcp_get_add_addr_timeout(net));
+	timeout = mptcp_get_add_addr_timeout(net);
+	if (timeout)
+		sk_reset_timer(sk, &add_entry->add_timer, jiffies + timeout);
 
 	return true;
 }
Signature · 1 line
2.48.1
author reviewer
#3 lore raw

PATCH v2 3/3 selftests: mptcp: disable add_addr retrans in endpoint_tests

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
#4 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: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16794019654

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/399555cff786
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=988945

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)

maintainer Reviewed-by on the v2 series
#5 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 16 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v2:
- move "remove duplicate sk_reset_timer call" into this set.
- check add_addr timeout value in mptcp_pm_alloc_anno_list() too.

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.

Quoted 7 lines

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

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

Thank you for the new version. It looks good to me:

I will just check with Mat if we consider this as a fix or not. I think it is, but the behaviour is slightly changed, even if it is to avoid a buggy one. I will then apply these patches after the next bi-weekly meeting.

Cheers,
Matt

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

Hi Geliang,

Quoted 27 lines · Matthieu Baerts

Hi Geliang,

Quoted 16 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v2:
- move "remove duplicate sk_reset_timer call" into this set.
- check add_addr timeout value in mptcp_pm_alloc_anno_list() too.

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.

Quoted 7 lines

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

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

Quoted 7 lines

Thank you for the new version. It looks good to me:

I will just check with Mat if we consider this as a fix or not. I think it is, but the behaviour is slightly changed, even if it is to avoid a buggy one. I will then apply these patches after the next bi-weekly meeting.

Applied to our tree (fixes for -net):

New patches for t/upstream-net and t/upstream:
- 144959b26e16: mptcp: remove duplicate sk_reset_timer call
- 5ca4045882f9: mptcp: disable add_addr retransmission when timeout is 0
- 230c29e8aa90: selftests: mptcp: disable add_addr retrans in endpoint_tests
- Results: 3f23a1fbaa6a..077ce244fe7b (export-net)
- Results: 7c14230bb733..186cac2c4d81 (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/097661ebac60d8cf1b143a91f6f11c71ef9fc5f5/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/576e85a3c313b3b1ea09f8369458e2c31784b99b/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.