From patchwork Mon Nov 19 16:11:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10688865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 701DD1923 for ; Mon, 19 Nov 2018 16:11:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 606FA2A0DC for ; Mon, 19 Nov 2018 16:11:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54CFD2A0FD; Mon, 19 Nov 2018 16:11:33 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 EE01D2A0F8 for ; Mon, 19 Nov 2018 16:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730039AbeKTCfe (ORCPT ); Mon, 19 Nov 2018 21:35:34 -0500 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:28374 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730008AbeKTCfd (ORCPT ); Mon, 19 Nov 2018 21:35:33 -0500 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=pgVkGwHk+fQLrlh71wxOwYbNAwWmOtNmuIf3nkHWpwY=; b=otZIz9Y1CYnG0m9tLkX2/jUvRgmKkoWRitu5OxNiSV1eDbgMxxKpNG1N+0GyKJPtYMa1Pw7tTIlb9kDLn/e28fkAxUJ3b+4T9aheOfZTC/yjhSRWavvjA4lWHPw0LBqpyNpeEPiUph9R9AYGvgS6x+JNnloP1Ihcoeshi/cV/xc= Received: from AM0PR05MB4978.eurprd05.prod.outlook.com (20.177.42.95) by AM0PR05MB4899.eurprd05.prod.outlook.com (20.177.41.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.35; Mon, 19 Nov 2018 16:11:20 +0000 Received: from AM0PR05MB4978.eurprd05.prod.outlook.com ([fe80::f953:cde4:ff8d:501a]) by AM0PR05MB4978.eurprd05.prod.outlook.com ([fe80::f953:cde4:ff8d:501a%4]) with mapi id 15.20.1339.026; Mon, 19 Nov 2018 16:11:20 +0000 From: Ido Schimmel To: "netdev@vger.kernel.org" , "linux-kselftest@vger.kernel.org" CC: "davem@davemloft.net" , "shuah@kernel.org" , Jiri Pirko , Petr Machata , "roopa@cumulusnetworks.com" , mlxsw , Ido Schimmel Subject: [PATCH net-next 12/18] selftests: forwarding: vxlan_bridge_1d: Add a TTL test Thread-Topic: [PATCH net-next 12/18] selftests: forwarding: vxlan_bridge_1d: Add a TTL test Thread-Index: AQHUgCKC5VDUbpVC8kKXYRG59IJKzg== Date: Mon, 19 Nov 2018 16:11:20 +0000 Message-ID: <20181119161006.5405-13-idosch@mellanox.com> References: <20181119161006.5405-1-idosch@mellanox.com> In-Reply-To: <20181119161006.5405-1-idosch@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0601CA0031.eurprd06.prod.outlook.com (2603:10a6:203:68::17) To AM0PR05MB4978.eurprd05.prod.outlook.com (2603:10a6:208:d0::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM0PR05MB4899;6:D3VgO85N/bgbX154uJ3qU9PBiJBszUjLBoUbjoaovJ2KDr/NxCjJ7XfGLZrM89ZI6Qy4MeVgWG1qIyI4xuax4dmXqUvU//QnBD8Aqb3Thjm+HIDoq2y+N+oe8x9bms6rp4Hw3xlDYjJLXIVtRhD1SX1SQOvETfAkRqSp1jloYQH3VrBdBpyPgir4H98pNZiulmBGMOYHSJ7KDo1L2J6DTpCMlU+UF6zE57IqNzsRPjrBDn5tnIclIau9ImVLo0VxtfBhGwT/kBMDor7SSVqUwCprLEQusNRKlXDMt7ay5nXyZ5jGLBSK5LNchy+cf4H6ILTqNNCpA820XDjW82eg0uJ8JU+olyhMC6nsbs32LZMysbM1lQ41/pmuGcdUpI4MRux71NGPZ5nyyNqwCPSoGkSQd/5Pm+OwOlz7UXhQ6MdyFsf/xsGS8FFYzfexfHbgh4YD/aQBBa0w0UEXM5tvUA==;5:kilCo43VukPazUqB/zeNjFBuFcJ6cXt+ZDH5XmbI3sLV2uBU8O3CNaDp6iEkx/cGw/nUYXW1vK5VNNBV6c0sly0CWEq49pkLn5HSC83/a07RK3zI4jaLg52Zfl8qhlks+V+OVkxSXF8MUq88W+TZE7NeVqhOCcgcDfQfWNbj5hA=;7:OGHQiOelrcIFqOvS7rH9mDguLDZxGcHYoj/2uAsxT9Y1pmAxHwSTrWQ0OmE+QtoqTHGvljq1/PRSVtJK5DqLC7YGn5FtrRzBE+LqhX4mbvY1MlMSQfn0uoKqpuUG0jip2pxvvZVQ4l3i+VlKuk9q0A== x-ms-office365-filtering-correlation-id: d227dd59-5e30-444c-0b7d-08d64e39a4b2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR05MB4899; x-ms-traffictypediagnostic: AM0PR05MB4899: 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)(3231415)(944501410)(52105112)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:AM0PR05MB4899;BCL:0;PCL:0;RULEID:;SRVR:AM0PR05MB4899; x-forefront-prvs: 08617F610C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(346002)(366004)(136003)(396003)(199004)(189003)(8676002)(386003)(68736007)(26005)(14454004)(36756003)(8936002)(1076002)(102836004)(3846002)(6116002)(6506007)(4326008)(186003)(81166006)(81156014)(52116002)(25786009)(11346002)(110136005)(316002)(478600001)(54906003)(76176011)(2906002)(6512007)(107886003)(53936002)(99286004)(2616005)(2501003)(7736002)(575784001)(86362001)(446003)(66066001)(6436002)(476003)(5660300001)(305945005)(106356001)(256004)(105586002)(6486002)(97736004)(71200400001)(486006)(71190400001)(2900100001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR05MB4899;H:AM0PR05MB4978.eurprd05.prod.outlook.com;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-antispam-message-info: SGv7XN98DZC+/5/rzi6joH0gZkYLeCkxPXVxAuPrxfgzOGyRaFJG51FSk4donDja5ll8ZDXybBivTglTxKuQ36ZjIV5EsXIzsGqYdnSj3jSiz7ijImmwq6rFXNMPs2UGWxCM7R2rv0sikGq73Q+Am5fsZbBhAHp5jc2elHYtlhIWxOPYrLTxqPlKrcfBA2YJZhcvkuEHgAoPpJphaMwKIglriSHIuYdnvT8cwg/jS18OyQ12pd7+bmUm0CU01Q54TCqo90oX0NUtlmphZTCP94X/qrDgS0AnLLV6BtWwZvcJuOyaAa6I0vTvPNuMt9M5+yXc6aTamje5bZmjFttyqdFUqvNKQRzR6SDCyJJb+o8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d227dd59-5e30-444c-0b7d-08d64e39a4b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2018 16:11:20.6460 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4899 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 From: Petr Machata This tests whether TTL of VXLAN envelope packets is properly set based on the device configuration. Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel --- .../net/forwarding/vxlan_bridge_1d.sh | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh index a943d8da14b9..0c17b0d427ba 100755 --- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh @@ -68,6 +68,7 @@ export VXPORT ping_ipv4 test_flood test_unicast + test_ttl reapply_config ping_ipv4 test_flood @@ -474,6 +475,38 @@ test_unicast() done } +vxlan_ping_test() +{ + local ping_dev=$1; shift + local ping_dip=$1; shift + local ping_args=$1; shift + local capture_dev=$1; shift + local capture_dir=$1; shift + local capture_pref=$1; shift + local expect=$1; shift + + local t0=$(tc_rule_stats_get $capture_dev $capture_pref $capture_dir) + ping_do $ping_dev $ping_dip "$ping_args" + local t1=$(tc_rule_stats_get $capture_dev $capture_pref $capture_dir) + local delta=$((t1 - t0)) + + # Tolerate a couple stray extra packets. + ((expect <= delta && delta <= expect + 2)) + check_err $? "$capture_dev: Expected to capture $expect packets, got $delta." +} + +test_ttl() +{ + RET=0 + + tc filter add dev v1 egress pref 77 prot ip \ + flower ip_ttl 99 action pass + vxlan_ping_test $h1 192.0.2.3 "" v1 egress 77 10 + tc filter del dev v1 egress pref 77 prot ip + + log_test "VXLAN: envelope TTL" +} + test_all() { echo "Running tests with UDP port $VXPORT"