From patchwork Wed May 23 16:34: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: 10421901 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 428DC6032A for ; Wed, 23 May 2018 16:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30406290BD for ; Wed, 23 May 2018 16:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1C472915F; Wed, 23 May 2018 16:35:16 +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 66DAF29170 for ; Wed, 23 May 2018 16:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933513AbeEWQfI (ORCPT ); Wed, 23 May 2018 12:35:08 -0400 Received: from mail-ve1eur01on0048.outbound.protection.outlook.com ([104.47.1.48]:54322 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933599AbeEWQfF (ORCPT ); Wed, 23 May 2018 12:35:05 -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=U9kkxmht97fPMi4OTKfXhKjWhQNmXC0m68Gh3p6gmrA=; b=y1DypRFAoJnK765KwMEXcBhp2jbcrBDiGEIfyNux7DCtJtgFIh5Tkae2QAf1D8TpgLgn8lsWTLCXmekQLfFOJQFhVB3v8v+sTVPF6fHEzbo89mp1O4Jz5EnTpnjlVLWjZujA+FsaUQjV4YEv2i82cZnus+5GQ40AHFA53g2Yp1I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Wed, 23 May 2018 16:35:00 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org, idosch@mellanox.com Subject: [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device In-Reply-To: References: Message-Id: Date: Wed, 23 May 2018 18:34: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: CWLP265CA0062.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:12::26) To DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::26) 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:DB7PR05MB4185; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 3:iLws84sOq+7KRELbnqyyNbvvLg0mOthg/sgbzyMTUWMexJYtY8WOHRCUjKGzMivRwtb545wE0Pe0s/ng2zapiPzF9nmJA4k37HhQbAzKA7dZSRUtOoyvLitOqSQCv1hOz5WyEkO5a1vUGT/AuL3GfXpb6CR991IZLs5RL6rEI6GRg7Ra+AgSrWFtXfpFu/x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MuV8nQEt6tzpLE5I8naJFafWi+ViVeLq7KYv7kcug+l3Q9gjaWkoVtwZOrKF/GZT36mU4ncylw6cdCsfmKBqqRMiu1Mh3AYIcQqjJq/MiFgaPQ1Vx4N5xft3dERtA9cj2QNhljb+swIhnoZQuyVaqv9r; 4:O7h+JOpDQbTqaQa7RAZHuCxKfYmTcODjaDtzrHEQcHv4JXRQS+Kal57jP/VwDTzdeHrq3yVspHkm23Gj5lfxmNg5Fzp5bX997av3OOygGQ5RXvNVxUemkUPpr13HkdDREwhEQqlhkx7tXltH5dTJMVArpQYDzCotoUciB2r68+J0QqdUgMG28eUVOP6XtjRSI986vtj9Uz1g4MOF+6DX8vCNnF0Nilt4ccL2RYn5D5ZD3W3jfjOF7+D2O+voHxJcgYB5G+q43iEZ3dxhRLzdCg== 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)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4185; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4185; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(39380400002)(376002)(396003)(199004)(189003)(446003)(25786009)(47776003)(3846002)(52116002)(6496006)(5660300001)(106356001)(36756003)(97736004)(59450400001)(476003)(76176011)(51416003)(956004)(48376002)(316002)(11346002)(6116002)(2616005)(386003)(105586002)(486006)(66066001)(16586007)(58126008)(478600001)(50466002)(16526019)(53936002)(26005)(8936002)(305945005)(4326008)(7736002)(81156014)(81166006)(86362001)(107886003)(6486002)(8676002)(6666003)(2906002)(68736007)(118296001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4185; 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; DB7PR05MB4185; 23:NM189SgNgZBJ8krTkqZu+gry0Ngg82RGulHcwJCG9?= =?us-ascii?Q?8E29skmuzFkGeuKxUYCbINd++79bZw4gewKEAJTdtdE7Sar7CnS5wUyo+oyj?= =?us-ascii?Q?8rejyFHv1a5qy4X0ja8yCjGVwZWxJRQth+iuJF5Lm2IM/KvtyAhTJooO3rjS?= =?us-ascii?Q?EgUHiaiW98fVgY5XYRAQjJU9EZa7xIBQTCOFROBwHeQxSdTsixvO43zIUGGF?= =?us-ascii?Q?rplg8zREpGVOVwCFu2G3p5YP74urURxiBy2+d9IEX0NsopQ7Rrt2Z9+vOuw5?= =?us-ascii?Q?53YLAvVVx9fTg2bWlVrwC6Z47iqazcUk61SHPrz8DyBMXB2mHkiWZIyX1kXE?= =?us-ascii?Q?Lf1bRQccnHhQIKv5B52vyVTl7GY2vjNEiOctyGUQOq0sRTxs/VJfv+qx17oQ?= =?us-ascii?Q?aMVim2LBv6wbdHKGbXXkqqxHnE9ehyHwysP93wagIIQRkJ3wWenr4aIC+ume?= =?us-ascii?Q?TyN3XIcomIQmKexWsatM94lP8uSCyJ/ERpRIcm+4waaiD7f2Zb5ZqYYc3Vp9?= =?us-ascii?Q?AWsYCUr8QCJGV6Omh9AJtO6n4W0M6XfzD7TF2xRltgN7RG+jHHU6ZmRQT6/3?= =?us-ascii?Q?BVN1yz7g0lCyyVIbWuCUDw1eeU9rCoWttuLcDAfusTXMdehKkBW59sXdwm7V?= =?us-ascii?Q?nzAMrIC7RCapA6CmJLpsKYnbVcvBP6fB2YgmcA6MTvRYfu/+wdgfTlpVzBjE?= =?us-ascii?Q?t6YQ04vjtW353ZNsQ1zoO8AJBM6+6hVUbya4E5z2LQLL/pdkQY7JrxkvC3o5?= =?us-ascii?Q?FQqiH3IM9yTrMrD9JidrmQo/QI5iKunSXdBRD4bW/SK2Q3u4gKB79tZunN2A?= =?us-ascii?Q?kkJloWU4dxndwkjwViZCaTurXNPRYyn8VqZUflfS78470WgZwtlPuTjv9LwO?= =?us-ascii?Q?tJ2wyngav7gdbvckGfqniYppbw6w/kZ7OuncU6soQPReV7ZIiHlPInacqyjD?= =?us-ascii?Q?vxt4nlWGx0I4FofoOT8t1r6H/KzZeyGpjxvl2460bSr46Q739Mj/zOsGCuDG?= =?us-ascii?Q?LOJx8QEmFr6iyvaVb9f1aniHWnSDYuJEA/2jehQG5zwezAOLSHfOYS7nNvjx?= =?us-ascii?Q?J0gtlLM4mLYnOp/MZ3lF+j7AekjLNXwNia6ssW9dons7Zs3MTkcAAvG+Xnc9?= =?us-ascii?Q?ozb/HBjAMBqmxMzyCxsNyXfEb654MXgs2KW6Rmb+BHPK2WXLNfgJk1/R8Npj?= =?us-ascii?Q?H7oYOJgc361Teg=3D?= X-Microsoft-Antispam-Message-Info: CtcSLmxdanaykZlcB+FveXmIEK7kNNDP848N8cIJpZyJcPJ8l/cgIX4uJWJ6PexIRvQ6MnWEiGIMhmQZOq7vnGN3lKRXxyuxGKB8F/vdsu06DgpVXXTkw4w96J9qCw7KKwwtnJHnpnFCPLJEi8ATxwZUAOo2ZAWwemTHCFCNKjulyJiMj5e4NNFhdtAvKG6G X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 6:ak9BUapiypk/Zu9c1RKuVpCedawlVV/VAN0Ccpg9336OPABrFz67D8GcwxSN4LFnC41/7RWl9QaTrakaKSY/Nvt3u+riYbunMqV4HwewS+41Z34ELsOlZg/5JEOMg0ZxFilglgIXwSQs4DYfMQekUPARSwrMcc+d1VLS6kqS6qgx2JjrZclSUSCdzBgMjDG/YwS1Da5LveeNeSvGy4h/9X8S7bK7+Ffx9RWkbD8f0Yk66bPIWNt51u18yNhU7z8VmNUrT7I/nYEVYn/8ag/bOkepDkoT28oSCwXEaXfvsidjbiivaP7YoNVI/3sSajuEY4ac2clke6KORay8YbjaqWmiZ7dtWTQdmR3mfmcjqLJOtzdEtheQkMMV9pHHipSEo/TGUes7lZPPwXXF3ZOVTjC3zXTyJHUSDawiAbSaCHvsaRru1owBlK0lVZYHYXY1ctX7BmYuipq9S2JPGwJp/g==; 5:X4o3duriZIXj0sVv8o/ayPFDCzaiz8bfmBAQb4kRHB0oXNqN7uOWLMhcw61tX6WjWOj2RMH5o9OKyr87mTqqCTs3xeuH6KmZR+7XC2ZztIzTgdcvuF0iMgq3+1Ophe7AZXuJOksuh05rg/trHh/Tfb69Y4SfuWoEt61BLUqsLb8=; 24:IaAIibU619qvCwULZXRXokRP5YK2gejK8/R1LBx2/0Jq6aYq/qLDJ0VZPrAOmphNbg/xpOKuqVHi1j2h114jFwEw4iQaQpaZLt0xrVuZakM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 7:2+hFLq7iTfP9ZtOrEJ3eV9/yc+/KUl5W149DsEikdOatmgBp2eG1rbv4w+sQse3FrbA6RsKh75mvkKwPLPmjuZcN3gv0BkSjFkHQY+YxEJwaPkeopOIdx/cFiGmfpiokiW431P81gBSSVJzx4GwZ2T2+1p/PhX6fpMcyJ0FuSSVUzYuEeJojbfzonjy3jR0VinSB0Zni0UkaNJ3VzFWwWWlrqKhxZeajIq/09SRUqbY/lcd5Ykrd3Qjo0MgMG0as X-MS-Office365-Filtering-Correlation-Id: 696947eb-6938-47b9-8b40-08d5c0cb2149 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 16:35:00.8248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 696947eb-6938-47b9-8b40-08d5c0cb2149 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4185 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 Tests that the mirroring code catches up with deletion of a mirrored-to device. Signed-off-by: Petr Machata --- .../selftests/net/forwarding/mirror_gre_changes.sh | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh index 50ab346..a35fd55 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh @@ -12,6 +12,7 @@ ALL_TESTS=" test_tun_up test_egress_up test_remote_ip + test_tun_del " NUM_NETIFS=6 @@ -159,6 +160,35 @@ test_span_gre_remote_ip() log_test "$what: remote address change ($tcflags)" } +test_span_gre_tun_del() +{ + local tundev=$1; shift + local type=$1; shift + local flags=$1; shift + local local_ip=$1; shift + local remote_ip=$1; shift + local what=$1; shift + + RET=0 + + mirror_install $swp1 ingress $tundev "matchall $tcflags" + quick_test_span_gre_dir $tundev ingress + ip link del dev $tundev + fail_test_span_gre_dir $tundev ingress + + tunnel_create $tundev $type $local_ip $remote_ip \ + ttl 100 tos inherit $flags + + # Recreating the tunnel doesn't reestablish mirroring, so reinstall it + # and verify it works for the follow-up tests. + mirror_uninstall $swp1 ingress + mirror_install $swp1 ingress $tundev "matchall $tcflags" + quick_test_span_gre_dir $tundev ingress + mirror_uninstall $swp1 ingress + + log_test "$what: tunnel deleted ($tcflags)" +} + test_ttl() { test_span_gre_ttl gt4 gretap ip "mirror to gretap" @@ -183,6 +213,14 @@ test_remote_ip() test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "mirror to ip6gretap" } +test_tun_del() +{ + test_span_gre_tun_del gt4 gretap "" \ + 192.0.2.129 192.0.2.130 "mirror to gretap" + test_span_gre_tun_del gt6 ip6gretap allow-localremote \ + 2001:db8:2::1 2001:db8:2::2 "mirror to ip6gretap" +} + test_all() { slow_path_trap_install $swp1 ingress