From patchwork Thu Apr 26 23:22:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10367015 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 B5F506032C for ; Thu, 26 Apr 2018 23:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADFB528A8C for ; Thu, 26 Apr 2018 23:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A251628AF1; Thu, 26 Apr 2018 23:22:39 +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, LOTS_OF_MONEY, 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 B403B28A8C for ; Thu, 26 Apr 2018 23:22:38 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40XCld19C5zF26H for ; Fri, 27 Apr 2018 09:22:37 +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="w1xZW6C+"; 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.62; 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="w1xZW6C+"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30062.outbound.protection.outlook.com [40.107.3.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40XClY1LJrzF25Z for ; Fri, 27 Apr 2018 09:22:33 +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=VOaw/MbeNYPpr8/IeP4kSD1ODYWC91VFygBHGT+pVwA=; b=w1xZW6C+jgI3+J/LIfKCyyk5jZvncdOZOLiBk4D5mF3QaOYeYSKNfonE+vVx8FJ4rbt/fDOHhwf97Y0wKX2zJn7Wcm/Y9gsQ2qAc8G30h+OLCqi6CNUD/UmjtgwaRMRr6Lmj1stW50PZkPosL9kuAHBBfrukJkXvWf/HB9AuZeY= 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:22:28 +0000 From: Petr Machata To: netdev@vger.kernel.org Subject: [PATCH net-next 7/7] selftests: forwarding: Test changes in mirror-to-gretap In-Reply-To: References: Message-Id: <138a1a149f86f31e395a6ae7f733d35cd8e772a5.1524784510.git.petrm@mellanox.com> Date: Fri, 27 Apr 2018 01:22:25 +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: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) 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:7DEnRMlqf8LeVBQVoNYx3m/yY0ZxqQEEvXwiVSdG8cyJOFeoRRC8wYcPfPK4b7BGsl8Q8Y0wVWxKYzsGwHa+ciyfXk2vqa18Gkec7u7RLh1Vqcj6U8cRQ7qnagHxR22BJy/w3C8TKKJUJM581fgB1yKS20eTnCQ0pMeLlDYhXQUf2xGWb/Xnu+1xoQb+wo7JEnOqC0GKiRVqTov6plA+frRQ9EWy4J+/i2RHDh7fWn8OlZtVxlSzmKkKHcUiVAu+; 25:FydKWBMI/CdSgomXzx2UUJJrXhOv+prfPQdRhFet7Atwdw8CytX/0Z0VhtbOJo2OlLPFC29JIcZbKM7YUl/mW/5BAeT6I2d2T4jtFhHV9jH7KMnr863JWMULIDI0pRNxZHyrm4SySrp/3NeXB5zUtT6NRiTyL1LH8ZRSohSStkZPDZgKmepEKKvBI0eI63hQrUSdi14aGrd7lHI/IZ9TjCa0eb6CtTTc/BId69siKpJH2KhPVUJINJTSxEpAunqdCkrbsrzeaUhCybymbTJ8LaTG/dOqmKNpa15DQlAX5nFFil4Lgj/cBRT/whNb2YTDuGd9GiWLYq3NqVdpPYQiMQ==; 31:7qYs6fOyINMRDJPysz2Zcn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-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:Rn+wZWemNQnqcdggsDX/eyQNi1K6WVZnjOXIbcGdi?= =?us-ascii?Q?Q7Hbxpl7YaFrP5SItVNI72KVAVtKoMyGpWN6+wQz5vqBi8NowZ395/0ExtKx?= =?us-ascii?Q?xcxJUPZgC+v1BOTnMOLBWRu/k8j2Dv952BuM4QBtxKLtHFV2qhTsff2hF9Tt?= =?us-ascii?Q?qd0fmM1DNvQBpjvZoBmrmAcPlOAm7OaEaobxty8bFcwuOvk6EWgfqMUIqJtt?= =?us-ascii?Q?k7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9U0bAuJyvzv74=; 24:1iCz9xn1BFlcaeQgV7ThvWmpNdAsf18ScJVn5XAS2opSjM+xBb5skTS5oxPMhsfsxjwREOzo8lQM29pOH8z6Qstpwk4amw4H/wNhOiZvbgw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:RFRgkQbkPtlMxq2fcQbV6NWTVs+Lnk+7k+Q0KVlxZv42LPS6zzbMqxS1gdzZyk7jQi38dpBHL0+ih52655kb889+Spig1WS2tia4awh4ZmRaoCmZMyyB5oMl6Ovuuelc3a/b48i1Pup4JytrpWLBnTBfc5dgXm2XC1lZsuuvyX/nZOddmLpBz44nQmAXKUYlDq9WuOYPEKL8COiJBxQiAltunmhsaYV567xzps5pn2iod/FgIoLuPovF5OX0CUUF X-MS-Office365-Filtering-Correlation-Id: 9fe392f6-58de-4a80-0352-08d5abcc9446 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 23:22:28.8337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fe392f6-58de-4a80-0352-08d5abcc9446 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 These tests set up mirroring in a situation that the configuration is incorrect, i.e. mirrored packets, if any, are not supposed to reach destination tunnel device. Then the configuration is rectified and mirroring is checked to have started working. Signed-off-by: Petr Machata Reviewed-by: Jiri Pirko --- .../selftests/net/forwarding/mirror_gre_changes.sh | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_changes.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh new file mode 100755 index 0000000..0ed288a --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh @@ -0,0 +1,194 @@ +#!/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 how mirrors to gretap and ip6gretap react to changes to relevant +# configuration. + +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 + + # This test downs $swp3, which deletes the configured IPv6 address + # unless this sysctl is set. + local key=net.ipv6.conf.$swp3.keep_addr_on_down + SWP3_KEEP_ADDR_ON_DOWN=$(sysctl -n $key) + sysctl -qw $key=1 + + 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 +} + +cleanup() +{ + pre_cleanup + + 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 + + local key=net.ipv6.conf.$swp3.keep_addr_on_down + sysctl -qw $key=$SWP3_KEEP_ADDR_ON_DOWN + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_span_gre_ttl() +{ + local tundev=$1; shift + local type=$1; shift + local prot=$1; shift + local what=$1; shift + + RET=0 + + mirror_install $swp1 ingress $tundev "matchall $tcflags" + tc qdisc add dev $h3 clsact + tc filter add dev $h3 ingress pref 77 prot $prot \ + flower ip_ttl 50 action pass + + mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 0 + + ip link set dev $tundev type $type ttl 50 + mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10 + + ip link set dev $tundev type $type ttl 100 + tc filter del dev $h3 ingress pref 77 + tc qdisc del dev $h3 clsact + mirror_uninstall $swp1 ingress + + log_test "$what: TTL change ($tcflags)" +} + +test_span_gre_tun_up() +{ + local tundev=$1; shift + local what=$1; shift + + RET=0 + + ip link set dev $tundev down + mirror_install $swp1 ingress $tundev "matchall $tcflags" + fail_test_span_gre_dir $tundev ingress + + ip link set dev $tundev up + + quick_test_span_gre_dir $tundev ingress + mirror_uninstall $swp1 ingress + + log_test "$what: tunnel down/up ($tcflags)" +} + +test_span_gre_egress_up() +{ + local tundev=$1; shift + local remote_ip=$1; shift + local what=$1; shift + + RET=0 + + ip link set dev $swp3 down + mirror_install $swp1 ingress $tundev "matchall $tcflags" + fail_test_span_gre_dir $tundev ingress + + # After setting the device up, wait for neighbor to get resolved so that + # we can expect mirroring to work. + ip link set dev $swp3 up + while true; do + ip neigh sh dev $swp3 $remote_ip nud reachable | + grep -q ^ + if [[ $? -ne 0 ]]; then + sleep 1 + else + break + fi + done + + quick_test_span_gre_dir $tundev ingress + mirror_uninstall $swp1 ingress + + log_test "$what: egress down/up ($tcflags)" +} + +test_span_gre_remote_ip() +{ + local tundev=$1; shift + local type=$1; shift + local correct_ip=$1; shift + local wrong_ip=$1; shift + local what=$1; shift + + RET=0 + + ip link set dev $tundev type $type remote $wrong_ip + mirror_install $swp1 ingress $tundev "matchall $tcflags" + fail_test_span_gre_dir $tundev ingress + + ip link set dev $tundev type $type remote $correct_ip + quick_test_span_gre_dir $tundev ingress + mirror_uninstall $swp1 ingress + + log_test "$what: remote address change ($tcflags)" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + test_span_gre_ttl gt4 gretap ip "mirror to gretap" + test_span_gre_ttl gt6 ip6gretap ipv6 "mirror to ip6gretap" + + test_span_gre_tun_up gt4 "mirror to gretap" + test_span_gre_tun_up gt6 "mirror to ip6gretap" + + test_span_gre_egress_up gt4 192.0.2.130 "mirror to gretap" + test_span_gre_egress_up gt6 2001:db8:2::2 "mirror to ip6gretap" + + test_span_gre_remote_ip gt4 gretap 192.0.2.130 192.0.2.132 "mirror to gretap" + test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "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