Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test

The mirror_gre_scale test creates as many ERSPAN sessions as the underlying
chip supports, and tests that they all work. In order to determine that it
issues a stream of ICMP packets and checks if they are mirrored as
expected.

However, the mausezahn invocation missed the -6 flag to identify the use of
IPv6 protocol, and was sending ICMP messages over IPv6, as opposed to
ICMP6. It also didn't pass an explicit source IP address, which apparently
worked at some point in the past, but does not anymore.

To fix these issues, extend the function mirror_test() in mirror_lib by
detecting the IPv6 protocol addresses, and using a different ICMP scheme.
Fix __mirror_gre_test() in the selftest itself to pass a source IP address.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Machata and committed by
David S. Miller
1233898a dda7f4fa

+19 -3
+2 -1
tools/testing/selftests/drivers/net/mlxsw/mirror_gre_scale.sh
··· 120 120 sleep 5 121 121 122 122 for ((i = 0; i < count; ++i)); do 123 + local sip=$(mirror_gre_ipv6_addr 1 $i)::1 123 124 local dip=$(mirror_gre_ipv6_addr 1 $i)::2 124 125 local htun=h3-gt6-$i 125 126 local message 126 127 127 128 icmp6_capture_install $htun 128 - mirror_test v$h1 "" $dip $htun 100 10 129 + mirror_test v$h1 $sip $dip $htun 100 10 129 130 icmp6_capture_uninstall $htun 130 131 done 131 132 }
+17 -2
tools/testing/selftests/net/forwarding/mirror_lib.sh
··· 20 20 tc filter del dev $swp1 $direction pref 1000 21 21 } 22 22 23 + is_ipv6() 24 + { 25 + local addr=$1; shift 26 + 27 + [[ -z ${addr//[0-9a-fA-F:]/} ]] 28 + } 29 + 23 30 mirror_test() 24 31 { 25 32 local vrf_name=$1; shift ··· 36 29 local pref=$1; shift 37 30 local expect=$1; shift 38 31 32 + if is_ipv6 $dip; then 33 + local proto=-6 34 + local type="icmp6 type=128" # Echo request. 35 + else 36 + local proto= 37 + local type="icmp echoreq" 38 + fi 39 + 39 40 local t0=$(tc_rule_stats_get $dev $pref) 40 - $MZ $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \ 41 - -c 10 -d 100msec -t icmp type=8 41 + $MZ $proto $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \ 42 + -c 10 -d 100msec -t $type 42 43 sleep 0.5 43 44 local t1=$(tc_rule_stats_get $dev $pref) 44 45 local delta=$((t1 - t0))