From nobody Thu Sep 18 08:18:37 2025 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6a06:869:b0:4b8:7781:bd2f with SMTP id d41csp696936pis; Tue, 26 Apr 2022 14:57:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTv62d5IEsDY6hLqSFuiaSRKvpgX2vI2RGT4LRC413jOhBhCpybFA5ulRNHJ7Kr/RYnExA X-Received: by 2002:a05:6402:3513:b0:424:1b50:68b7 with SMTP id b19-20020a056402351300b004241b5068b7mr26954984edd.144.1651010250071; Tue, 26 Apr 2022 14:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651010250; cv=none; d=google.com; s=arc-20160816; b=c6N8kklDfGuei1Py6zZbzIF/NPKy7XrnJCFCqAFbflHF09ggLjZd4wb4KOq+5fVSLh iaQxCjzZKNNJIYS0u0/SoVM/N+33hDKBLX4pQDleYSP5me01AZV9WP7SqUuuDUMD3fvN aBZZVDpQd+CtDkcz7PikN2IFYaw3tE7y5r9uHjaVhZXO8lIoXqIA0fiRvp9z3SLKIsLE kW6ZgoU+hUFAQiPMihXVJx0TpGExUVkI1z0LI2DwEEEz84pyQevLPqHaZd20dpCpSgGY llhi5l0ZlOzxjMOxj259XOqENbra2wqKd7k+nkc5jkVHzbFP0TabwvGp608ufy+btF8k y/VA== 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:cc:to:from:dkim-signature; bh=wjtLryt3u4/GtcV0iOpgIfGUdrjsavXrsT5nMnvQPMk=; b=wntHFG7m2btCgOWdFfdWEGIqtpPFeyVh2KCNuAzyvwSMVb+PQRIkGoOopzxsBD+pwI hJQ0DPzVZ5FFGS7T0X7sGMHcI7IxzdEsBpkH91Y2lB0ybGVHEioee+MYMcoDvz/A016e h9cTSqBNANNZ18xJCdFj4stLXCK/qXyxHg4lTygSshyKqgRp/BYbWZoYDL05OzxDjgQn bl66ao6OjH9Dr65nBJD/8Gw53hSMPj0kVYKKo4p+4AYJzQBqfFX8MyGrmCdlC/7VCFLE nHotKHSXAm8BolOQPzhXJngKaurs2y8oA0SdNXNBhbwAuGkrPMj4vRogdaEYq4cZxm3J 5jQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l9HGNJ2c; spf=pass (google.com: domain of mptcp+bounces-4900-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4900-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from da.mirrors.kernel.org (da.mirrors.kernel.org. [2604:1380:4040:4f00::1]) by mx.google.com with ESMTPS id g13-20020a170906538d00b006f3a418346csi4546981ejo.113.2022.04.26.14.57.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2022 14:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-4900-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) client-ip=2604:1380:4040:4f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l9HGNJ2c; spf=pass (google.com: domain of mptcp+bounces-4900-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4900-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 da.mirrors.kernel.org (Postfix) with ESMTPS id D3F452E09F2 for ; Tue, 26 Apr 2022 21:57:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFFA833DE; Tue, 26 Apr 2022 21:57:26 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (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 8E07933DC for ; Tue, 26 Apr 2022 21:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651010245; x=1682546245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VHI55fwMmAPMISO8cR9zrQDat9I7YpRVjSu9rkw1vK8=; b=l9HGNJ2cRkvQGk34jAh3apQ0RKTrYmqzNMCk6I2KxIFi8f3c7E6E2US1 LSYLZm+xkMSIJQUEBdsbli9phV8U5uQrhn4gZ810pgBYYeijLp44faYIc Sk0Q1QhflMRwBOE22GztZqEQZBYCUHfV7I3MPwlXp9vKqQlAUBKuy34di TB9vTQrWEfundzXJC0vJZZ8aygzjpNKoRluHr0F88ei+XBt+jq2yMt9RI GqeCc/RJg0fPXQE6AbKu41gz4/HecKvjqCDZu3u+OLqEO9BcB2reZ64u9 KivLJOjAXAgp4IbCFpEeccf+w6TCbwPcby3Y7Dds4Tx1fRGNwYhMXw9W4 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="326222710" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="326222710" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 14:57:23 -0700 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="532878094" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.209.10.176]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 14:57:23 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Davide Caratti , Mat Martineau Subject: [PATCH net-next 1/7] selftests: mptcp: add infinite map testcase Date: Tue, 26 Apr 2022 14:57:11 -0700 Message-Id: <20220426215717.129506-2-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426215717.129506-1-mathew.j.martineau@linux.intel.com> References: <20220426215717.129506-1-mathew.j.martineau@linux.intel.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Add the single subflow test case for MP_FAIL, to test the infinite mapping case. Use the test_linkfail value to make 128KB test files. Add a new function reset_with_fail(), in it use 'iptables' and 'tc action pedit' rules to produce the bit flips to trigger the checksum failures. Set validate_checksum to enable checksums for the MP_FAIL tests without passing the '-C' argument. Set check_invert flag to enable the invert bytes check for the output data in check_transfer(). Instead of the file mismatch error, this test prints out the inverted bytes. Add a new function pedit_action_pkts() to get the numbers of the packets edited by the tc pedit actions. Print this numbers to the output. Also add the needed kernel configures in the selftests config file. Suggested-by: Davide Caratti Co-developed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- tools/testing/selftests/net/mptcp/config | 8 +++ .../testing/selftests/net/mptcp/mptcp_join.sh | 70 ++++++++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selft= ests/net/mptcp/config index d36b7da5082a..38021a0dd527 100644 --- a/tools/testing/selftests/net/mptcp/config +++ b/tools/testing/selftests/net/mptcp/config @@ -12,6 +12,9 @@ CONFIG_NF_TABLES=3Dm CONFIG_NFT_COMPAT=3Dm CONFIG_NETFILTER_XTABLES=3Dm CONFIG_NETFILTER_XT_MATCH_BPF=3Dm +CONFIG_NETFILTER_XT_MATCH_LENGTH=3Dm +CONFIG_NETFILTER_XT_MATCH_STATISTIC=3Dm +CONFIG_NETFILTER_XT_TARGET_MARK=3Dm CONFIG_NF_TABLES_INET=3Dy CONFIG_NFT_TPROXY=3Dm CONFIG_NFT_SOCKET=3Dm @@ -19,3 +22,8 @@ CONFIG_IP_ADVANCED_ROUTER=3Dy CONFIG_IP_MULTIPLE_TABLES=3Dy CONFIG_IP_NF_TARGET_REJECT=3Dm CONFIG_IPV6_MULTIPLE_TABLES=3Dy +CONFIG_NET_ACT_CSUM=3Dm +CONFIG_NET_ACT_PEDIT=3Dm +CONFIG_NET_CLS_ACT=3Dy +CONFIG_NET_CLS_FW=3Dm +CONFIG_NET_SCH_INGRESS=3Dm diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 9eb4d889a24a..34152a50a3e2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -266,6 +266,58 @@ reset_with_allow_join_id0() ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=3D$ns= 2_enable } =20 +# Modify TCP payload without corrupting the TCP packet +# +# This rule inverts a 8-bit word at byte offset 148 for the 2nd TCP ACK pa= ckets +# carrying enough data. +# Once it is done, the TCP Checksum field is updated so the packet is still +# considered as valid at the TCP level. +# Because the MPTCP checksum, covering the TCP options and data, has not b= een +# updated, the modification will be detected and an MP_FAIL will be emitte= d: +# what we want to validate here without corrupting "random" MPTCP options. +# +# To avoid having tc producing this pr_info() message for each TCP ACK pac= kets +# not carrying enough data: +# +# tc action pedit offset 162 out of bounds +# +# Netfilter is used to mark packets with enough data. +reset_with_fail() +{ + reset "${1}" || return 1 + + ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=3D1 + ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=3D1 + + check_invert=3D1 + validate_checksum=3D1 + local i=3D"$2" + local ip=3D"${3:-4}" + local tables + + tables=3D"iptables" + if [ $ip -eq 6 ]; then + tables=3D"ip6tables" + fi + + ip netns exec $ns2 $tables \ + -t mangle \ + -A OUTPUT \ + -o ns2eth$i \ + -p tcp \ + -m length --length 150:9999 \ + -m statistic --mode nth --packet 1 --every 99999 \ + -j MARK --set-mark 42 || exit 1 + + tc -n $ns2 qdisc add dev ns2eth$i clsact || exit 1 + tc -n $ns2 filter add dev ns2eth$i egress \ + protocol ip prio 1000 \ + handle 42 fw \ + action pedit munge offset 148 u8 invert \ + pipe csum tcp \ + index 100 || exit 1 +} + fail_test() { ret=3D1 @@ -1199,7 +1251,7 @@ chk_join_nr() echo "[ ok ]" fi [ "${dump_stats}" =3D 1 ] && dump_stats - if [ $checksum -eq 1 ]; then + if [ $validate_checksum -eq 1 ]; then chk_csum_nr $csum_ns1 $csum_ns2 chk_fail_nr $fail_nr $fail_nr chk_rst_nr $rst_nr $rst_nr @@ -2590,6 +2642,21 @@ fastclose_tests() fi } =20 +pedit_action_pkts() +{ + tc -n $ns2 -j -s action show action pedit index 100 | \ + sed 's/.*"packets":\([0-9]\+\),.*/\1/' +} + +fail_tests() +{ + # single subflow + if reset_with_fail "Infinite map" 1; then + run_tests $ns1 $ns2 10.0.1.1 128 + chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)" + fi +} + implicit_tests() { # userspace pm type prevents add_addr @@ -2658,6 +2725,7 @@ all_tests_sorted=3D( d@deny_join_id0_tests m@fullmesh_tests z@fastclose_tests + F@fail_tests I@implicit_tests ) =20 --=20 2.36.0