Commit b3a7ee74 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

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: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 50a02b08
...@@ -68,6 +68,7 @@ export VXPORT ...@@ -68,6 +68,7 @@ export VXPORT
ping_ipv4 ping_ipv4
test_flood test_flood
test_unicast test_unicast
test_ttl
reapply_config reapply_config
ping_ipv4 ping_ipv4
test_flood test_flood
...@@ -474,6 +475,38 @@ test_unicast() ...@@ -474,6 +475,38 @@ test_unicast()
done 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() test_all()
{ {
echo "Running tests with UDP port $VXPORT" echo "Running tests with UDP port $VXPORT"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment