From patchwork Thu May 24 14:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10424903 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 9B9066019D for ; Thu, 24 May 2018 14:28:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1F96295D6 for ; Thu, 24 May 2018 14:28:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963BF295D9; Thu, 24 May 2018 14:28:21 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6F77295D6 for ; Thu, 24 May 2018 14:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033321AbeEXO2R (ORCPT ); Thu, 24 May 2018 10:28:17 -0400 Received: from mail-ve1eur01on0088.outbound.protection.outlook.com ([104.47.1.88]:8629 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031005AbeEXO2O (ORCPT ); Thu, 24 May 2018 10:28:14 -0400 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:X-MS-Exchange-SenderADCheck; bh=ks7C9J/jauxbD6NN5a/F7SvIc1Y5LIvilpqg7Xq4FBk=; b=GuHPzajumcQ5HMZAKQRPiABYNCgR+RkAHQGtcTPELTSIrjQFGVZQmKVWswizICrq9UEAJYJArtlqZchUsEQVqd9EPw1eA6mV9r1N1poVCiVBc7l07L5kSc98415am8wNM2l3eeJo7NOfq/AEUF5FtNxWdvCD9dvM5gqSebId6yE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) 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.797.11; Thu, 24 May 2018 14:28:11 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org, idosch@mellanox.com, jiri@mellanox.com Subject: [PATCH net-next 10/10] selftests: forwarding: Test mirror-to-gre w/ UL 802.1d+VLAN In-Reply-To: References: Message-Id: <2baa18123d3f1594d552d808d68f155f0701a78e.1527171860.git.petrm@mellanox.com> Date: Thu, 24 May 2018 16:28:06 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LO2P265CA0240.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::36) 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)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:liI9+4rJzCMg/ucs0y22R42PigOg4fNlKJsv8O75Ib4fgy6IAjS5ywwFruGljqckEHKNqZYsQI1+IZAs2uK9sCLWDi9XMAjTqwyJeucPWxgwxuT4x3UyVN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WR+gtcNWdAMzj7/Jugj/1859O1rzO8f8SkjAOs3HpYIbKPKsIJ0KCfkmWhXdhUmG7WdV9sq7HV3bnK5Q3Jq2+DiWOHyCo2nEQOFTYWtPyhI9cRPRVGd4GC+pbEmiSblyjiTwnQR1j+t4pRFRqes/DcrI0aG4H7mak2DscSGDPoJB6RGmQ0A3+5i/JoR8XIYXmRKg4aWJQwHLbossnMRQozCBVuXP3Qc/7tUaZf/5Us/9zkSJd8GUB; 4:qxefAwUAW+jwVcnm+D42tvqNQ3bQ1VJub9J8nGXmqDtNCgHuhMGMk8OWMywpcMErRtoJl2uBcrFNxiC/WrRRP1PHS9KwFfMPWgfjjNGTFeWgSbsL0nh2VOxwUB5Gdg4WA/o+gOrBVMo+fjIs+hPjvqSSbAqp43I818Qvs88YuXQajZ+GVGmrnrMGaVefkPN61S9PHpBA+Kl2XECAwMQNRikMIBWzsEZa2tpCnenN5zEAfjohZWJV3RFN4YYWghTFwQPC6rDgFZkubLQvjBSndQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0682FC00E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(39860400002)(346002)(366004)(396003)(199004)(189003)(478600001)(86362001)(2616005)(476003)(36756003)(956004)(11346002)(8676002)(118296001)(6486002)(81156014)(81166006)(8936002)(58126008)(16526019)(4326008)(107886003)(486006)(446003)(5890100001)(53936002)(386003)(6666003)(52116002)(51416003)(26005)(105586002)(16586007)(316002)(106356001)(97736004)(305945005)(25786009)(2906002)(7736002)(6116002)(3846002)(5660300001)(48376002)(68736007)(47776003)(50466002)(66066001)(6496006)(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:L2jWHbAPyWVgJB4DD6uj8D3UphIYCpPBIq27m+2DY?= =?us-ascii?Q?kw1aMLgZniupElvkEHz/+BW6/BvSbjLv1Xop12TdSeG08iLP4PyrNu2rHRfW?= =?us-ascii?Q?APqdi+vI9BAglSScjbReiAVXghD/KhDcXL39Qiv5qQWo3ra5fqD9G+X1jwge?= =?us-ascii?Q?7GWgVjYmpnFY4rQEi/cRTJcew1a9DSai5fJKs2+Hdnu1jcgd11FEVxXfgpfS?= =?us-ascii?Q?0lTm/evIIHHm4YEW5/PnxROllIV91V7UR6Q4GkJtQD4JQF6ZIwpmgMoqsCA4?= =?us-ascii?Q?8kZ4L9J+J9vuvGtR0D5aokMScOk1NBTsoQDH8ASmEF3Iq81ykP6ZLENchJvK?= =?us-ascii?Q?ivCyibR/m2j8Es9PJfAkB+E6Zvu3zHl4K3R1DMvUVtlTeDVa6QJK97ajarvd?= =?us-ascii?Q?WGLrkaOf4oAq+RIVRjsfLPTAtBEKNw95WdLBP20MkXe3bt46bG0HuPb3g9/d?= =?us-ascii?Q?9XRpoxdpsNR+u+jFJtxclLP9bop/ugQkzSejROgY9CXplvd+aow3IegGApOa?= =?us-ascii?Q?RqvDWupr+MHaWiB2EH+i2ItqYP+WcuH6Z6ckxnKaAQGXje13nYWdxDVBu4Bg?= =?us-ascii?Q?lhf5edUU1r9LPM07d829KlMpW766yp7KczYKGqVS/H6G9RLz6KO3YWOfnQk7?= =?us-ascii?Q?ZL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WTEuBzdtHg/FBoSnI66jX9wSS9P1tzZmozwZYoFGxCrdvsk4NrCI6/BxPjBg9l2q+daaTickwAen3OiAcLEInnkZ982NIUbNgpiaBC/aNMcDghW/Dob7eMeQI8N10yPON7v83Rmny6C8N7ziUMFVElFRp1neMeJEK9sZBq5noJOo5xllKhW8oknG4DK+laj+X0MmBrtbLDUWVonjaRlBi38ol0kaGiw5Qtidrex12PNGtgMUPs8DKobDCe6otVR0nNHSWkwVd/Y91O27tLSzMbXPlV8nSFX+vn6nMSkEKRoZYScGyBGhSCeA5Nqz3q8s0jNwYDWUirodSZXIMg==; 5:RirDXfVmKSzPF/S/kUdxmchTpvYYDt/JZsa5Tpkw6Bq1Wr8ruugfiuTfuwQhXKKg91QTM01zBCgjPwSZs8Ua9Zov5aLeEe3N5GNnQy5dGa3fBnNYUf3diw2AUnMWzktZ6wE2R0/Yal9X8CLGQct2vVYX+FmK/Fd+4/xH8eQKsPM=; 24:yzegzBHk2/L7C37rj+lTjmMuBmZMjhNck8MSDLbR2lQMh7X5NLznM/S5Q6XXF5tABkDwsZqnNXrQcM/P21V5sC7+eSunOYQcr6ivT/oCRrA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:eKavS9z2gSRaKZz5SWRAY1N1jrfWdKIO63SEfB15Lqg32JD7UWriqt5oDA/TQiXL/1mZGfA7SfJsd0TWFfriKn83hwOA/4IAe3TGdWKrHvO60toiCNJI+dF6loK7Rrx7qEnedeQ6Nb/mXC/T4PgLnwKOFP83pIdHX6avw8oEzW57sXmehjscHShltY6kNm67pz+HaknPZHsNg4UNKunpo2108RcHuAyOolXQ1oEkXblbq/6BrFR8YwRFfC32F8/b X-MS-Office365-Filtering-Correlation-Id: 627a211a-47b6-4b3d-012a-08d5c1829401 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2018 14:28:11.0483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 627a211a-47b6-4b3d-012a-08d5c1829401 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test for "tc action mirred egress mirror" that mirrors to GRE when the underlay route points at an 802.1d bridge and packet egresses through a VLAN device. Besides testing basic connectivity, this also tests that the traffic is properly tagged. Signed-off-by: Petr Machata --- .../net/forwarding/mirror_gre_bridge_1d_vlan.sh | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh new file mode 100755 index 0000000..3d47afc --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh @@ -0,0 +1,109 @@ +#!/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. +# +# Test for "tc action mirred egress mirror" when the underlay route points at a +# bridge device without vlan filtering (802.1d). The device attached to that +# bridge is a VLAN. + +ALL_TESTS=" + test_gretap + test_ip6gretap +" + +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 link add name br2 type bridge vlan_filtering 0 + ip link set dev br2 up + + vlan_create $swp3 555 + + ip link set dev $swp3.555 master br2 + ip route add 192.0.2.130/32 dev br2 + ip -6 route add 2001:db8:2::2/128 dev br2 + + ip address add dev br2 192.0.2.129/32 + ip address add dev br2 2001:db8:2::1/128 + + vlan_create $h3 555 v$h3 192.0.2.130/28 2001:db8:2::2/64 +} + +cleanup() +{ + pre_cleanup + + vlan_destroy $h3 555 + ip link del dev br2 + vlan_destroy $swp3 555 + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_vlan_match() +{ + local tundev=$1; shift + local vlan_match=$1; shift + local what=$1; shift + + full_test_span_gre_dir_vlan $tundev ingress "$vlan_match" 8 0 "$what" + full_test_span_gre_dir_vlan $tundev egress "$vlan_match" 0 8 "$what" +} + +test_gretap() +{ + test_vlan_match gt4 'vlan_id 555 vlan_ethtype ip' "mirror to gretap" +} + +test_ip6gretap() +{ + test_vlan_match gt6 'vlan_id 555 vlan_ethtype ipv6' "mirror to ip6gretap" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run + + 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