From patchwork Mon Jul 2 17:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10502193 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 16ADC60325 for ; Mon, 2 Jul 2018 17:59:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0891C28D30 for ; Mon, 2 Jul 2018 17:59:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0EE528F23; Mon, 2 Jul 2018 17:59:02 +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 BFFFF28D30 for ; Mon, 2 Jul 2018 17:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752960AbeGBR7B (ORCPT ); Mon, 2 Jul 2018 13:59:01 -0400 Received: from mail-eopbgr40086.outbound.protection.outlook.com ([40.107.4.86]:34100 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752808AbeGBR7A (ORCPT ); Mon, 2 Jul 2018 13:59:00 -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=8wxjas2CWsGz010pO0HNugnlkqUgqaEkhZa39JrAy7Q=; b=wGVYHTOKvVTwTmyYUYHQ7kToz+FXSV9oo9hBuYnaCpO29GVEPmX8+1GsvttSQfbOTfcmp3RTImIG63sTecnKMHHBxTmn5MNISQCDdVqs3J2hFQ8StQ7gJHLxrtDfLPwnsbIa6XEBL1Q/n/UpxdrTz0cbEeCiM8QQq8RvKlKyVkU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Mon, 2 Jul 2018 17:58:55 +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 1/2] selftests: forwarding: Test mirror-to-gretap w/ UL 802.1d In-Reply-To: References: Message-Id: <26f9123ca3d9cc6faf32df5a078eca852e9f787e.1530553971.git.petrm@mellanox.com> Date: Mon, 02 Jul 2018 19:58:49 +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: HE1PR09CA0063.eurprd09.prod.outlook.com (2603:10a6:7:3c::31) To VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0b7ce02-99cd-4b5b-ab51-08d5e0457ae0 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:VI1PR05MB4190; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 3:VDrYZS0+VzqeAG+akTBvcZ2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da7yjukBStN/zO9TPgsweGmfMVIYkiNNwqCRlBhPRbHdMzhbLeYnLbyyL+2P5Oin9foTXSNYLCGa0LSlVjysORxq2dInWkV13uuBH1RRinCHoVatd1mpR3aX1peTyf80lVZikUTxxLApZ+C4Ns6vA4UlTCjNMFADrknp+Or/cZVQiRqWFulmSlF78WR+imi2nmfSMKTJ8t6JP/9rU+Nrm2ViZVmqV4udMLTOG00ibJB9nTQFJo/dUSEoUdndpKdocktXExABzxfm6eeTO0Ef5ZHm1BZHfIGAUpQKQWy3eQ+aMQeDmYe8CL579iO3lSoWg; 4:Gpir/bizq0ScgbK7xL3Fn67Z4r5wU12qOjtT8RtXmCLxF8Bc3YwzJHhmhc1Qg+wlVFdfr4u4h5llcEyBOjkF/ljMcBZIVnNNXnf0ThJ/eL6eboYhXzutaQklfLuD+1ZnPQ7GVYxWJBqCc2FtfdGURGxZwqn6VWewTPqnh2P7XdpmxvUrEkwkwXqn2hdhSmghCv+j+Ek4tEf3YEJCR4vrIZtw+Qdj/Z7XOnI2NVN18FO9fsDTiCbLG+hzSv5Rcp24XHIEwP9LGIJyBIeW1D1Bug== 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)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4190; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4190; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(376002)(366004)(39860400002)(346002)(189003)(199004)(446003)(11346002)(476003)(956004)(118296001)(2616005)(105586002)(486006)(305945005)(8676002)(7736002)(6496006)(76176011)(51416003)(52116002)(8936002)(26005)(58126008)(6486002)(316002)(16586007)(81166006)(81156014)(3846002)(6116002)(106356001)(2906002)(68736007)(6666003)(5660300001)(86362001)(66066001)(47776003)(478600001)(48376002)(50466002)(386003)(186003)(16526019)(4326008)(36756003)(25786009)(53936002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4190; 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; VI1PR05MB4190; 23:kqkSMjKZpQfAf9adXeCsYoQAuY0UvEPBg1I7dGztC?= =?us-ascii?Q?Jj0CYDgUWxT/0bgGZXVlPH1nAATw08OzMYyRuH2U9oFcO8O19kF1XJheDK6z?= =?us-ascii?Q?acG+liQ3HevD6YGIhzE3GHjAHho9DJ7RCGtrgUXiLwjNvQC2G3XDzIlmia1U?= =?us-ascii?Q?z3FPC2BGS09d6rS2UbTUD4Xg4vrVdEL5+Cq3R8Eik9H6xEZ5lRVrIBu6ghbI?= =?us-ascii?Q?lcnkrdl8/6arhMg3ASVciN0uxqNq33K9+SElesGfnJCIaBFbKsnuzoVrcIZa?= =?us-ascii?Q?ftdDzaFe6fzmVhM2q3IOSY0zW5iBDN/0yOPJxrxP475k6CzHyFo9AImcPsk7?= =?us-ascii?Q?lF1ADRn9pV0pxGpNfeIVbwpICwE/5YMX6bcsjK+EGwqWudtg2srNdi3UtiRM?= =?us-ascii?Q?yVvDJxjbgOuR+xTrWJtYMOtZnrG+/nZtSrPTwNkjI4LTfj7c4D/hf4ZM8sQ6?= =?us-ascii?Q?dZp/V229baofvXCXDqgzGWkq0XUdwzKgaCcwHQgCj5VeI1/pKSVoVwpguR7c?= =?us-ascii?Q?WJATV1OY4pPpJEKj1+kuZ9rSJyjl9zfzJbtOMGUmgds7S0FrTUgJbE0IX2qY?= =?us-ascii?Q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-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 6:PNIM56PH61jcT6S+tWYmIE9qNYU4V3NDATtqIMIoWyK7/gw8udtVf3aviCcWy+irialiOFY3+FtARUE8PUYyAj44FWKmtpGifQtbLErsyimnKGJTcbVLShUjuaIV9AQCO5gNxlxKW64ieGh6BmnY2Z1UjOhk+SaSo7VvXkhNqCoy+DAcM0Sd8/6f1mVHFvXWHDBCLf3lGz6k4TIPV3sVEJ6W/aNOziWqq6pzlfA1InUnn+dXkS/BBoYOWSwBb/p0q9OhFhGH7zH2E8SCNcFq4FbH3pDW7VcqBeV4NkXq65zR/eex0yjWIlv15a8Ofn4NNvgynm5Dl3NSUwupFbT13e1djH0lE2PHNIe41FYihsJZCp3fNnIe0O6r4CWxmgYAssph+/eq8jw4q8rcCjw1OInhDpfIR2+Utf1iyDuKCXJ1xXv9Cc24s8TZlIAsJ81RI0Wyb7y4+2AdngK4PWS0+g==; 5:KVtMjgAb0NEPlbrpxAcMsFlyJQ/vfsDDjG/Mj93wNmYxCWYQd9gg98I2vzvfQis4qLoJ+OXm1lABhTSo/AxVo+NT679ES2Q2cMrfJ0dFjc/TlwviaqMY7KKK1tKzr/84SDDtqDOZpEu7Huuwtr5XKsB1TRS3HJoyR3CKb5dTQnc=; 24:uUreU/xmGL83/fXl8x3l3x4+OY57e6q5eIRiXD5tW8tBq+LNAvF7W5JcAp/82BWzhtFYzZFfWSlN2kTXRtR7ua5MHehbLUaVDCCq7gVImjg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 7:d15rsz9lUObS6vCZVwT4gJQxFjJifRHuGf4EirGHWt6VF/N0ddRXoH9L0rTuq5BKOIGyivWUaimia2fntLgPPB9wALVKlgBHowRCn/y53C8jNCsgn3DXtY8ekpkxqMNiNjXqmnYXyTrnygqZnkSfCTydYvn/14uLuTe21p17zibWlFMXJeo12hY89XfT+F7kYcwPvaKky+0qsgpy32n6YR4c6ftGBb2s9XGimaV6m7Y8gzhrOB+ujkyL65D2az6+ X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 17:58:55.4947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0b7ce02-99cd-4b5b-ab51-08d5e0457ae0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4190 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-unaware bridge (802.1d). Signed-off-by: Petr Machata --- .../net/forwarding/mirror_gre_bridge_1d.sh | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh new file mode 100755 index 000000000000..c5095da7f6bf --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh @@ -0,0 +1,132 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# Test for "tc action mirred egress mirror" when the underlay route points at a +# bridge device without vlan filtering (802.1d). +# +# 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 + | | +# | +---------------------------------------------------------------------+ | +# | | +# | +---------------------------------------------------------------------+ | +# | | + br2 (802.1d bridge) | | +# | | 192.0.2.129/28 | | +# | | + $swp3 2001:db8:2::1/64 | | +# | +---|-----------------------------------------------------------------+ | +# | | ^ ^ | +# | | + 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) | +# | 192.0.2.130/28 loc=2001:db8:2::2 loc=192.0.2.130 | +# | 2001:db8:2::2/64 rem=2001:db8:2::1 rem=192.0.2.129 | +# | ttl=100 ttl=100 | +# | 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 add name br2 type bridge vlan_filtering 0 + ip link set dev br2 up + + ip link set dev $swp3 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/28 + ip address add dev br2 2001:db8:2::1/64 + + ip address add dev $h3 192.0.2.130/28 + ip address add dev $h3 2001:db8:2::2/64 +} + +cleanup() +{ + pre_cleanup + + ip address del dev $h3 2001:db8:2::2/64 + ip address del dev $h3 192.0.2.130/28 + ip link del dev br2 + + 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" +} + +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