From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1E6201C689C; Tue, 27 Aug 2024 14:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724770739; cv=none; b=lgzGqCdrhnr+/nyn+mGnSFK46C4CjZ0c4SaMW4F2UAEGubezSHZg89k0yA7Y2Z1YLpMHgrae+FcsBmkyBGmBIPpeK849NkhrKS+iBllc4IMIR9Shyu8SHRewkUOp2o5kw6yAbmaRW+kLACbucPgereHZWr7Er7hbNhECB1bOy+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724770739; c=relaxed/simple; bh=yq1He6xKXYeeIUQxLWB3xUdGQ/ewiZHHpd9wVuFbJn4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CFAYB+xRmxS7yCgoomGyKISHEs/JGr0KWV6/gs+y4eQ+OLLEo56ovxNAoJOvtOPUs6W9f5/cu2sCwUk4xJAbE1IkG+o+3h8PDl2eiLmiO1pJahtD98G4ouePA7TsxchZXhnlEp0t0KFQfUiFUBhmmB+9qCjKNy2WjcykVVQjyNU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m4aYuWDT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m4aYuWDT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F9CDC4AF1A; Tue, 27 Aug 2024 14:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724770739; bh=yq1He6xKXYeeIUQxLWB3xUdGQ/ewiZHHpd9wVuFbJn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4aYuWDTSC39ZNxQXqFVbwxlvQtLayTL8fHajTrElHuXSixwA3pyfieKKSSC1mRCX aj0jYc2pd9aMqxmegRIxhgo+IaHtwKQURb6bwZrfQNmdUA6bdjeBGD1nav/XWL2HJF jN8sMHmbRu3zsndDKswp1lhAdv/y8bY6KmbCRtCY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mat Martineau , "Matthieu Baerts (NGI0)" , Jakub Kicinski Subject: [PATCH 6.6 318/341] mptcp: pm: fullmesh: select the right ID later Date: Tue, 27 Aug 2024 16:39:09 +0200 Message-ID: <20240827143855.496065901@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240827143843.399359062@linuxfoundation.org> References: <20240827143843.399359062@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthieu Baerts (NGI0) commit 09355f7abb9fbfc1a240be029837921ea417bf4f upstream. When reacting upon the reception of an ADD_ADDR, the in-kernel PM first looks for fullmesh endpoints. If there are some, it will pick them, using their entry ID. It should set the ID 0 when using the endpoint corresponding to the initial subflow, it is a special case imposed by the MPTCP specs. Note that msk->mpc_endpoint_id might not be set when receiving the first ADD_ADDR from the server. So better to compare the addresses. Fixes: 1a0d6136c5f0 ("mptcp: local addresses fullmesh") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-12-38035d40de5b@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/mptcp/pm_netlink.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -644,6 +644,7 @@ static unsigned int fill_local_addresses { struct sock *sk = (struct sock *)msk; struct mptcp_pm_addr_entry *entry; + struct mptcp_addr_info mpc_addr; struct pm_nl_pernet *pernet; unsigned int subflows_max; int i = 0; @@ -651,6 +652,8 @@ static unsigned int fill_local_addresses pernet = pm_nl_get_pernet_from_msk(msk); subflows_max = mptcp_pm_get_subflows_max(msk); + mptcp_local_address((struct sock_common *)msk, &mpc_addr); + rcu_read_lock(); list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) @@ -661,7 +664,13 @@ static unsigned int fill_local_addresses if (msk->pm.subflows < subflows_max) { msk->pm.subflows++; - addrs[i++] = entry->addr; + addrs[i] = entry->addr; + + /* Special case for ID0: set the correct ID */ + if (mptcp_addresses_equal(&entry->addr, &mpc_addr, entry->addr.port)) + addrs[i].id = 0; + + i++; } } rcu_read_unlock();