From nobody Thu Sep 19 00:59:33 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 F209213C8F3 for ; Fri, 5 Jul 2024 20:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720211653; cv=none; b=H8k4LtrOrUXEYzRCq1DnniO7STWYDRqOiI7HlefIuajWe/HwNfjLEIheQFkWXsMaiNT0Jj8WIanqZknsTLz7+4GB7Mt9bfCi5q2nrKBfUvTTv8aUKktYlY7d5+RtGcJjXqgewMNXaOp/E3f0f+EuVZNi44SlxU+VBX3BHcsFwbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720211653; c=relaxed/simple; bh=qY8vaQMdj10W3TUihl4FkC5+CCKfHxs4FbbTufJDOAc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Tm1TieihtZtEILb4r8N1ooq5xA1276POwxzsOjZe6lyOH5rxkFpcGAilf1HJGS2ffZakCn3FuTTo/VMWC519thk2PHz7vcD4fbeDID1awCE2OudBfJqMtoyZ9C/Mppdx8pc/incxY1Y8E5obf1phRj33s+Z4/KH+0ht+qzVKM14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=T95tlvOI; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T95tlvOI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720211651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0uD3BPcW7WGwyrl0Lw6AW+D+inMvidELS3AOKwG6ZXE=; b=T95tlvOISmhDrpDXicP+QYCtT5aQSQK+wJp52U6vSX7BgE0ao6bROhhiFarsJGClVssgAO 9ww5vnTWbN8tCu+enNCUB+5/VGttXhzS6t3opu8+y9nc+DgOQAJTGOKuAGjSQNqJtdAqns R8lgAlV/LOF7PGcip4xxwCFdTDziBeE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-J2sd9_qHOHqel1XHbb4G8A-1; Fri, 05 Jul 2024 16:34:07 -0400 X-MC-Unique: J2sd9_qHOHqel1XHbb4G8A-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B49E0195608F for ; Fri, 5 Jul 2024 20:34:06 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.224.16]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7C2231955F3B for ; Fri, 5 Jul 2024 20:34:05 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v2 2/4] mptcp: fix NL PM announced address accounting Date: Fri, 5 Jul 2024 22:33:48 +0200 Message-ID: <51c8168fab708db7f1fd2b52fec3111bf745db7f.1720211515.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Currently the per connection announced address counter is never decreased. As a consequence, after connection establishment, if the NL PM deletes an endpoint and adds a new/different one, no additional subflow is created for the new endpoint even if the current limits allow that. Address the issue properly updating the signaled address counter every time the NL PM removes such addresses. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Signed-off-by: Paolo Abeni --- v1 -> v2: - fix accounting in mptcp_pm_remove_anno_addr() - split NL PM bits --- net/mptcp/pm_netlink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index b399f2b7a369..f65831de5c1a 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1401,6 +1401,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_so= ck *msk, ret =3D remove_anno_list_by_saddr(msk, addr); if (ret || force) { spin_lock_bh(&msk->pm.lock); + msk->pm.add_addr_signaled -=3D ret; mptcp_pm_remove_addr(msk, &list); spin_unlock_bh(&msk->pm.lock); } @@ -1565,17 +1566,18 @@ static void mptcp_pm_remove_addrs_and_subflows(stru= ct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry; =20 list_for_each_entry(entry, rm_list, list) { - if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) && - slist.nr < MPTCP_RM_IDS_MAX) + if (slist.nr < MPTCP_RM_IDS_MAX && + lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) slist.ids[slist.nr++] =3D entry->addr.id; =20 - if (remove_anno_list_by_saddr(msk, &entry->addr) && - alist.nr < MPTCP_RM_IDS_MAX) + if (alist.nr < MPTCP_RM_IDS_MAX && + remove_anno_list_by_saddr(msk, &entry->addr)) alist.ids[alist.nr++] =3D entry->addr.id; } =20 if (alist.nr) { spin_lock_bh(&msk->pm.lock); + msk->pm.add_addr_signaled -=3D alist.nr; mptcp_pm_remove_addr(msk, &alist); spin_unlock_bh(&msk->pm.lock); } --=20 2.45.2