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

Matthieu Baerts (NGI0) posted 12 patches 3 months, 1 week ago
[PATCH mptcp-net v2 04/12] Squash to "mptcp: pm: reuse ID 0 after delete and re-add"
Posted by Matthieu Baerts (NGI0) 3 months, 1 week ago
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 --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]);

-- 
2.45.2