aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-11-19 16:11:20 +0000
committerDavid S. Miller <davem@davemloft.net>2018-11-19 17:59:44 -0800
commitb3a7ee74ee659c789b6e6254d0839789477f5c3e (patch)
treeca678f48a60699c495e864b75f7351dc46400185 /tools
parentselftests: forwarding: vxlan_bridge_1d: Reconfigure & rerun tests (diff)
downloadlinux-dev-b3a7ee74ee659c789b6e6254d0839789477f5c3e.tar.xz
linux-dev-b3a7ee74ee659c789b6e6254d0839789477f5c3e.zip
selftests: forwarding: vxlan_bridge_1d: Add a TTL test
This tests whether TTL of VXLAN envelope packets is properly set based on the device configuration. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh33
1 files changed, 33 insertions, 0 deletions
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"