From patchwork Thu Apr 26 23:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10367007 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 CDB6360386 for ; Thu, 26 Apr 2018 23:20:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C810929252 for ; Thu, 26 Apr 2018 23:20:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC61E292A1; Thu, 26 Apr 2018 23:20:27 +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 BEB2E292A0 for ; Thu, 26 Apr 2018 23:20:21 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40XChh6BtkzF25l for ; Fri, 27 Apr 2018 09:20:04 +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="jc0GpQOr"; 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=2a01:111:f400:fe08::627; 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="jc0GpQOr"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03on0627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe08::627]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40XChf25nnzF25Z for ; Fri, 27 Apr 2018 09:20:00 +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=yA3B9oo2pZR2Qq/07ET2QiphILwM4EM2S7lf+d+alpg=; b=jc0GpQOrsP9Gh196Nh1JHku528dgX2UPj+yNWnn/l/J2Ikmp19CEJFuQWsMEt2gZ1SjUye0u/jTklAjygWCBgUxyQv+IBYzpWzhTkHjRimDoaDO1WsXlsANsWMHp700+6DGNuA+T13tcZGM+FEYr43JLzPykCltdFsws4Qomx4M= 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:19:54 +0000 From: Petr Machata To: netdev@vger.kernel.org Subject: [PATCH net-next 3/7] selftests: forwarding: Test gretap mirror with next-hop remote In-Reply-To: References: Message-Id: <99a803c0a1a5887e56c756e60bb7a30acd2fe196.1524784510.git.petrm@mellanox.com> Date: Fri, 27 Apr 2018 01:19:15 +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: AM5PR0701CA0011.eurprd07.prod.outlook.com (2603:10a6:203:51::21) 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:de4Rfm3xCP1+eQwUCk/70L/55YqCG686981/zeVNG//K/F3RCa9/HL0dwZmSesfl07gKrP6bj3gbJmDnCBDacHvsMaYa2Mzf0vcA0KoPoWgnaFh12e23EIAIhkXnrmGvWhX0Uo7QuzGGtkRpB8FGYCQ8gLzRWh3kZrsSsIwHeVaB3pj+7iBQ9ilm29IalQuAoOffPz37ZfKITNeis0mRvjfGo+9vWHb3XoG7gnVtz2cMLfCDXaYGDtpgmaO+/vxv; 25:ahEJEW4mE+MI/NoYirb4ov5NMONF6v6y7JpJpxWEjj07BafEbzA6joXHjDbqnl2dtu/6J7NVv/MwV0IrA0atsj4K3JcBdfM8lUWiObJZp+JsFD9zG3/XSd4cLmdv6Cf4aCrjCM8G3yGp3TQeRVE5xboiWymyS1I6KXIUWKVR7F9FocEI2H4mjs3KPbyEEsUXlbCoS4bzo5ir6i319p19c8L7LiLkPUPASz4lJgtgZ1jN7SHHul8WhtV3DdiA8G8abe/V8Q4lNDEHD7gQmmU/2U7Ip+SXskGKJyn1nbZy70K7hM23SQXZRMBz5joFDQO/np/H1BTMDhkRZckTQnH+oA==; 31:V0vDV30stnRAoQ5XzjRzMR2DzjrK0gVS52Meah91aVIx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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)(366004)(39860400002)(39380400002)(346002)(396003)(376002)(199004)(189003)(386003)(478600001)(6496006)(25786009)(4326008)(6116002)(2906002)(16526019)(2361001)(11346002)(7736002)(3846002)(956004)(446003)(2351001)(316002)(47776003)(16586007)(76176011)(36756003)(51416003)(52116002)(81156014)(8936002)(68736007)(81166006)(58126008)(8676002)(118296001)(5890100001)(26005)(97736004)(305945005)(6916009)(106356001)(2616005)(6486002)(476003)(53936002)(66066001)(5660300001)(105586002)(50466002)(486006)(86362001)(48376002)(186003)(6666003); 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:9P1vvpEicuimLBOjtSrNwPUP7Q5yBK4kZ2csm4z+G?= =?us-ascii?Q?yWrI3gGK2QzOtSxp+L4pcIvrE6XRXpbfSHloR4spx5tozyv9nmvOZ8gJhTmo?= =?us-ascii?Q?iYhCtDpi5CgtU6TRAg6JVop1XVdQtsq+Rey3Ls8JJnu3VgYvwdbmSo9B6Qr6?= =?us-ascii?Q?Y/oO8AgBL56E1kUJpz0ZxALZmEDCab5ZBCMv0UUsT/YzpyNq7YvkoQfoaYjh?= =?us-ascii?Q?JVrN1v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I=; 24:U1kQjnV31AqKHrSLJKxVutUEpadR+UX3HFWdS3yGBvP2X7eHYgdfAWNephzF1Tuaonue9vhW6Z+vXZ/5XRTDH8frCaSCiMGc3x4WQOGNdPY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:bMPAkBGUq/IwlFT6kQvDiQihxFgFiDYOVS1zHaWwC/WtNS5oIQpPUCai5uZPRzZXxBLi6W0W05yhP60rxKKfyYAT+pcE29qkEngqcNqsUDGjtj5yrA/zKuRaHMsrgXolqDC5Hci5dfAxRsSFx2yoR5U22jBbJQooIQKrJg6K3xFXF7sUrXwv3yv6rzPkCcgnJ7lTDorLEHmitotOOBQqO02XJvaTsKu7OGPB9chTbn9ybpEWMRl0b+ysNu0n5Tet X-MS-Office365-Filtering-Correlation-Id: fb2fbff1-f5b9-4f0e-02b5-08d5abcc3874 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 23:19:54.8316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb2fbff1-f5b9-4f0e-02b5-08d5abcc3874 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 Test mirror to a gretap and an ip6gretap netdevice such that the remote address of the tunnel is reachable through a next-hop route. Signed-off-by: Petr Machata Reviewed-by: Jiri Pirko --- .../selftests/net/forwarding/mirror_gre_nh.sh | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_nh.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh new file mode 100755 index 0000000..9ac7097 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh @@ -0,0 +1,117 @@ +#!/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 that gretap and ip6gretap mirroring works when the other tunnel endpoint +# is reachable through a next-hop route (as opposed to directly-attached route). + +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.161/28 + ip address add dev $h3 192.0.2.162/28 + ip address add dev gt4 192.0.2.129/32 + ip address add dev h3-gt4 192.0.2.130/32 + + # IPv6 route can't be added after address. Such routes are rejected due + # to the gateway address having been configured on the local system. It + # works the other way around though. + ip address add dev $swp3 2001:db8:4::1/64 + ip -6 route add 2001:db8:2::2/128 via 2001:db8:4::2 + ip address add dev $h3 2001:db8:4::2/64 + ip address add dev gt6 2001:db8:2::1 + ip address add dev h3-gt6 2001:db8:2::2 +} + +cleanup() +{ + pre_cleanup + + ip -6 route del 2001:db8:2::2/128 via 2001:db8:4::2 + ip address del dev $h3 2001:db8:4::2/64 + ip address del dev $swp3 2001:db8:4::1/64 + + ip address del dev $h3 192.0.2.162/28 + ip address del dev $swp3 192.0.2.161/28 + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_gretap() +{ + RET=0 + mirror_install $swp1 ingress gt4 "matchall $tcflags" + + # For IPv4, test that there's no mirroring without the route directing + # the traffic to tunnel remote address. Then add it and test that + # mirroring starts. For IPv6 we can't test this due to the limitation + # that routes for locally-specified IPv6 addresses can't be added. + fail_test_span_gre_dir gt4 ingress + + ip route add 192.0.2.130/32 via 192.0.2.162 + quick_test_span_gre_dir gt4 ingress + ip route del 192.0.2.130/32 via 192.0.2.162 + + mirror_uninstall $swp1 ingress + log_test "mirror to gre with next-hop remote ($tcflags)" +} + +test_ip6gretap() +{ + RET=0 + + mirror_install $swp1 ingress gt6 "matchall $tcflags" + quick_test_span_gre_dir gt6 ingress + mirror_uninstall $swp1 ingress + + log_test "mirror to ip6gre with next-hop remote ($tcflags)" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + test_gretap + test_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