From nobody Fri Oct 18 06:18:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 C23FF1C689C for ; Fri, 28 Jun 2024 15:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590064; cv=none; b=uCzTyRy0KtnAswRTyGAdEHc4oXeM2P3zeX1BQJZLcWL45wO0fWoqcA1WNLNqxHVLSG5pqe+aWAyydKkhX2OSEDS/G6kRq1I6kPCpwdvhnG9fouah+R9G3axvQZqNRjXNLhyh6iAe2mRb+7a+ZZxsitIzKYfpWMQnbweET8C5JDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590064; c=relaxed/simple; bh=EwWh+3DWzVpZ1QIErg4XyvyEUw0wj3Ube0RJh8z7BfQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VIYSiTXfcqB7cLW6ldbWQVe7Qfcf85hWasF4MvRe3gLDBsTD5Z2pxAlLQksv+9AeG+Mas69ZuPC2TawsWYC3rGSKRoI1cYf8r8hI0+yRPNhjWTNUSZkS56y0+VLEDQLd7WDukpGcqDWEwD4KQEINw914FOaIlQnxRXnBnDrRXBg= 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=RPmaZ/42; arc=none smtp.client-ip=170.10.129.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="RPmaZ/42" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719590061; 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=Squ10khlfFWTEyFced8/TycyLB7EKlaYUBlZqUxfSQo=; b=RPmaZ/421WOlmz4He/k8b6LejpwjPwlfDeSDnlt4kbbxPW++f/ycjkiPK6j0LoC3wQBE/z ZpnXWXbqcnUiv+5CHm1syOBnlWUkUjlKaMtNIPPm03MiY4jzzo3qi4zGbi+XAI+GPYOybX 8jthvMYvMoFxNpyjYiZdPQMfq2Yu8Kk= Received: from mx-prod-mc-05.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-637-_-fbwmuxNfqnkTLdtuXjTQ-1; Fri, 28 Jun 2024 11:54:20 -0400 X-MC-Unique: _-fbwmuxNfqnkTLdtuXjTQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5672F1956089 for ; Fri, 28 Jun 2024 15:54:18 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.225.34]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C91D1955D89 for ; Fri, 28 Jun 2024 15:54:16 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net 1/3] mptcp: fix announced address accounting Date: Fri, 28 Jun 2024 17:54:06 +0200 Message-ID: <4a8ac95282ec2b551a64134f24b2e2fd7d82973c.1719589916.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.12 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 one of such address is removed. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Signed-off-by: Paolo Abeni --- slightly unrelated: is unclear to me why mptcp_pm_remove_addrs() does things slightly differently from mptcp_pm_remove_addrs_and_subflows(), with the latter IMHO doing the right thing (TM) --- net/mptcp/pm_netlink.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ea9e5817b9e9..624f9ea66aea 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--; mptcp_pm_remove_addr(msk, &list); spin_unlock_bh(&msk->pm.lock); } @@ -1534,16 +1535,25 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, = struct list_head *rm_list) { struct mptcp_rm_list alist =3D { .nr =3D 0 }; struct mptcp_pm_addr_entry *entry; + int anno_nr =3D 0; =20 list_for_each_entry(entry, rm_list, list) { - if ((remove_anno_list_by_saddr(msk, &entry->addr) || - lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) && - alist.nr < MPTCP_RM_IDS_MAX) - alist.ids[alist.nr++] =3D entry->addr.id; + if (alist.nr >=3D MPTCP_RM_IDS_MAX) + break; + + /* only delete if either announced or matching a subflow */ + if (remove_anno_list_by_saddr(msk, &entry->addr)) + anno_nr++; + else if (!lookup_subflow_by_saddr(&msk->conn_list, + &entry->addr)) + continue; + + alist.ids[alist.nr++] =3D entry->addr.id; } =20 if (alist.nr) { spin_lock_bh(&msk->pm.lock); + msk->pm.add_addr_signaled -=3D anno_nr; mptcp_pm_remove_addr(msk, &alist); spin_unlock_bh(&msk->pm.lock); } @@ -1556,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.1 From nobody Fri Oct 18 06:18:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 41C30156984 for ; Fri, 28 Jun 2024 15:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590064; cv=none; b=URiiJiei/KdTMFGtTzHsWRlJ3Icvuspw129dL6l+WcqAW9/bzFRRttKM+bFyXJUwVm3e59dcvSuvRR9vNU/OV4U2e5G8wzcT/TtGPfq5gcWZL9N5v1g/xKKfD9b44kuFrMbEsrGIK7atIW0AYhKiKQt//KW1yPinHl9TIxIIKMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590064; c=relaxed/simple; bh=doVW96hD6QiQIaRrsTzVL7Gi9HtDmsH3Wv13tDg1oA8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H29rs1P8wqFgd8PtCGjxaw26q4Y5e6Nfc+cBVVTT3g4vuezKz49WR0ZFf2Q55TJAuqoG/Wyl3YeaP2IQM910VyjSEflTl8/YCmRlXCic7ndEFj01rIBf5OoPJEY3wBeJpnLrLYnmtF1oP6OlgMBCJwo7fkLPy4IH3TxrtVfV3qU= 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=Sm3HThIa; arc=none smtp.client-ip=170.10.129.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="Sm3HThIa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719590062; 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=CIBQh24d6vWdM7BJTL3zDjjnjdKv+1+tuG8Mew6FA98=; b=Sm3HThIah0FnvTM+T3CwiJgvfJidGVT06PWr6RWCA1L7Ad42sf9gfbjSltC8mlnKceREqW ueqjS+ftsJLQYe8uQrbV3Bmq1VJkH/uBoBZOKorVXMjEzxqytdv+/hbyd9vALl5u5xRhst WPwOT89eW8AHMMm0EZn3L0m2djCujZs= 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-617-zt90u0FUONypnCcIaJ1GpA-1; Fri, 28 Jun 2024 11:54:20 -0400 X-MC-Unique: zt90u0FUONypnCcIaJ1GpA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 DCDDA1945110 for ; Fri, 28 Jun 2024 15:54:19 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.225.34]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DCE2B19560B2 for ; Fri, 28 Jun 2024 15:54:18 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net 2/3] selftests: mptcp: add explicit test case for remove/readd Date: Fri, 28 Jun 2024 17:54:07 +0200 Message-ID: <1d4a6ebd0f843910f35a842673af55fca6962b8e.1719589916.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.12 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" Delete and re-create a signal endpoint and ensure that the PM actually deletes and re-create the subflow. Signed-off-by: Paolo Abeni --- .../testing/selftests/net/mptcp/mptcp_join.sh | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 108aeeb84ef1..228fecee61f9 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3526,6 +3526,34 @@ endpoint_tests() chk_mptcp_info subflows 1 subflows 1 mptcp_lib_kill_wait $tests_pid fi + + # remove and re-add + if reset "delete re-add signal"; then + pm_nl_set_limits $ns1 1 1 + pm_nl_set_limits $ns2 1 1 + pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal + test_linkfail=3D4 speed=3D20 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=3D$! + + wait_mpj $ns2 + pm_nl_check_endpoint "creation" \ + $ns1 10.0.2.1 id 1 flags signal + chk_subflow_nr "before delete" 2 + chk_mptcp_info subflows 1 subflows 1 + + pm_nl_del_endpoint $ns1 1 10.0.2.1 + sleep 0.5 + chk_subflow_nr "after delete" 1 + chk_mptcp_info subflows 0 subflows 0 + + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal + wait_mpj $ns2 + chk_subflow_nr "after re-add" 2 + chk_mptcp_info subflows 1 subflows 1 + mptcp_lib_kill_wait $tests_pid + fi + } =20 # [$1: error message] --=20 2.45.1 From nobody Fri Oct 18 06:18:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 A2DEA1DDCE for ; Fri, 28 Jun 2024 15:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590068; cv=none; b=iHaR89FXmg3rfFY4yQigP7PeTaqKmF0oEMxRUQ33h4EjrXlq8bLCckUiWI5nT+LYolmDgamgwXrtQWqlbrqX6Lacj8gMP1wH8LVYGrI71q4B3F24SeDR51nSKNWIF8Tf4RGX+VO65xogZ+yNBiShV1HugleAR77dU9uGnWOJ9bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719590068; c=relaxed/simple; bh=WXkAd+fQZx5fKGECD/sw7xxf3RNUdxEEEugWtnd7feo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iV2+0gpkQMlD65/BQbdl24bhXRLgdWrDS+ZhBg1dAwPT34fVTWvkAfJqIrkLOFSjIRi3MfQO3ftiiIERACEdfHcUpKVRA4Biq4Py8r8SA/S/TQlLyraYfvXxpYMc1Msdl7X5CI97ElAVd/5pnEQIK7qCb56KpjNzM/E/TNolklA= 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=WPJjryS5; arc=none smtp.client-ip=170.10.129.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="WPJjryS5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719590064; 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=+Yl5RhFH8AWSHhK+gol3+Ogtst/C/7rbxV2pagv348c=; b=WPJjryS5OQr7/byIXXIAtq3QFLK+ibsktiGqCwhBE42RcTVcHmWmAx9pfGgXbwgspem5Lc M3vuVwYg0jM7qxuG6RNwcsUgFzYey9brFDQr6AluCG54hnB9l3xIgIhaHXYeg/noEW0Yi6 SIVAP1ZW55AWm5iZ8nKSsWNqVBQQ4Qo= Received: from mx-prod-mc-05.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-591-Jde8RobpMUSbB1blJe084Q-1; Fri, 28 Jun 2024 11:54:23 -0400 X-MC-Unique: Jde8RobpMUSbB1blJe084Q-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E50E1955F03 for ; Fri, 28 Jun 2024 15:54:21 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.225.34]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 68D4D19560B2 for ; Fri, 28 Jun 2024 15:54:20 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net 3/3] selftests: mptcp: fix error path Date: Fri, 28 Jun 2024 17:54:08 +0200 Message-ID: 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.12 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" pm_nl_check_endpoint() currently calls an not existing helper to mark the test as failed. Fix the wrong call. Fixes: 03668c65d153 ("selftests: mptcp: join: rework detailed report") Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 228fecee61f9..c4593677a567 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -661,7 +661,7 @@ pm_nl_check_endpoint() done =20 if [ -z "${id}" ]; then - test_fail "bad test - missing endpoint id" + fail_test "bad test - missing endpoint id" return fi =20 --=20 2.45.1