Skip to content

Commit 07c2f3c

Browse files
matttbegregkh
authored andcommitted
mptcp: pm: kernel: correctly retransmit ADD_ADDR ID 0
commit b12014d upstream. When adding the ADD_ADDR to the list, the address including the IP, port and ID are copied. On the other hand, when the endpoint corresponds to the one from the initial subflow, the ID is set to 0, as specified by the MPTCP protocol. The issue is that the ID was reset after having copied the ID in the ADD_ADDR entry. So the retransmission was done, but using a different ID than the initial one. Fixes: 8b8ed1b ("mptcp: pm: reuse ID 0 after delete and re-add") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-1-fca8091060a4@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6f5ba49 commit 07c2f3c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

net/mptcp/pm_kernel.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
336336

337337
/* check first for announce */
338338
if (msk->pm.add_addr_signaled < endp_signal_max) {
339+
u8 endp_id;
340+
339341
/* due to racing events on both ends we can reach here while
340342
* previous add address is still running: if we invoke now
341343
* mptcp_pm_announce_addr(), that will fail and the
@@ -349,19 +351,20 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
349351
if (!select_signal_address(pernet, msk, &local))
350352
goto subflow;
351353

354+
/* Special case for ID0: set the correct ID */
355+
endp_id = local.addr.id;
356+
if (endp_id == msk->mpc_endpoint_id)
357+
local.addr.id = 0;
358+
352359
/* If the alloc fails, we are on memory pressure, not worth
353360
* continuing, and trying to create subflows.
354361
*/
355362
if (!mptcp_pm_alloc_anno_list(msk, &local.addr))
356363
return;
357364

358-
__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
365+
__clear_bit(endp_id, msk->pm.id_avail_bitmap);
359366
msk->pm.add_addr_signaled++;
360367

361-
/* Special case for ID0: set the correct ID */
362-
if (local.addr.id == msk->mpc_endpoint_id)
363-
local.addr.id = 0;
364-
365368
mptcp_pm_announce_addr(msk, &local.addr, false);
366369
mptcp_pm_addr_send_ack(msk);
367370

0 commit comments

Comments
 (0)