]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mptcp: pm: reuse ID 0 after delete and re-add
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Wed, 28 Aug 2024 06:14:24 +0000 (08:14 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 29 Aug 2024 08:39:49 +0000 (10:39 +0200)
When the endpoint used by the initial subflow is removed and re-added
later, the PM has to force the ID 0, it is a special case imposed by the
MPTCP specs.

Note that the endpoint should then need to be re-added reusing the same
ID.

Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/mptcp/pm_netlink.c

index 8d2f97854c6429c9641a0d2432e567ed78caa91d..ec45ab4c66abb1d3e80400d4d91291f005bb6dea 100644 (file)
@@ -585,6 +585,11 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
                __clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
                msk->pm.add_addr_signaled++;
+
+               /* Special case for ID0: set the correct ID */
+               if (local.addr.id == msk->mpc_endpoint_id)
+                       local.addr.id = 0;
+
                mptcp_pm_announce_addr(msk, &local.addr, false);
                mptcp_pm_nl_addr_send_ack(msk);
 
@@ -609,6 +614,11 @@ subflow:
 
                msk->pm.local_addr_used++;
                __clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
+
+               /* 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;