diff mbox series

[mptcp-net,v2,04/12] Squash to "mptcp: pm: reuse ID 0 after delete and re-add"

Message ID 20240816-mptcp-dup-close-evt-v2-4-8a33f6617f5c@kernel.org (mailing list archive)
State Accepted, archived
Commit 166b2e2e7e5503cdc91f448249b44476ce0fcc89
Delegated to: Matthieu Baerts
Headers show
Series mptcp: pm: fix re-re-create the ID 0 endpoint | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf__only_bpftest_all_ success Success! ✅

Commit Message

Matthieu Baerts Aug. 16, 2024, 11:01 a.m. UTC
Set the address ID to 0 before calling fill_remote_addresses_vec(): for
fullmesh cases, a bitmap will be created after having looked at all
subflow IDs matching the local one. The ID visible on the wire (e.g. 0)
should be compared to, not the one of the global endpoint (cannot be 0).

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_netlink.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 3784eb5e2044..eba3c0e2ec0d 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -621,14 +621,15 @@  static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 		msk->pm.local_addr_used++;
 		__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
-		nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs);
-		if (nr == 0)
-			continue;
 
 		/* Special case for ID0: set the correct ID */
 		if (local.addr.id == msk->mpc_endpoint_id)
 			local.addr.id = 0;
 
+		nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs);
+		if (nr == 0)
+			continue;
+
 		spin_unlock_bh(&msk->pm.lock);
 		for (i = 0; i < nr; i++)
 			__mptcp_subflow_connect(sk, &local, &addrs[i]);