From patchwork Thu Apr 26 23:20:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10367011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 798FA6032C for ; Thu, 26 Apr 2018 23:21:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C752929C for ; Thu, 26 Apr 2018 23:21:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 683D72929F; Thu, 26 Apr 2018 23:21:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73E292929C for ; Thu, 26 Apr 2018 23:21:34 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40XCkN64bCzF25l for ; Fri, 27 Apr 2018 09:21:32 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="a9ZO1UWZ"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.3.73; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="a9ZO1UWZ"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30073.outbound.protection.outlook.com [40.107.3.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40XCkJ6ghnzF25Z for ; Fri, 27 Apr 2018 09:21:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=u5RKhdDlGzJBV94rlcACCLKQXc9S5PF7Y7Ay9SQbYeQ=; b=a9ZO1UWZvDD/LfTIRZCywbieSqvPU0fVhh/TE03zi5wXG5Bw6tYEJWtLldvXep1yE3Uev0nJWOUlCg7AHzZ9451Z65MIyoAdvNuI4nJS2GSA6G5TEdcJ6/8pQ1Y1dDIRuOIbK5k4s74Ph1YKdGtjFG6lbAIcRqjVMGartdjJqjg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.176.83.59) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Thu, 26 Apr 2018 23:21:22 +0000 From: Petr Machata To: netdev@vger.kernel.org Subject: [PATCH net-next 5/7] selftests: forwarding: Test flower mirror to gretap In-Reply-To: References: Message-Id: Date: Fri, 27 Apr 2018 01:20:56 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.176.83.59] X-ClientProxiedBy: CWLP265CA0205.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::25) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:Cy8j9+/+17U4RstrCHYxrPNaPwFbzorgQRx06ZHFMmVmFpT2e7+5thbmJUywPwxcZ6w1EvPYscFpAGrQCFSPlhu2sxIY4DCJMBNAco6KnzC7YieCIpbjFPAxTU+cEsvyranoFuKCY7OxFaQogGhx/+cZJGQstkDqHw7HihDm01uZVf99PG8gZBcquj3gohOOLk+dJHNF5eQzpXmHWRMQTz7EXOhu414kwYVuUfuVY2djzoBeFFL9X/BXfPBvW3pA; 25:rstwJ5/kSTnFu7YiHfmU0f0VNj3vFu1f0eXa1Cp3cDJ/9O5dVUImnfq9j0fpM0HMnkLX2ZxkJgkM3lZUCtibVvHJ8gh/PRYs1anoqWCYGuxqownfVUgSt1s+TnQk1SGMSi6x3Gr1y4Aj0pXV6dypP47n/itaRdc4xPuAHvnz3O76DXCAJ8QWQZr1mgrEFyjowUZraNs8d9ofZ86vhGjFG36VJAs9X3fsGMZRVHKlTdYwAKc7QnHalVYu4oiUlCZxiLNTG67z0s0jy30x1NNuiYHqClRAOhcCM7m3ZwFejOP2vTiYn2D102K9Gf7fkVQkWxrMzXEYFwh1h2AnOpbzRA==; 31:J9KmTpUTsB81KpibNWVfc88GBKTAGMPz/e96bNhgE8bk2HQg7bgmtluWWpCpjXt+/PyFiBmJ+eMyX3c/d/zjV6ne+mhiiuG20NYfMdNn0+QggPq3+DaqW+YEflZOy3Io1oN/KQN4fpfJcmM6KdLHypUzzFX6Jrcil65gryfKQBfvhAspUEid8zfplUJe7DQG1lKpI30ay7j1Jnt4MBSy0Dlh1ISCdGqm2n2myB0oHVM= X-MS-TrafficTypeDiagnostic: VI1PR05MB4191: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 20:L9ldyuvG4Qf8NlKJKZxyDYF5hCuAexzIFvsTrovic85eWWb3DWcl0nuo/bTjZ3thxulQXqfMkEe+dKqIj7beY9RD3YVR4w9iRvbWVh339pi2hEShUADW/mca8gtNPoFFcAB1U792xF63K9ohbh8lhFgP0oXPp2tVe+jK5rVYrQtC9dK/Sv0aiXP4o5/3FX/PzGR1sq/WFbusTJStj1ZWaPMHiSluLuVZU3U+zYJbgHtyKpLi3ijZ9/Jz0+kvd96ZGjJEUMu1Ir2QdASnYyfQ32Cf3Lti5k9eH+009iUH47COOtXyF/oyIYZfdbKOSyyTuDTw1Jhi9wj7seVLcKUW6vePdW6rfzVOwAuP+8PQ/EBjHLRQXIHnFOt6W5jzAoKxASLMHrgEElWxtOOb+GVjiLFuZaZMtLU5Q9gA9iyvg+SPj6PxwEX+KEGyPTBoBWZ6ch9JIRd9zMuW1z2BQ9xmPrNJnfTyCJUWykOdtMBm72GIQkQzWC+FxSLIWFJH9O77; 4:hDmfWuiMcUti/I7Nz/138C7mt3nmDdLPZOHPzsQiyZ7V6ktArJyyz+slv73nOFAGITPmZUHS+O12Ll/+JZTjpwm5miRxrBTdphjmCU/pHza2YmYIsONzn1yX87Kx3kCu7G3v/9BnmHcQn9NEJUMGOp6YuBoGXmeQG68vtA7KWbT4zBNBmWyMA5pjHl2A92z7LAr+LLvgXdcGpbE9wD96qDIIuU2NV7h0otbJJECYdxQyCx+vTe65mdQoSiKOqCTtE7+x4jrCSb20EH2NkYiAwA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231232)(944501410)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(39380400002)(199004)(189003)(2616005)(6486002)(106356001)(5660300001)(53936002)(66066001)(476003)(26005)(6916009)(305945005)(97736004)(48376002)(486006)(86362001)(50466002)(6666003)(186003)(105586002)(7736002)(3846002)(956004)(16526019)(2361001)(11346002)(2351001)(446003)(6496006)(478600001)(386003)(2906002)(25786009)(4326008)(6116002)(8936002)(68736007)(52116002)(51416003)(36756003)(81156014)(118296001)(8676002)(58126008)(81166006)(16586007)(316002)(47776003)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4191; 23:Q/P+I5xg7VET017HfeBwUnCvc0vpxqzRGQfu27MVv?= =?us-ascii?Q?Zm+JPdF+n+DyLdd6jfY2FiaZ7xQTedGOrdi2H9V5ablIQsNX7hGQ0unYqmJP?= =?us-ascii?Q?sv6qJ99qQGcP8in3YMruRLRYzWo6KDQN5LJIPC/Y3Bv+y4ZkfkT+eacOliD6?= =?us-ascii?Q?w1FABczVtgE0KE+D2Yd66LqB7Vn2bEPDK+wP79aCdxDehRXjIlWPTmY9cChk?= =?us-ascii?Q?iPVE7mKcRS+Og4XixRQglQpGn1DFFZGTgZvSgHGAIgWdIOQnQtyTEh9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3kX7TkKtIZv+wOika43nqwkaJLM?= =?us-ascii?Q?gT4GowNWrYVwZtXbmZ6mCFsCcCbobsrUL30EbfKTPXnS2w3pS6veKApfQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: ApJhyvnJlA4u6Pjx8sLkZiqmABxRGTeGXjvixoIc0UdIeVq8LgLlMFZvCnbC81pc0RP1pjb+OoZCgsLy9dgF3A6bkI0BwVp6jYPPIp7DYUY8XX7jd5gwkzMR/05z8TEuIfo0nIcFcm/421fCYpHqCuJBhiQgwxqbsIijp1ou7YjmBctsud4gvdkt20QOIMMv X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 6:jfstkK2TvjXJ5K4odZEyRYW7N1iOLaqy4d9C74g7qeyS/OX3UpQTW/zaytAA+cokcJ6ZlIXISredzcS8ObqxBfchuuspyCdN4Heo/bnXz+OuFw2rnU36vn5V6c6c10z3k7jew07aRNi3WS80DY2lRCoHdAkIc1ROnQjMH9UuDVXeFxKcsqwRJPavZhTg/5SMRViwLztRNqbvHoZEqmB+LXs1n/HWgjxlzOE3DidatWSJ4Z+bJY+QRrV0WmQJ/tXBUtbWhha8RNMmlYmVEOlEepDedirOkGMM8sR6hOTTmPKoXABb9QWQgG3wts+hP37rQFy8lf90kaT2dzooGmdNP8MSVbAmyVosQSEqGpG9mnCZxPeipH8BLJp6AACZ/NtcnKGElFau+i5hUhJZNMUTuvlzrhDm8A+IoR+tMH8J9UerY3vnPhWbL6jwlPndXioxPrAONeJmdSeJhIP4tIHuJg==; 5:G0dikdY50i0kQW+0a/UO2oA5pinT/KImX+W2s8O1S22qGy+sfazYItQym+vWMViSxGsjP6JmbvwVWS31cakYweKg4ynAcGE4/RnxrJLVaTo0bjuVKtbToMK+lNvwh5cf6vQVy9PEv29y+GmTI6RpKQ3N37Alk0s4R2uAx/NprHk=; 24:uvu3NuVxM5aR3iX8I8On4tV04lrlz2wvbYKFhIauvXdrggN8bkHDiUsq63beF34nDBpOlaoHEOSIHrCcHmEhynJbxUrGkjNaRbm+Bq8C9Kk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:wxMrebl9bVTpcVJYiJkYROQjp1Pq1oDKGZpF1P9FvgcCxoLsl/zKKUK28JenPsIb5BcNXyRJBOeZA+I583XBvGeyLy72I3HBRmB6rqtIslx6K5SVRratMDWUQ/5iMQYXfzklMfu+mMS4eUYAAWW2bV33GqSiXP4c9cqm1eGurFazAuIe/7Hjcu0ehdSDc8LPOhQEMIRbFNVf6DTILObLvve4X/A/3Ys5z0AslpuSudf7FnJytffLByta1l10IikL X-MS-Office365-Filtering-Correlation-Id: 37e881ab-9ab0-44cb-2807-08d5abcc6ce3 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 23:21:22.7391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37e881ab-9ab0-44cb-2807-08d5abcc6ce3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mlxsw@lists.ozlabs.org, davem@davemloft.net Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org Sender: "Linux-mlxsw" X-Virus-Scanned: ClamAV using ClamSMTP Add a test for mirroring to a gretap and an ip6gretap netdevices such that the mirroring action is triggered by a flower match. Signed-off-by: Petr Machata Reviewed-by: Jiri Pirko --- .../selftests/net/forwarding/mirror_gre_flower.sh | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_flower.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh new file mode 100755 index 0000000..178a42d --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# This test uses standard topology for testing gretap. See +# mirror_gre_topo_lib.sh for more details. +# +# This tests flower-triggered mirroring to gretap and ip6gretap netdevices. The +# interfaces on H1 and H2 have two addresses each. Flower match on one of the +# addresses is configured with mirror action. It is expected that when pinging +# this address, mirroring takes place, whereas when pinging the other one, +# there's no mirroring. + +NUM_NETIFS=6 +source lib.sh +source mirror_lib.sh +source mirror_gre_lib.sh +source mirror_gre_topo_lib.sh + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp2=${NETIFS[p3]} + h2=${NETIFS[p4]} + + swp3=${NETIFS[p5]} + h3=${NETIFS[p6]} + + vrf_prepare + mirror_gre_topo_create + + ip address add dev $swp3 192.0.2.129/28 + ip address add dev $h3 192.0.2.130/28 + + ip address add dev $swp3 2001:db8:2::1/64 + ip address add dev $h3 2001:db8:2::2/64 + + ip address add dev $h1 192.0.2.3/28 + ip address add dev $h2 192.0.2.4/28 +} + +cleanup() +{ + pre_cleanup + + ip address del dev $h2 192.0.2.4/28 + ip address del dev $h1 192.0.2.3/28 + + ip address del dev $h3 2001:db8:2::2/64 + ip address del dev $swp3 2001:db8:2::1/64 + + ip address del dev $h3 192.0.2.130/28 + ip address del dev $swp3 192.0.2.129/28 + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_span_gre_dir_acl() +{ + test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4 +} + +full_test_span_gre_dir_acl() +{ + local tundev=$1; shift + local direction=$1; shift + local forward_type=$1; shift + local backward_type=$1; shift + local match_dip=$1; shift + local what=$1; shift + + mirror_install $swp1 $direction $tundev \ + "protocol ip flower $tcflags dst_ip $match_dip" + fail_test_span_gre_dir $tundev $direction + test_span_gre_dir_acl "$tundev" "$direction" \ + "$forward_type" "$backward_type" + mirror_uninstall $swp1 $direction + + log_test "$direction $what ($tcflags)" +} + +test_all() +{ + RET=0 + + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + full_test_span_gre_dir_acl gt4 ingress 8 0 192.0.2.4 "ACL mirror to gretap" + full_test_span_gre_dir_acl gt6 ingress 8 0 192.0.2.4 "ACL mirror to ip6gretap" + + full_test_span_gre_dir_acl gt4 egress 0 8 192.0.2.3 "ACL mirror to gretap" + full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap" + + slow_path_trap_uninstall $swp1 egress + slow_path_trap_uninstall $swp1 ingress +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tcflags="skip_hw" +test_all + +if ! tc_offload_check; then + echo "WARN: Could not test offloaded functionality" +else + tcflags="skip_sw" + test_all +fi + +exit $EXIT_STATUS