From nobody Sat Jul 25 07:03:25 2026 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32906434E4E for ; Thu, 23 Jul 2026 09:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784800582; cv=none; b=BDAFWmA+WiExzQDu/GWpCszFjEIMUwe53E/ZnApfesaxwlSsiBOkpFNSXFeGftvmMZLJPA8c4K9HKpyr7xNBUIb9QBjLhYq8mAyPYQwypRq1+sneN/b2X/dsx8R+0iBR8CXQ+5U4oXJK5ES9g6Rfi2g5QsRSPiNng1qu/WpzZ5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784800582; c=relaxed/simple; bh=gmDhrjY9+UOFIzJ6CbaOzWk+RWnmGShFvi2LylfDJis=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=minh1j9PutaINCrIOa1l/YdATmvH88gXj1+oR6kxFl93a+ElGxH6BttSBDOc4f9mQvA1vIv7Oy7fKXaRRYmL9+A9w186VtIBMD+GJCEPBXnZga0lxnQZo480bKn5INbo2FVSmh5bnNQVBbX6LH9KT++EqkINb+BhUmlykkkjtAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NZmS9qUm; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NZmS9qUm" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784800579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y0v4t/rEpX4QHM5Hi2RaMsXumoLpJDPxZ+R8uPvGIvQ=; b=NZmS9qUmDVwuFlVvu4iLPST/96hSk4he2eJKpiGttAmcugRgUjRTbU12bW3Qt/M3Qwqx3+ mIOTx/1cfOtNgNptnBpvqyjOUG907YjJy/RL3DdxpsI7P4io4kzJFPqXX8nqnn3g1Bv208 JkPUq1tPr5cemQDcy5Udl9Bi3K+yl/w= From: Gang Yan Date: Thu, 23 Jul 2026 17:55:57 +0800 Subject: [PATCH mptcp-next 1/2] mptcp: pm: userspace: decrement local_addr_used when remove Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260723-localaddr-v1-1-ce84b865594a@kylinos.cn> References: <20260723-localaddr-v1-0-ce84b865594a@kylinos.cn> In-Reply-To: <20260723-localaddr-v1-0-ce84b865594a@kylinos.cn> To: MPTCP Linux Cc: Gang Yan X-Migadu-Flow: FLOW_OUT From: Gang Yan mptcp_userspace_pm_append_new_local_addr() increments msk->pm.local_addr_us= ed when a new local address is appended, and mptcp_userspace_pm_delete_local_a= ddr() decrements it when an entry is removed via the subflow destroy path. The mptcp_pm_nl_remove_doit() netlink REMOVE_ADDR handler, however, only unlinks the matching entry from msk->pm.userspace_pm_local_addr_list via list_del_rcu() without touching the counter, so the counter is not changed = every time userspace removes an address by id. Decrement msk->pm.local_addr_used under the pm lock right after list_del_rc= u(), mirroring the increment site, so the counter stays in sync with the actual number of entries left in the list. Assisted-by: Codex:GLM-5.2 Fixes: 77e4b94a3de6 ("mptcp: update userspace pm infos") Signed-off-by: Gang Yan --- net/mptcp/pm_userspace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 73094bdbdbf2..6402226a9f0e 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -334,6 +334,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct= genl_info *info) } =20 list_del_rcu(&match->list); + msk->pm.local_addr_used--; spin_unlock_bh(&msk->pm.lock); =20 mptcp_pm_remove_addr_entry(msk, match); --=20 2.43.0 From nobody Sat Jul 25 07:03:25 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCD2042900D for ; Thu, 23 Jul 2026 09:56:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784800585; cv=none; b=EsDdOezhikw8RZ5e3rHyF7FkqtQvO0Zwu9t49+94fAPNUIeov8VJqUKImsfqWh8ZkjBZN8nrKMJj7JWCym3pHcFVaGx8Hg4PdlgOBehTQV5WMRxC0794ttwEvZh0gX6HU1jjKbN9wbP4+FxQ/kbcgGdn8BJU8MzmMdf0YgeAEUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784800585; c=relaxed/simple; bh=4dq+AfFJnc9i3T4d2D0Uu0GdHw2xgZF6Xk2tckSnQ0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k4FdRATTeK+55SiFkc/H64ro/OSP0TQt5s8smG85COjoihF9dwT1bNg83I2Ij6c0+Z5zuNsPe30tDyOGvMNTAEfDiqJDlSmeUayJ9etrhf5FbrzpU/AyLv7rhNepI4DWHYrNR22hnvNlPEzYgVVnLR4MKFec6i2Gxks9y15Z9R4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MNpBxbfK; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MNpBxbfK" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784800581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x07/KnxTps7j5nG2mCB2NLpZgVKtjzP6YnwyINvd4uA=; b=MNpBxbfKJ2EzjqEl01qUsJfxaKzpz60aDRdiBgaru3z5KJyvcsF0zHfo8DmACxexl6FOE+ l7+5YfVv3moamxjkAgeZRa6pGSFSlSrgxE7/vGT9Gx9fhv9brSNHUQwmDvSagbXd/L70z5 vUXxbxLfSjFPJWMdKSPvDZWLqWrBXPE= From: Gang Yan Date: Thu, 23 Jul 2026 17:55:58 +0800 Subject: [PATCH mptcp-next 2/2] selftests: mptcp: check local_addr_used in userspace PM Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260723-localaddr-v1-2-ce84b865594a@kylinos.cn> References: <20260723-localaddr-v1-0-ce84b865594a@kylinos.cn> In-Reply-To: <20260723-localaddr-v1-0-ce84b865594a@kylinos.cn> To: MPTCP Linux Cc: Gang Yan X-Migadu-Flow: FLOW_OUT From: Gang Yan This patch extends userspace_pm.sh to check the local_addr_used in 'test_announce'/'test_remove'. We need to make sure it should increase after 'ann' and decline after 'rem'. Assisted-by: Codex:GLM-5.2 Signed-off-by: Gang Yan --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 31 +++++++++++++++++++= ++++ 1 file changed, 31 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/test= ing/selftests/net/mptcp/userspace_pm.sh index 30a809752d1b..eaf356b9e039 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -391,6 +391,17 @@ test_announce() sleep 0.5 verify_announce_event "$client_evts" "$ANNOUNCED" "$client4_token" "10.0.= 2.1"\ "$server_addr_id" "$new4_port" + + # Check local_addr_used was incremented after announces on server + local addr_used + addr_used=3D$(ss -N "$ns1" -inmHM "sport =3D :$app4_port" | \ + mptcp_lib_get_info_value "local_addr_used" "local_addr_used") + print_test "local_addr_used > 0 after announce" + if [ "$addr_used" =3D 2 ] 2>/dev/null; then + test_pass + else + test_fail "local_addr_used=3D${addr_used} (expected 2)" + fi } =20 verify_remove_event() @@ -495,6 +506,26 @@ test_remove() print_test "RM_ADDR6 id:server-1 ns1 =3D> ns2" sleep 0.5 verify_remove_event "$client_evts" "$REMOVED" "$client6_token" "$server_a= ddr_id" + + # Check local_addr_used was decremented back to 0 after all removes + local addr_used + addr_used=3D$(ss -N "$ns1" -inmHM "sport =3D :$app4_port" | \ + mptcp_lib_get_info_value "local_addr_used" "local_addr_used") + print_test "local_addr_used=3D0 on server after remove" + if [ "$addr_used" =3D "0" ]; then + test_pass + else + test_fail "local_addr_used=3D${addr_used} (expected 0)" + fi + + addr_used=3D$(ss -N "$ns2" -inmHM "sport =3D :$client4_port" | \ + mptcp_lib_get_info_value "local_addr_used" "local_addr_used") + print_test "local_addr_used=3D0 on client after remove" + if [ "$addr_used" =3D "0" ]; then + test_pass + else + test_fail "local_addr_used=3D${addr_used} (expected 0)" + fi } =20 verify_subflow_events() --=20 2.43.0