From nobody Mon Feb 9 00:02:46 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:cbb9:0:0:0:0:0 with SMTP id v25csp7382429jap; Tue, 14 Dec 2021 08:59:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8qx/DLL8xv+9NwhZovJEpZZXMYSOldyH0caY6h5jxur6c8FLaNWqxzBx3VzbpgkcAY0fj X-Received: by 2002:ab0:1303:: with SMTP id g3mr6439100uae.57.1639501175358; Tue, 14 Dec 2021 08:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639501175; cv=none; d=google.com; s=arc-20160816; b=T1JSzdIGonpL5A+aXxGbDx4bSMZxH5ED/I8jpnB52d3bF2gYAnDgNnWjupOn5xV+m6 pWSqnu2hPWqRfp1TeqYjBr/aS1xDN1QgiewARnafLrnl0YOXypSWKDBYsmxdatH1G+Z5 V2E83C4f65KfVa1zE+SsloETAE/Oo/7DCkOCx6QhnanKwf6ht1nIonSUGIW0tM8BmN6b Nt4WmoHzbzi+3ea5B7k7+hJ9dnXC8ox7C8popHB8RHQqxZQDR7yjsCGQWvoEKNZHPWLm v9LjikubPq/EHXKv5/mBCzrF53VOwxiis2Kafr3DWYg65/VNALwKHDNS3PwZdfpuvcYI i5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=DgdlSuzeRNv71/YXM6aQwiFApph7/9UQddkTsDjD5K4=; b=nYTwgf4BDJrPP1Y1d567KX1Abp4a5/DtAtrXpI7qUJPPTPN+Cb0YiO4U0pFgsRFx9b v5IB9ahOkdcrWasoFfeOBt54q33a11c3Rgu2pjdf7OafStE0LL1DnYJmNkqwqF+mhLrs l7i812W7dXlwILo4mjWNWJ+LoiwBqPQOXaNefpJInAje9nXqvHpEn/Gif1y8d2rBBElG UnnAhKaGORN36s6li1YCGGMMS3PSkUor2SpjanQdVfXrcMnTdviRj8OW8D8SqABv2d0Z sMVsS/igP4f9HRG5bywBmaesX88CWMVgcEILLuDSuNERzof5fxIKl6x5UQ3DSgBo+JmS FDTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cVWMHbPg; spf=pass (google.com: domain of mptcp+bounces-2753-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2753-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id u2si450528vsn.446.2021.12.14.08.59.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Dec 2021 08:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2753-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cVWMHbPg; spf=pass (google.com: domain of mptcp+bounces-2753-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2753-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sjc.edge.kernel.org (Postfix) with ESMTPS id 176A33E0F0A for ; Tue, 14 Dec 2021 16:59:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A713B2CAA; Tue, 14 Dec 2021 16:59:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev 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 76EDC68 for ; Tue, 14 Dec 2021 16:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639501172; 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=DgdlSuzeRNv71/YXM6aQwiFApph7/9UQddkTsDjD5K4=; b=cVWMHbPgFGpyBslsicGaMK2t31RFz8ljUNktrdWqmrgTCQeL3eNAAWKGKoFX5mRo2KXzEP xCjevm9/CYdAWrcVtFRKM8Tb1stcwXpz2GqEgr2Xw+V0IrvjYzVzy15fWdINXc03nSCgPS QqnyZBgDPsOUMnE46nqa8pT29r11nd8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-al_ne4RENsKIAHxbH7qvNA-1; Tue, 14 Dec 2021 11:59:26 -0500 X-MC-Unique: al_ne4RENsKIAHxbH7qvNA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71943100F945 for ; Tue, 14 Dec 2021 16:59:25 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD5391059112 for ; Tue, 14 Dec 2021 16:59:24 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v6 mptcp-next 5/7] selftests: mptcp: add tests for subflow creation failure Date: Tue, 14 Dec 2021 17:58:55 +0100 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 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Verify that, when multiple endpoints are available, subflows creation proceed even when the first additional subflow creation fails - due to packet drop on the relevant link Signed-off-by: Paolo Abeni --- v5 -> v6: - fix test cnt update v4 -> v5: - new test checking for wrong MPC reuse v3 -> v4: - use $() where applicable - Matt - fix typo in help() - Matt v1 -> v2: - add missing NF kconfig - add more test-cases (drop, later subflow creation) --- tools/testing/selftests/net/mptcp/config | 1 + .../testing/selftests/net/mptcp/mptcp_join.sh | 78 ++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selft= ests/net/mptcp/config index 419e71560fd1..41e94e004bdc 100644 --- a/tools/testing/selftests/net/mptcp/config +++ b/tools/testing/selftests/net/mptcp/config @@ -18,4 +18,5 @@ CONFIG_NFT_TPROXY=3Dm CONFIG_NFT_SOCKET=3Dm CONFIG_IP_ADVANCED_ROUTER=3Dy CONFIG_IP_MULTIPLE_TABLES=3Dy +CONFIG_IP_NF_TARGET_REJECT=3Dm CONFIG_IPV6_MULTIPLE_TABLES=3Dy diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 526b05771d08..56fcc8b412fc 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -975,6 +975,22 @@ chk_link_usage() fi } =20 +wait_for_tw() +{ + local timeout_ms=3D$((timeout_poll * 1000)) + local time=3D0 + local ns=3D$1 + + while [ $time -lt $timeout_ms ]; do + local cnt=3D$(ip netns exec $ns ss -t state time-wait |wc -l) + + [ "$cnt" =3D 1 ] && return 1 + time=3D$((time + 100)) + sleep 0.1 + done + return 1 +} + subflows_tests() { reset @@ -1032,6 +1048,61 @@ subflows_tests() chk_join_nr "single subflow, dev" 1 1 1 } =20 +subflows_error_tests() +{ + # If a single subflow is configured, and matches the MPC src + # address, no additional subflow should be created + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.1.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "no MPC address reuse with single endpoint" 0 0 0 + + # multiple subflows, with subflow creation error + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "multiple subflows, with failing subflow" 1 1 1 + + # multiple subflows, with subflow timeout on MPJ + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j DROP + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "multiple subflows, with subflow timeout" 1 1 1 + + # multiple subflows, check that the endpoint corresponding to + # closed subflow (due to reset) is not reused if additional + # subflows are added later + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow & + + # updates in the child shell do not have any effect here, we + # need to bump the test counter for the above case + TEST_COUNT=3D$((TEST_COUNT)) + + # mpj subflow will be in TW after the reset + wait_for_tw $ns2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + wait + + # additional subflow could be created only if the PM select + # the later endpoint, skipping the already used one + chk_join_nr "multiple subflows, fair usage on close" 1 1 1 +} + signal_address_tests() { # add_address, unused @@ -1843,6 +1914,7 @@ fullmesh_tests() all_tests() { subflows_tests + subflows_error_tests signal_address_tests link_failure_tests add_addr_timeout_tests @@ -1862,6 +1934,7 @@ usage() { echo "mptcp_join usage:" echo " -f subflows_tests" + echo " -e subflows_error_tests" echo " -s signal_address_tests" echo " -l link_failure_tests" echo " -t add_addr_timeout_tests" @@ -1910,11 +1983,14 @@ if [ $do_all_tests -eq 1 ]; then exit $ret fi =20 -while getopts 'fsltra64bpkdmchCS' opt; do +while getopts 'fesltra64bpkdmchCS' opt; do case $opt in f) subflows_tests ;; + e) + subflows_error_tests + ;; s) signal_address_tests ;; --=20 2.33.1