From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next 12/18] selftests: forwarding: vxlan_bridge_1d: Add a TTL test Date: Mon, 19 Nov 2018 16:11:20 +0000 Message-ID: <20181119161006.5405-13-idosch@mellanox.com> References: <20181119161006.5405-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "davem@davemloft.net" , "shuah@kernel.org" , Jiri Pirko , Petr Machata , "roopa@cumulusnetworks.com" , mlxsw , Ido Schimmel To: "netdev@vger.kernel.org" , "linux-kselftest@vger.kernel.org" Return-path: 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 In-Reply-To: <20181119161006.5405-1-idosch@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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/to= ols/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 } =20 +vxlan_ping_test() +{ + local ping_dev=3D$1; shift + local ping_dip=3D$1; shift + local ping_args=3D$1; shift + local capture_dev=3D$1; shift + local capture_dir=3D$1; shift + local capture_pref=3D$1; shift + local expect=3D$1; shift + + local t0=3D$(tc_rule_stats_get $capture_dev $capture_pref $capture_dir) + ping_do $ping_dev $ping_dip "$ping_args" + local t1=3D$(tc_rule_stats_get $capture_dev $capture_pref $capture_dir) + local delta=3D$((t1 - t0)) + + # Tolerate a couple stray extra packets. + ((expect <=3D delta && delta <=3D expect + 2)) + check_err $? "$capture_dev: Expected to capture $expect packets, got $del= ta." +} + +test_ttl() +{ + RET=3D0 + + 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" --=20 2.19.1