From patchwork Mon Jul 2 17:58: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: 10502197 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 6616460284 for ; Mon, 2 Jul 2018 17:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5826128D30 for ; Mon, 2 Jul 2018 17:59:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C35628F1E; Mon, 2 Jul 2018 17:59:09 +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 AF68A28D30 for ; Mon, 2 Jul 2018 17:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753226AbeGBR7I (ORCPT ); Mon, 2 Jul 2018 13:59:08 -0400 Received: from mail-eopbgr60054.outbound.protection.outlook.com ([40.107.6.54]:14784 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752808AbeGBR7H (ORCPT ); Mon, 2 Jul 2018 13:59:07 -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=DhdTukIKcXWHOIcB7Ncl0GMj9DXtJqoN8VtmO0jw7to=; b=pxqKe6Jw/Sw4PwYr+IshB6s0qOf7Lha6dbN5LfRfngLIxaZYKX2UWU8UZDb/h8TATuVXa/V6GtaZceXzrZNGDA7OuIcOcsfSsrz+2meIu7Yp9kLYQJx9J7jJmZOIkdtXU8qpocX30jLjI33+oNwLSWlzOtn95PaI65oDfrIOy9c= 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_GCM_SHA384) id 15.20.906.25; Mon, 2 Jul 2018 17:59:02 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org Subject: [PATCH net-next 2/2] selftests: forwarding: Test mirror-to-gretap w/ UL 802.1q In-Reply-To: References: Message-Id: <39daad3687d4e5bfc34044eadaaff90edabace86.1530553971.git.petrm@mellanox.com> Date: Mon, 02 Jul 2018 19:58:56 +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: HE1PR09CA0045.eurprd09.prod.outlook.com (2603:10a6:7:3c::13) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53335ae2-44ed-4dec-4ee4-08d5e0457f45 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:ppE+FGGh8nvhMkPyeCj7Xj2/xzhNB3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Vu+BPoyEBeDsGWwnoKshXH8CiS+JkD2GkT+0LrH+6CA8m0e7TClPFAasS72t6I9u4hKjEvdVMQDolYgAYwBS52oeW0IC4WEiOP2rYys1wzOdEmTnFEzCY9gt+MMmeQjobaDXpHP3nyZcemQ5zycAzz6EgWnkaQXJZi8k5HfnY/TuS94+0dlrwOC94NQaSCLJqCpZ29QdvDlQoMn39xuepX+4eWyU5J+Rg+AEBexMkHgyJmFUlI5SOVC6ilYIrNZ3I/uOEB83V2X2RmuEeteK8zPKA7E9rvcAeawENAKBKYVkggcvVPLPOsYvQfKLU; 4:hZrBr74+XDwOhyD3ZmhyKvQQ9wdi7vpwmt/QeqPLq5VkloZSUI2RaRGvScuMQXGdwkiruZkacQ+YmHcOPFbbQRCxYaVIkBsDyoPTeIUhVgf7pqjA4eB0vYgVS9mQX4WOY1v7ovQDLV73C2xJmyDVDORMDnoT/T4HV0zR533NKISZXTIi4+/2ULQglwhbqD/JL2qHks+qnqytveTV/NFNwPhWxetyzkoUrM5JTIJpmDGXOE2SNd+9Yqfix0qq0CKnxXKtPdHwjuSizbJQYVI7Kw== 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)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(366004)(136003)(396003)(189003)(199004)(478600001)(68736007)(486006)(2616005)(956004)(6496006)(2906002)(66066001)(86362001)(476003)(6116002)(3846002)(47776003)(76176011)(48376002)(53936002)(4326008)(52116002)(446003)(5660300001)(11346002)(51416003)(6486002)(36756003)(118296001)(386003)(50466002)(16526019)(186003)(26005)(106356001)(105586002)(97736004)(81156014)(6666003)(316002)(25786009)(8936002)(81166006)(7736002)(16586007)(305945005)(58126008)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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:pgEkYujAX0K6wb9oX+4DU6tpvRFU4xRX2vSYM6p5j?= =?us-ascii?Q?5OeHwbehwsu6F9HCE5TJjiu9hMmNAuZa4YqE0zzDJdoPAfp20zS5Psw1Xy0d?= =?us-ascii?Q?+fTZghehn2ljwmyrS9YgfcF2JRcL8pYm/zNNmHhgMoeQY20HGKRAym7plrrX?= =?us-ascii?Q?tbw/TKG+sEyKV6gzX+XjBZEDS5LOOMfBwdxuvZqM8w7+ZlMywVvb4B1W+P7O?= =?us-ascii?Q?x/p8XSdbgUogdJrjgpizvejSSztd1SjEupGjt5eqpnPo+Zgpv2WVYcxD6qUf?= =?us-ascii?Q?NtBfuK+nwy3PfwVz/InLZdwTnvAMJnde4/aaVQDKc3fxs2bBJyDI50ecDDJ2?= =?us-ascii?Q?khUuIK2FVLsEode0Nmtz0KWR5q6GibAkvt2PAL0ueYU0xvZAFj0p2hjI7+I2?= =?us-ascii?Q?lzzXdgSHZ3JqbZYtXByxxc1ddinf9ezWGAhvlZpOZ8BNu2GtzvV5V5RoPCiz?= =?us-ascii?Q?BVqMn0uRrYvC5507SHbPSpyl5XT8yz7sFKTyipO/EeatCn7WsTXqA9XgEhSd?= =?us-ascii?Q?yHLPMGk/XkpbcphlxOp8esddLmvJdH7//xFul4xPDvDGfCZFbhmnCJmeW0Iy?= =?us-ascii?Q?jvFj3V6IJxC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change-Diagnostics: 1; VI1PR05MB4191; 6:OdW7GUCGFLMB/UTL7yy5JWHCxlY62+O2KU2yIruUvj5bgJ/wP0dmB29+89buSpcnhnYDgBejhFl8Mlu5QPY3YinN/w4HTSZqHEMYz+9dXLt1ywybFJVnnHUu3cs5h2+1rFQFKHQpemQAZx301U0ltAYaWlmX4lNUi40HPDDXRNLWvq5LD3aYkIMDiuZOQnh44lJ7G778yAehCpaTs6UATdoOpSHagMfCaF5OFQfxZBrP+MqAiraYmaFl22sUVzvOYSVDUsDltDrLv9NDn4wASxbKmb/iFLBrJs9NQHn6cGPeveZBCI6Jbg4bN/WC9UPQxRUraAciiu7VnsT0yz335+nmOl34lNmVYh9Hz+6XJY6a2SPUCZylyUJqJgdj64MGSx1tApXr+HnRxcui9P34VJMP1ahDcQklW09UCbt3v1gjO7k2zr7QqtG5O6MPgkOav778wmaLIen/JFN/BSOYBA==; 5:e074I4edMn4TxI+TqX8q/pSfN8bjCKKQ7vfCJ323oAndQR2zoAgGxAlum664zVUzVjyLerPmo0ZzDmnStr1yi2iru9O3NepLomAur5cwuUfrIsvOm8+KhwJ7xUrD/zcxhypI3E+19pYSrECH6siES+D/+IhbzCRnAH+/EdDjJJc=; 24:qWdIoK+d51VFCTcA6FGvvyTr4qeMz24w9rtiD0QnsCdFFk9I6uPpyYD91EQpVcBjE0h39RGeMvDXtTHNI1HCu3WT0PPO1ovHA0jTmap2JGU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:+x2qKPrz0nzUOJoYyif6kPAaQ2V1zX6T2b7lmHr9GCJiNjW8jLzF/8IQaZPtlNpqk+wLG8DBCTV3n1rUzDR3sa6d9KyARxRDSrVE3Noi8uiI/fYEzmXQV0zkHWvmr4EZ/JIrUbxJLLN8nVoaN76AH0pd2p8QqTSRjPGvZiqO6uK0TKSR8L5i5BJrsLnw3NFlJeWuhQpIy3td8KtA3ZSHlgMY10o73z+Axq8aifX6UBLl2wqWbSROnri/P1L8jnpY X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 17:59:02.7282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53335ae2-44ed-4dec-4ee4-08d5e0457f45 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 gretap when the underlay route points at a VLAN-aware bridge (802.1q). Signed-off-by: Petr Machata --- .../net/forwarding/mirror_gre_bridge_1q.sh | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh new file mode 100755 index 000000000000..a3402cd8d5b6 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh @@ -0,0 +1,126 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# Test for "tc action mirred egress mirror" when the underlay route points at a +# bridge device with vlan filtering (802.1q). +# +# This test uses standard topology for testing mirror-to-gretap. See +# mirror_gre_topo_lib.sh for more details. The full topology is as follows: +# +# +---------------------+ +---------------------+ +# | H1 | | H2 | +# | + $h1 | | $h2 + | +# | | 192.0.2.1/28 | | 192.0.2.2/28 | | +# +-----|---------------+ +---------------|-----+ +# | | +# +-----|---------------------------------------------------------------|-----+ +# | SW o---> mirror | | +# | +---|---------------------------------------------------------------|---+ | +# | | + $swp1 + br1 (802.1q bridge) $swp2 + | | +# | | 192.0.2.129/28 | | +# | | + $swp3 2001:db8:2::1/64 | | +# | | | vid555 vid555[pvid,untagged] | | +# | +---|-------------------------------------------------------------------+ | +# | | ^ ^ | +# | | + gt6 (ip6gretap) | + gt4 (gretap) | | +# | | : loc=2001:db8:2::1 | : loc=192.0.2.129 | | +# | | : rem=2001:db8:2::2 -+ : rem=192.0.2.130 -+ | +# | | : ttl=100 : ttl=100 | +# | | : tos=inherit : tos=inherit | +# +-----|---------------------:------------------------:----------------------+ +# | : : +# +-----|---------------------:------------------------:----------------------+ +# | H3 + $h3 + h3-gt6(ip6gretap) + h3-gt4 (gretap) | +# | | loc=2001:db8:2::2 loc=192.0.2.130 | +# | + $h3.555 rem=2001:db8:2::1 rem=192.0.2.129 | +# | 192.0.2.130/28 ttl=100 ttl=100 | +# | 2001:db8:2::2/64 tos=inherit tos=inherit | +# +---------------------------------------------------------------------------+ + +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 set dev $swp3 master br1 + bridge vlan add dev br1 vid 555 pvid untagged self + ip address add dev br1 192.0.2.129/28 + ip address add dev br1 2001:db8:2::1/64 + + ip -4 route add 192.0.2.130/32 dev br1 + ip -6 route add 2001:db8:2::2/128 dev br1 + + vlan_create $h3 555 v$h3 192.0.2.130/28 2001:db8:2::2/64 + bridge vlan add dev $swp3 vid 555 +} + +cleanup() +{ + pre_cleanup + + ip link set dev $swp3 nomaster + vlan_destroy $h3 555 + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_gretap() +{ + full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap" + full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" +} + +test_ip6gretap() +{ + full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap" + full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap" +} + +tests() +{ + 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" +tests + +if ! tc_offload_check; then + echo "WARN: Could not test offloaded functionality" +else + tcflags="skip_sw" + tests +fi + +exit $EXIT_STATUS