From f4e5c573c93835d8f0024b901abaeed6d23c1aa0 Mon Sep 17 00:00:00 2001 From: Gang Yan Date: Wed, 11 Dec 2024 17:03:58 +0800 Subject: [PATCH] mptcp: fix invalid addr occupy 'add_addr_accepted' This patch fixes an issue where an invalid address is announce as a signal, the 'add_addr_accepted' is incorrectly added several times when 'retransmit ADD_ADDR'. So we need to update this variable when the connection is removed from conn_list by mptcp_worker. So that the available address can be added in time. In fact, the 'add_addr_accepted' is only declined when 'RM_ADDR' by now, so when subflows are getting closed from the other peer, the new signal is not accepted as well. We noticed there have exist some problems related to this.I think this patch effectively resolves them. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/498 Signed-off-by: Gang Yan Signed-off-by: NipaLocal --- net/mptcp/protocol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 08a72242428c03..7dbdc0485ef8f4 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2575,6 +2575,10 @@ static void __mptcp_close_subflow(struct sock *sk) continue; mptcp_close_ssk(sk, ssk, subflow); + + if (READ_ONCE(subflow->remote_id) && + --msk->pm.add_addr_accepted < mptcp_pm_get_add_addr_accept_max(msk)) + WRITE_ONCE(msk->pm.accept_addr, true); } }