Article View: linux.kernel.netdev
Article #26896Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
From: Matthieu Baerts
Date: Fri, 04 Dec 2026 11:05
Date: Fri, 04 Dec 2026 11:05
84 lines
14693 bytes
14693 bytes
Hi Kyuwon,
Thank you for sharing this patch.
On 04/12/2026 06:11, Kyuwon Cho wrote:
> The ID 0 removal path copies the MPTCP socket's local address, then clears
> its port before looking for a pending ADD_ADDR. An ID 0 ADD_ADDR that was
> announced with a port is stored with that port
I think the root cause of your issue is there: an ID 0 ADD_ADDR
shouldn't be announced with a port: the ID0 is a bit special: it is
linked to the initial subflow IP address and port. It should then use
the "default" port (set to 0 then), the one linked to the msk, so the
initial one.
> so removal misses the
> entry. A later announcement of the same address finds the stale entry and
> warns:
>
> WARNING: net/mptcp/pm.c:451 at mptcp_pm_announced_alloc
> RIP: 0010:mptcp_pm_announced_alloc (net/mptcp/pm.c:451)
> Call Trace:
> mptcp_pm_create_subflow_or_signal_addr (net/mptcp/pm_kernel.c:377)
> mptcp_pm_nl_add_addr_doit
> (net/mptcp/pm_kernel.c:983 net/mptcp/pm_kernel.c:1049)
> genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)
>
> Use the port supplied with the removal request. Portless removals continue
> to use zero, while port-specific entries can now be found and removed.
>
> Fixes: 2ac7d6e62076 ("mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0")
I started working on a fix when this patch was sent upstream. I was
doing that:
================================= 8< =================================
diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
index d3014bf57bf3..cd9df9f56d96 100644
--- a/net/mptcp/pm_kernel.c
+++ b/net/mptcp/pm_kernel.c
@@ -314,6 +314,7 @@ static void mptcp_mpc_endpoint_setup(struct mptcp_sock *msk)
pernet = pm_nl_get_pernet_from_msk(msk);
mptcp_local_address((struct sock_common *)msk->first, &mpc_addr);
+ mpc_addr.port = 0; /* entries for ID0 don't have a specific port */
rcu_read_lock();
entry = __lookup_addr(pernet, &mpc_addr);
if (entry) {
@@ -368,7 +369,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
/* Special case for ID0: set the correct ID */
endp_id = local.addr.id;
- if (endp_id == msk->mpc_endpoint_id)
+ if (endp_id == msk->mpc_endpoint_id && local.addr.port == 0)
local.addr.id = 0;
/* If the alloc fails, we are on memory pressure, not worth
@@ -409,7 +410,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
__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)
+ if (local.addr.id == msk->mpc_endpoint_id && !local.addr.port)
local.addr.id = 0;
else /* local_addr_used is not decr for ID 0 */
msk->pm.local_addr_used++;
@@ -975,6 +976,7 @@ static int mptcp_nl_add_subflow_or_signal_addr(struct net *net,
/* if the endp linked to the init sf is re-added with a != ID */
mptcp_local_address((struct sock_common *)msk, &mpc_addr);
+ mpc_addr.port = 0; /* entries for ID0 don't have a port */
lock_sock(sk);
spin_lock_bh(&msk->pm.lock);
================================= 8< =================================
Could that help for your case? (Note: not tested, it might break
selftests / packetdrill tests: you might want to validate the whole
test suite with: https://github.com/multipath-tcp/mptcp-upstream-virtme-docker)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Technical Details
Message-ID:
<d021e6e0-1c96-40f0-8aca-e6096761eb85@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377279-linux-kernel-netdev=dewy.ruReferences:
<179633974213.577499.3953204420789445318@skku.edu>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377279-linux-kernel-netdev=dewy.ru From: matttbe@kernel.org (Matthieu Baerts) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0 Date: Fri, 4 Dec 2026 12:05:09 +0100 Organization: Usenet Network Message-ID: <d021e6e0-1c96-40f0-8aca-e6096761eb85@kernel.org> References: <179633974213.577499.3953204420789445318@skku.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2747191"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:R2bo4GTzWLwQsYpXTYyCrrgQZI4= sha256:R+Ez+sVWCMhzapdLqLLP6ExGdz2SKF1KLnXIoE7lNlA= sha1:2x+N2IZMa4G4TKaCff1pCGxy3mE= sha256:mFm9uTuSdkns267n44Hj5tI5fIMyI65Fht74zlJa7mE= Content-Language: fr List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 26DC1117BBE; Fri, 4 Dec 2026 14:05:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.641 X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zmETwguHOsAz; Fri, 4 Dec 2026 14:05:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377279-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 3BD7E117BA8; Fri, 4 Dec 2026 14:05:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 131DF28425; Fri, 4 Dec 2026 11:05:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382317; b=Jkc6w66awvl9ZUlHo2w7l/uTX5Uz3hiT2snCfhMCmf1t2XyKJB4m5V2gSpxp/jDhQdv4 R51UrathdFFJlKoS9FTb/QAY1dAFsnzeCpjsT8hFptwGumJckD5k9rJkqkauKbwUH7ccS U8HzS99eGgwfYuJnqkaSDaXVAQFAYYqDuKVeoG2aHAF8JLStCUDsTO5rnlgzOrAYVngf1 SCangcGJIp8q068FoxtmF8e8v5XwbML/+OE5SsZd248yjzasNE0sBRKO9c7GZuVDli2Q0 +c8ikEDKfmyKyHL5hYamaZDxpX6fej2XY47X6ZNuA1/PrX4YAGFk6cUdhT5UygnklZw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382317; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:Autocrypt:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=S8qwLx7mxLMxpnl+QeHH6RxIja/ntT+uIRgZ9opjQx0=; b=EQ0DdgPdmjoIg6es5nsTF1TbUNesDQ+BxBqgq/XxhCrG0QPdbDeyAQsPBVI41Bc6Dbxt MniLHeGpvYhjsluKa3u7571wkXMHpiNnO55uHDWJ/4uOnJXp1KALieiUqm1AlLxzTtCSs H9NSo/NdTWiEac89xKwlvItPKHTMyc969BO/7GjK5IfIVdErku64GHXgvR9iYUBTNdiSv 6rLVJg02qnk/CODf8vcszQfx042MDZHdwPq3SSNGvk4ECdcbMHxpwxSREJttZRyIw18gv Mg6crmWqlzH19JSFzzREPGggfQrVTm35mhyDip2yZ3lTKb6ulGuOxPGa1lqRj2dIseg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FjlPKf5F; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02385606A338; Fri, 4 Dec 2026 11:05:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FjlPKf5F X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382316; b=yn/H2CTIEeKmGu9uo3tQ2398IkY3G0cSSoCvbc10GoKnOkfgDkSUXQQplxd9jUW9+oGc PhrhPlCdcrLA7iK404wvSr/cwRxib1/r+BVmYfxCrPA34G/qGwBU7WVSzZFZJcHS1ib4h YOpcNbMDlsALSt1+dB0LAXOP6ijcbfHSxxNM1dOX3ZcebtEQpkAaKcevUftQAgaHsHhCf WIoS0DEjhqMHu60R7KvLUE28xNgAuWMv+etLi1TrbXUJgi8QPP9jqgDuA+g06x+/SpsCu jrOOuHPYREI3OJPeduioMMVEjufOTWRhJI2ZBTzBYxmRWjpZAon9fjXU+jsZDYR7NWA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382316; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:Autocrypt:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=S8qwLx7mxLMxpnl+QeHH6RxIja/ntT+uIRgZ9opjQx0=; b=bhfh4c2GidXn0hL32DngI7uWXLdsvdKBR4pJsWtcIFrVtJCwTq8qqTcu74q6nmtPwapq xnWNe13hyGlJ4YeC7zDVS8L3jYs7kxK8FmTsxDawUaAoYHTR2tRAtPFCzBnNIUVEOu36+ JBkxCsjC9/F+R7AlOGygMguj0hqEWGBkQGnXEMXuPkAGUPh/As+DAQ3jJ/YkjdMOCv3LU eaDHbpNhpC2hjNADP6taVjsluNgWLvlWlOygVEk4SKYgQZnahdAQCtT0yXP7F7L3r4UXI FVhuOagDevm1NL2tyrq3UEcMuZeuQJ8y8jq3SrawFOz+Ys4rP11ZsVCUZz7yT2Bq32A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FjlPKf5F; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA72606A333; Fri, 4 Dec 2026 11:05:16 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A6551F0092C; Fri, 4 Dec 2026 11:05:13 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796382315; bh=S8qwLx7mxLMxpnl+QeHH6RxIja/ntT+uIRgZ9opjQx0=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=FjlPKf5FJcs3+h7wG71DhGvbLJk4LPfoyay68FoMa50w4954hMBXhgEYmGgaAB7ex lOwAu86cVqHWVtjzla83Gm4Y53GT1fJ+jNXmJox9vbnwQAw2DTGRUMWrzJLADvECvi 2Rc3l+UlgmPeearuWVWpnxs1wwxMaxF9GgVPH753148UbG8me4JY2BcbOyHngVT3QR 7OIWqf1UkkcbjoFe1VJ1h6ZtZFSdKFwyu9H2RDD/iRn+CoPS4/fIrmha2rkM78lWz7 fN+dR91sg1JqBDmnyAWkiPdoprspzuoSM7dmh/jwbo8Ws222K8q7INs1flMSIqun1e vSxuDzreZ4NFA== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird Beta X-Cc: Mat Martineau <martineau@kernel.org>, Geliang Tang <geliang@kernel.org>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, Kalpan Jani <kalpan.jani@mpiricsoftware.com>, netdev@vger.kernel.org, mptcp@lists.linux.dev X-Autocrypt: addr=matttbe@kernel.org; keydata= xsFNBFXj+ekBEADxVr99p2guPcqHFeI/JcFxls6KibzyZD5TQTyfuYlzEp7C7A9swoK5iCvf YBNdx5Xl74NLSgx6y/1NiMQGuKeu+2BmtnkiGxBNanfXcnl4L4Lzz+iXBvvbtCbynnn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5VnD/9YgbCr HR1FbMbm7td54UrYvZV/i7m3dIQNXK2e+Cbv5PXf19ce3XluaE+wA8D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== X-Organization: NGI0 Core X-In-Reply-To: <179633974213.577499.3953204420789445318@skku.edu>