Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp771331rdb; Fri, 22 Dec 2023 04:49:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHr48F6pB76vNLEn4Ow5AMEk3WBlESsIT6tgA5pLoku1FDImM/vcTXEAHXOQ74MPsne2D06 X-Received: by 2002:a05:6830:1349:b0:6db:9d0f:9c02 with SMTP id r9-20020a056830134900b006db9d0f9c02mr1202878otq.22.1703249393725; Fri, 22 Dec 2023 04:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703249393; cv=none; d=google.com; s=arc-20160816; b=iaBrK2dgFl00WdtSqTRtqB//LCi5xh4DpYyAvcFQc9ZsNRNys5a7X2hAneMwTyUB7C uvstshclldHvUCLgXeQblsQBeaVhkTTpeB0cIk/SkeQssXzGdS6N1y2vGTsJO9p9yIXG cESP76miWr+QIyJDZalqySG0WD9v1KctMpYc5S3hGgHCJtFV3VzXqfVdg1hzna1ZiOem sL4At4DMFr3S6LH3raXafg0pG9VEZIk/McTOuqVb3jB8IhGYwXiF38Wd+xOq8YUu0Nb3 QzEymBAkc9CnWdIlPhafLLLIjOWPuTpv2DN6TPV77trenMetVBm2BlLUKf5xbqxArxSA nhuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=/sDRdqcmXTgCcsH62UqLAGmN0quxUIF7mCzHICBraPM=; fh=KNmpzBULWDx6/dx+97L89icAJeAGaH3v4uWu8z4j10o=; b=LRTeObJt2ofqHxlFmpFyF0kcgFq0LHHJYk4aSRZMS/kSHcLqLB5w3HZxxpHUB1X7fE jeVBKok4oDKDFC41PCv16M1tTVlQEHtkhsFW+Z2grrVOcn5tgBNyZxhxizZHY3nswSO0 asqiB5haTXJAdh6O201i70gZFNmVYQ/0PSQj+pG+NSS2e1+GYE7eOf5Sxpuov8AD+9JY c4cPzibKblB66N6DA+QJzJzX9LcAZ89m9sDb208HVRPivkvtldzIkkTZxNVNqbIE7Ovx 5O1FitVVdVTLToahn4e3J0Cuoyalu9IZAjhGay/RT/WDcUETW2ulqrzAq8qfDs+eYrcJ rSKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rMG6POUd; spf=pass (google.com: domain of linux-kernel+bounces-9724-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9724-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x16-20020aa793b0000000b006d995f2a340si91044pff.383.2023.12.22.04.49.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:49:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9724-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rMG6POUd; spf=pass (google.com: domain of linux-kernel+bounces-9724-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9724-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5D751B241A6 for ; Fri, 22 Dec 2023 12:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 479F4210F5; Fri, 22 Dec 2023 12:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rMG6POUd" X-Original-To: linux-kernel@vger.kernel.org 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 6F63820B20; Fri, 22 Dec 2023 12:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8587AC433CB; Fri, 22 Dec 2023 12:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703249282; bh=0XsZNMC7rZ4PpQo/nWnNMLjUOxV29/JKV7xPuiqrXVA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rMG6POUdc5DynIACKIj1rikv4g1Dd7j7m8AkrRCMYPi6Ej80rc1fYgsxtxKpxFmUG gNIaJUVmiiMKXjAE7jirCf21hNTOMiMKqxNVvHdmEwg3NroXsrro0ObWW6RoGNSdrE WrU0jMBKyAQqEfhuZ2oEklvSijtSfZcajK+2bGJ6u9ozVgspBEqy2lB9SF0WUPscLk 19Em3qgVsJWfylFt3B9Y+BHK2zrUb77B2PdGfzDZ8wff8l7AEKZpQuWBc2SMZB7OXP TFmHLTXNiyKkP02uFiwKhwKsBN2mlO3UyLVfEzBB2g/y7MJdidj6WN27RRTXaKEXr4 EgtPQxF+Os+4g== From: Matthieu Baerts Date: Fri, 22 Dec 2023 13:47:24 +0100 Subject: [PATCH net-next 3/4] selftests: mptcp: join: check CURRESTAB counters Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231222-upstream-net-next-20231221-mptcp-currestab-v1-3-c1eb73d6b2b2@kernel.org> References: <20231222-upstream-net-next-20231221-mptcp-currestab-v1-0-c1eb73d6b2b2@kernel.org> In-Reply-To: <20231222-upstream-net-next-20231221-mptcp-currestab-v1-0-c1eb73d6b2b2@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Geliang Tang Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3657; i=matttbe@kernel.org; h=from:subject:message-id; bh=3vXnHeyEbokDd1nQmEOTmW/dnLowAGGgCm839d/zVb0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlhYV2f0aSUpzxzuPe70dXdaErfggTdZqjlCdi2 BxLMFm4JC2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZYWFdgAKCRD2t4JPQmmg c5PJEADrtwvBTQX86CRymC35dH1ag4ssAXqKqZUR0atN35a8bizXp23UDETNDo8JfKdFzunrt9j wReObWZpvQoWoRDRQOK50LmN4LnZ3oV5IKI/QpCWqjYIg48aIYeZOGQbt8S1xyI/kcAY/AyxrSL Qvau78vw1IV1Czok6RO6WvjNp5VbH3+0HAsF1p08ogbtFHphIAhnWDuLGHHX2/NH/Zdpb0VmS39 MfInaZ10gWqP7GA+TEOrmcVQ9fjv5kSnOfEisvw7lABDKXqh6g+qfupt/qz4WMzs71IuzI7P6pE dUfjaVXXgSIBeZunITJ//J3YWDK5vNh8i1fgdqnkbM2qbSiHFKrnr7FE+6mdFa4UAnMfJeMT8f0 6YkpMNtvB0iuoObTumgvbf51c4/5MgOlum4gvedLFmYRI7mzh1tM2yZK7Yest9gW0gJv6PKvSG/ koWWdJ5RfzOZof1kw2zMHlDxrA+bUKxWUvs2nScQegmYO9NOtlot57ir3zo/YNRho5kbjBy3ba0 DUzX44brz3/XV7zaZyExb/rTY8rZAfsMdIFp4AxjHjH75SphkZnHHYJi+TLWEwXwrHZglng2x0q ga7gvn7CyNhDEWapuTaUS0x7qWVuuwP+B0W1BL3zJCYXVuiLe2aQIy/49eBvGvgYqLGG+YN9PTy laK/thd8+toiIEA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch adds a new helper chk_cestab_nr() to check the current established connections counter MIB_CURRESTAB. Set the newly added variables cestab_ns1 and cestab_ns2 to indicate how many connections are expected in ns1 or ns2. Invoke check_cestab() to check the counter during the connection in do_transfer() and invoke chk_cestab_nr() to re-check it when the connection closed. These checks are embedded in add_tests(). Signed-off-by: Geliang Tang Acked-by: Paolo Abeni Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 46 ++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 87590a43b50d..3a5b63026191 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -56,6 +56,8 @@ unset FAILING_LINKS unset test_linkfail unset addr_nr_ns1 unset addr_nr_ns2 +unset cestab_ns1 +unset cestab_ns2 unset sflags unset fastclose unset fullmesh @@ -976,6 +978,34 @@ pm_nl_set_endpoint() fi } +chk_cestab_nr() +{ + local ns=$1 + local cestab=$2 + local count + + print_check "cestab $cestab" + count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$cestab" ]; then + fail_test "got $count current establish[s] expected $cestab" + else + print_ok + fi +} + +# $1 namespace 1, $2 namespace 2 +check_cestab() +{ + if [ -n "${cestab_ns1}" ]; then + chk_cestab_nr ${1} ${cestab_ns1} + fi + if [ -n "${cestab_ns2}" ]; then + chk_cestab_nr ${2} ${cestab_ns2} + fi +} + do_transfer() { local listener_ns="$1" @@ -1089,6 +1119,7 @@ do_transfer() local cpid=$! pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr + check_cestab $listener_ns $connector_ns wait $cpid local retc=$? @@ -2477,47 +2508,52 @@ add_tests() if reset "add single subflow"; then pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns2 0 1 - addr_nr_ns2=1 speed=slow \ + addr_nr_ns2=1 speed=slow cestab_ns2=1 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 + chk_cestab_nr $ns2 0 fi # add signal address if reset "add signal address"; then pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns2 1 1 - addr_nr_ns1=1 speed=slow \ + addr_nr_ns1=1 speed=slow cestab_ns1=1 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 chk_add_nr 1 1 + chk_cestab_nr $ns1 0 fi # add multiple subflows if reset "add multiple subflows"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 0 2 - addr_nr_ns2=2 speed=slow \ + addr_nr_ns2=2 speed=slow cestab_ns2=1 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 2 2 2 + chk_cestab_nr $ns2 0 fi # add multiple subflows IPv6 if reset "add multiple subflows IPv6"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 0 2 - addr_nr_ns2=2 speed=slow \ + addr_nr_ns2=2 speed=slow cestab_ns2=1 \ run_tests $ns1 $ns2 dead:beef:1::1 chk_join_nr 2 2 2 + chk_cestab_nr $ns2 0 fi # add multiple addresses IPv6 if reset "add multiple addresses IPv6"; then pm_nl_set_limits $ns1 0 2 pm_nl_set_limits $ns2 2 2 - addr_nr_ns1=2 speed=slow \ + addr_nr_ns1=2 speed=slow cestab_ns1=1 \ run_tests $ns1 $ns2 dead:beef:1::1 chk_join_nr 2 2 2 chk_add_nr 2 2 + chk_cestab_nr $ns1 0 fi } -- 2.43.0