Merge branch 'net-selftests-mirroring-cleanup' into main
Petr Machata says: ==================== selftest: Clean-up and stabilize mirroring tests The mirroring selftests work by sending ICMP traffic between two hosts. Along the way, this traffic is mirrored to a gretap netdevice, and counter taps are then installed strategically along the path of the mirrored traffic to verify the mirroring took place. The problem with this is that besides mirroring the primary traffic, any other service traffic is mirrored as well. At the same time, because the tests need to work in HW-offloaded scenarios, the ability of the device to do arbitrary packet inspection should not be taken for granted. Most tests therefore simply use matchall, one uses flower to match on IP address. As a result, the selftests are noisy. mirror_test() accommodated this noisiness by giving the counters an allowance of several packets. But that only works up to a point, and on busy systems won't be always enough. In this patch set, clean up and stabilize the mirroring selftests. The original intention was to port the tests over to UDP, but the logic of ICMP ends up being so entangled in the mirroring selftests that the changes feel overly invasive. Instead, ICMP is kept, but where possible, we match on ICMP message type, thus filtering out hits by other ICMP messages. Where this is not practical (where the counter tap is put on a device that carries encapsulated packets), switch the counter condition to _at least_ X observed packets. This is less robust, but barely so -- probably the only scenario that this would not catch is something like erroneous packet duplication, which would hopefully get caught by the numerous other tests in this extensive suite. - Patches #1 to #3 clean up parameters at various helpers. - Patches #4 to #6 stabilize the mirroring selftests as described above. - Mirroring tests currently allow testing SW datapath even on HW netdevices by trapping traffic to the SW datapath. This complicates the tests a bit without a good reason: to test SW datapath, just run the selftests on the veth topology. Thus in patch #7, drop support for this dual SW/HW testing. - At this point, some cleanups were either made possible by the previous patches, or were always possible. In patches #8 to #11, realize these cleanups. - In patch #12, fix mlxsw mirror_gre selftest to respect setting TESTS. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
748e3bbf47
@ -15,6 +15,13 @@ source $lib_dir/mirror_lib.sh
|
||||
source $lib_dir/mirror_gre_lib.sh
|
||||
source $lib_dir/mirror_gre_topo_lib.sh
|
||||
|
||||
ALL_TESTS="
|
||||
test_keyful
|
||||
test_soft
|
||||
test_tos_fixed
|
||||
test_ttl_inherit
|
||||
"
|
||||
|
||||
setup_keyful()
|
||||
{
|
||||
tunnel_create gt6-key ip6gretap 2001:db8:3::1 2001:db8:3::2 \
|
||||
@ -118,15 +125,15 @@ test_span_gre_ttl_inherit()
|
||||
RET=0
|
||||
|
||||
ip link set dev $tundev type $type ttl inherit
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
ip link set dev $tundev type $type ttl 100
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: no offload on TTL of inherit ($tcflags)"
|
||||
log_test "$what: no offload on TTL of inherit"
|
||||
}
|
||||
|
||||
test_span_gre_tos_fixed()
|
||||
@ -138,61 +145,49 @@ test_span_gre_tos_fixed()
|
||||
RET=0
|
||||
|
||||
ip link set dev $tundev type $type tos 0x10
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
ip link set dev $tundev type $type tos inherit
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: no offload on a fixed TOS ($tcflags)"
|
||||
log_test "$what: no offload on a fixed TOS"
|
||||
}
|
||||
|
||||
test_span_failable()
|
||||
{
|
||||
local should_fail=$1; shift
|
||||
local tundev=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
if ((should_fail)); then
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
else
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
fi
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: should_fail=$should_fail ($tcflags)"
|
||||
log_test "fail $what"
|
||||
}
|
||||
|
||||
test_failable()
|
||||
test_keyful()
|
||||
{
|
||||
local should_fail=$1; shift
|
||||
|
||||
test_span_failable $should_fail gt6-key "mirror to keyful gretap"
|
||||
test_span_failable $should_fail gt6-soft "mirror to gretap w/ soft underlay"
|
||||
test_span_failable gt6-key "mirror to keyful gretap"
|
||||
}
|
||||
|
||||
test_sw()
|
||||
test_soft()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
test_failable 0
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
test_span_failable gt6-soft "mirror to gretap w/ soft underlay"
|
||||
}
|
||||
|
||||
test_hw()
|
||||
test_tos_fixed()
|
||||
{
|
||||
test_failable 1
|
||||
|
||||
test_span_gre_tos_fixed gt4 gretap "mirror to gretap"
|
||||
test_span_gre_tos_fixed gt6 ip6gretap "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
|
||||
test_ttl_inherit()
|
||||
{
|
||||
test_span_gre_ttl_inherit gt4 gretap "mirror to gretap"
|
||||
test_span_gre_ttl_inherit gt6 ip6gretap "mirror to ip6gretap"
|
||||
}
|
||||
@ -202,16 +197,6 @@ trap cleanup EXIT
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
if ! tc_offload_check; then
|
||||
check_err 1 "Could not test offloaded functionality"
|
||||
log_test "mlxsw-specific tests for mirror to gretap"
|
||||
exit
|
||||
fi
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_sw
|
||||
|
||||
tcflags="skip_sw"
|
||||
test_hw
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -79,7 +79,7 @@ mirror_gre_tunnels_create()
|
||||
cat >> $MIRROR_GRE_BATCH_FILE <<-EOF
|
||||
filter add dev $swp1 ingress pref 1000 \
|
||||
protocol ipv6 \
|
||||
flower $tcflags dst_ip $match_dip \
|
||||
flower skip_sw dst_ip $match_dip \
|
||||
action mirred egress mirror dev $tun
|
||||
EOF
|
||||
done
|
||||
@ -107,7 +107,7 @@ mirror_gre_tunnels_destroy()
|
||||
done
|
||||
}
|
||||
|
||||
__mirror_gre_test()
|
||||
mirror_gre_test()
|
||||
{
|
||||
local count=$1; shift
|
||||
local should_fail=$1; shift
|
||||
@ -131,20 +131,6 @@ __mirror_gre_test()
|
||||
done
|
||||
}
|
||||
|
||||
mirror_gre_test()
|
||||
{
|
||||
local count=$1; shift
|
||||
local should_fail=$1; shift
|
||||
|
||||
if ! tc_offload_check $TC_FLOWER_NUM_NETIFS; then
|
||||
check_err 1 "Could not test offloaded functionality"
|
||||
return
|
||||
fi
|
||||
|
||||
tcflags="skip_sw"
|
||||
__mirror_gre_test $count $should_fail
|
||||
}
|
||||
|
||||
mirror_gre_setup_prepare()
|
||||
{
|
||||
h1=${NETIFS[p1]}
|
||||
|
@ -1225,22 +1225,6 @@ trap_uninstall()
|
||||
tc filter del dev $dev $direction pref 1 flower
|
||||
}
|
||||
|
||||
slow_path_trap_install()
|
||||
{
|
||||
# For slow-path testing, we need to install a trap to get to
|
||||
# slow path the packets that would otherwise be switched in HW.
|
||||
if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
|
||||
trap_install "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
slow_path_trap_uninstall()
|
||||
{
|
||||
if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
|
||||
trap_uninstall "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
__icmp_capture_add_del()
|
||||
{
|
||||
local add_del=$1; shift
|
||||
@ -1257,22 +1241,34 @@ __icmp_capture_add_del()
|
||||
|
||||
icmp_capture_install()
|
||||
{
|
||||
__icmp_capture_add_del add 100 "" "$@"
|
||||
local tundev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__icmp_capture_add_del add 100 "" "$tundev" "$filter"
|
||||
}
|
||||
|
||||
icmp_capture_uninstall()
|
||||
{
|
||||
__icmp_capture_add_del del 100 "" "$@"
|
||||
local tundev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__icmp_capture_add_del del 100 "" "$tundev" "$filter"
|
||||
}
|
||||
|
||||
icmp6_capture_install()
|
||||
{
|
||||
__icmp_capture_add_del add 100 v6 "$@"
|
||||
local tundev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__icmp_capture_add_del add 100 v6 "$tundev" "$filter"
|
||||
}
|
||||
|
||||
icmp6_capture_uninstall()
|
||||
{
|
||||
__icmp_capture_add_del del 100 v6 "$@"
|
||||
local tundev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__icmp_capture_add_del del 100 v6 "$tundev" "$filter"
|
||||
}
|
||||
|
||||
__vlan_capture_add_del()
|
||||
@ -1290,12 +1286,18 @@ __vlan_capture_add_del()
|
||||
|
||||
vlan_capture_install()
|
||||
{
|
||||
__vlan_capture_add_del add 100 "$@"
|
||||
local dev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__vlan_capture_add_del add 100 "$dev" "$filter"
|
||||
}
|
||||
|
||||
vlan_capture_uninstall()
|
||||
{
|
||||
__vlan_capture_add_del del 100 "$@"
|
||||
local dev=$1; shift
|
||||
local filter=$1; shift
|
||||
|
||||
__vlan_capture_add_del del 100 "$dev" "$filter"
|
||||
}
|
||||
|
||||
__dscp_capture_add_del()
|
||||
@ -1655,34 +1657,61 @@ __start_traffic()
|
||||
local sip=$1; shift
|
||||
local dip=$1; shift
|
||||
local dmac=$1; shift
|
||||
local -a mz_args=("$@")
|
||||
|
||||
$MZ $h_in -p $pktsize -A $sip -B $dip -c 0 \
|
||||
-a own -b $dmac -t "$proto" -q "$@" &
|
||||
-a own -b $dmac -t "$proto" -q "${mz_args[@]}" &
|
||||
sleep 1
|
||||
}
|
||||
|
||||
start_traffic_pktsize()
|
||||
{
|
||||
local pktsize=$1; shift
|
||||
local h_in=$1; shift
|
||||
local sip=$1; shift
|
||||
local dip=$1; shift
|
||||
local dmac=$1; shift
|
||||
local -a mz_args=("$@")
|
||||
|
||||
__start_traffic $pktsize udp "$@"
|
||||
__start_traffic $pktsize udp "$h_in" "$sip" "$dip" "$dmac" \
|
||||
"${mz_args[@]}"
|
||||
}
|
||||
|
||||
start_tcp_traffic_pktsize()
|
||||
{
|
||||
local pktsize=$1; shift
|
||||
local h_in=$1; shift
|
||||
local sip=$1; shift
|
||||
local dip=$1; shift
|
||||
local dmac=$1; shift
|
||||
local -a mz_args=("$@")
|
||||
|
||||
__start_traffic $pktsize tcp "$@"
|
||||
__start_traffic $pktsize tcp "$h_in" "$sip" "$dip" "$dmac" \
|
||||
"${mz_args[@]}"
|
||||
}
|
||||
|
||||
start_traffic()
|
||||
{
|
||||
start_traffic_pktsize 8000 "$@"
|
||||
local h_in=$1; shift
|
||||
local sip=$1; shift
|
||||
local dip=$1; shift
|
||||
local dmac=$1; shift
|
||||
local -a mz_args=("$@")
|
||||
|
||||
start_traffic_pktsize 8000 "$h_in" "$sip" "$dip" "$dmac" \
|
||||
"${mz_args[@]}"
|
||||
}
|
||||
|
||||
start_tcp_traffic()
|
||||
{
|
||||
start_tcp_traffic_pktsize 8000 "$@"
|
||||
local h_in=$1; shift
|
||||
local sip=$1; shift
|
||||
local dip=$1; shift
|
||||
local dmac=$1; shift
|
||||
local -a mz_args=("$@")
|
||||
|
||||
start_tcp_traffic_pktsize 8000 "$h_in" "$sip" "$dip" "$dmac" \
|
||||
"${mz_args[@]}"
|
||||
}
|
||||
|
||||
stop_traffic()
|
||||
|
@ -74,7 +74,7 @@ test_span_gre_mac()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $tundev "matchall $tcflags"
|
||||
mirror_install $swp1 $direction $tundev "matchall"
|
||||
icmp_capture_install h3-${tundev} "src_mac $src_mac dst_mac $dst_mac"
|
||||
|
||||
mirror_test v$h1 192.0.2.1 192.0.2.2 h3-${tundev} 100 10
|
||||
@ -82,29 +82,29 @@ test_span_gre_mac()
|
||||
icmp_capture_uninstall h3-${tundev}
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction $what: envelope MAC ($tcflags)"
|
||||
log_test "$direction $what: envelope MAC"
|
||||
}
|
||||
|
||||
test_two_spans()
|
||||
{
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress gt4 "matchall $tcflags"
|
||||
mirror_install $swp1 egress gt6 "matchall $tcflags"
|
||||
quick_test_span_gre_dir gt4 ingress
|
||||
quick_test_span_gre_dir gt6 egress
|
||||
mirror_install $swp1 ingress gt4 "matchall"
|
||||
mirror_install $swp1 egress gt6 "matchall"
|
||||
quick_test_span_gre_dir gt4 8 0
|
||||
quick_test_span_gre_dir gt6 0 8
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
fail_test_span_gre_dir gt4 ingress
|
||||
quick_test_span_gre_dir gt6 egress
|
||||
fail_test_span_gre_dir gt4 8 0
|
||||
quick_test_span_gre_dir gt6 0 8
|
||||
|
||||
mirror_install $swp1 ingress gt4 "matchall $tcflags"
|
||||
mirror_install $swp1 ingress gt4 "matchall"
|
||||
mirror_uninstall $swp1 egress
|
||||
quick_test_span_gre_dir gt4 ingress
|
||||
fail_test_span_gre_dir gt6 egress
|
||||
quick_test_span_gre_dir gt4 8 0
|
||||
fail_test_span_gre_dir gt6 0 8
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
log_test "two simultaneously configured mirrors ($tcflags)"
|
||||
log_test "two simultaneously configured mirrors"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
@ -131,30 +131,11 @@ test_ip6gretap_mac()
|
||||
test_span_gre_mac gt6 egress "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -196,32 +196,11 @@ test_ip6gretap()
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap w/ UL"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
RET=0
|
||||
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -108,30 +108,11 @@ test_ip6gretap()
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -104,30 +104,11 @@ test_ip6gretap_stp()
|
||||
full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -104,30 +104,11 @@ test_ip6gretap()
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
tests()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
tests
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
tests
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -227,10 +227,10 @@ test_lag_slave()
|
||||
RET=0
|
||||
|
||||
tc filter add dev $swp1 ingress pref 999 \
|
||||
proto 802.1q flower vlan_ethtype arp $tcflags \
|
||||
proto 802.1q flower vlan_ethtype arp \
|
||||
action pass
|
||||
mirror_install $swp1 ingress gt4 \
|
||||
"proto 802.1q flower vlan_id 333 $tcflags"
|
||||
"proto 802.1q flower vlan_id 333"
|
||||
|
||||
# Test connectivity through $up_dev when $down_dev is set down.
|
||||
ip link set dev $down_dev down
|
||||
@ -239,7 +239,7 @@ test_lag_slave()
|
||||
setup_wait_dev $host_dev
|
||||
$ARPING -I br1 192.0.2.130 -qfc 1
|
||||
sleep 2
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 10
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 ">= 10"
|
||||
|
||||
# Test lack of connectivity when both slaves are down.
|
||||
ip link set dev $up_dev down
|
||||
@ -252,7 +252,7 @@ test_lag_slave()
|
||||
mirror_uninstall $swp1 ingress
|
||||
tc filter del dev $swp1 ingress pref 999
|
||||
|
||||
log_test "$what ($tcflags)"
|
||||
log_test "$what"
|
||||
}
|
||||
|
||||
test_mirror_gretap_first()
|
||||
@ -265,30 +265,11 @@ test_mirror_gretap_second()
|
||||
test_lag_slave $h4 $swp4 $swp3 "mirror to gretap: LAG second slave"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -73,7 +73,7 @@ test_span_gre_ttl()
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev \
|
||||
"prot ip flower $tcflags ip_prot icmp"
|
||||
"prot ip flower ip_prot icmp"
|
||||
tc filter add dev $h3 ingress pref 77 prot $prot \
|
||||
flower skip_hw ip_ttl 50 action pass
|
||||
|
||||
@ -81,13 +81,13 @@ test_span_gre_ttl()
|
||||
|
||||
ip link set dev $tundev type $type ttl 50
|
||||
sleep 2
|
||||
mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10
|
||||
mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 ">= 10"
|
||||
|
||||
ip link set dev $tundev type $type ttl 100
|
||||
tc filter del dev $h3 ingress pref 77
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: TTL change ($tcflags)"
|
||||
log_test "$what: TTL change"
|
||||
}
|
||||
|
||||
test_span_gre_tun_up()
|
||||
@ -98,15 +98,15 @@ test_span_gre_tun_up()
|
||||
RET=0
|
||||
|
||||
ip link set dev $tundev down
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
ip link set dev $tundev up
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: tunnel down/up ($tcflags)"
|
||||
log_test "$what: tunnel down/up"
|
||||
}
|
||||
|
||||
test_span_gre_egress_up()
|
||||
@ -118,8 +118,8 @@ test_span_gre_egress_up()
|
||||
RET=0
|
||||
|
||||
ip link set dev $swp3 down
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
# After setting the device up, wait for neighbor to get resolved so that
|
||||
# we can expect mirroring to work.
|
||||
@ -127,10 +127,10 @@ test_span_gre_egress_up()
|
||||
setup_wait_dev $swp3
|
||||
ping -c 1 -I $swp3 $remote_ip &>/dev/null
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: egress down/up ($tcflags)"
|
||||
log_test "$what: egress down/up"
|
||||
}
|
||||
|
||||
test_span_gre_remote_ip()
|
||||
@ -144,14 +144,14 @@ test_span_gre_remote_ip()
|
||||
RET=0
|
||||
|
||||
ip link set dev $tundev type $type remote $wrong_ip
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
ip link set dev $tundev type $type remote $correct_ip
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: remote address change ($tcflags)"
|
||||
log_test "$what: remote address change"
|
||||
}
|
||||
|
||||
test_span_gre_tun_del()
|
||||
@ -165,10 +165,10 @@ test_span_gre_tun_del()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
ip link del dev $tundev
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
tunnel_create $tundev $type $local_ip $remote_ip \
|
||||
ttl 100 tos inherit $flags
|
||||
@ -176,11 +176,11 @@ test_span_gre_tun_del()
|
||||
# Recreating the tunnel doesn't reestablish mirroring, so reinstall it
|
||||
# and verify it works for the follow-up tests.
|
||||
mirror_uninstall $swp1 ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: tunnel deleted ($tcflags)"
|
||||
log_test "$what: tunnel deleted"
|
||||
}
|
||||
|
||||
test_span_gre_route_del()
|
||||
@ -192,18 +192,18 @@ test_span_gre_route_del()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
ip route del $route dev $edev
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
ip route add $route dev $edev
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: underlay route removal ($tcflags)"
|
||||
log_test "$what: underlay route removal"
|
||||
}
|
||||
|
||||
test_ttl()
|
||||
@ -244,30 +244,11 @@ test_route_del()
|
||||
test_span_gre_route_del gt6 $swp3 2001:db8:2::/64 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -64,12 +64,19 @@ cleanup()
|
||||
|
||||
test_span_gre_dir_acl()
|
||||
{
|
||||
test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4
|
||||
local tundev=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
|
||||
test_span_gre_dir_ips "$tundev" "$forward_type" \
|
||||
"$backward_type" 192.0.2.3 192.0.2.4
|
||||
}
|
||||
|
||||
fail_test_span_gre_dir_acl()
|
||||
{
|
||||
fail_test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4
|
||||
local tundev=$1; shift
|
||||
|
||||
fail_test_span_gre_dir_ips "$tundev" 192.0.2.3 192.0.2.4
|
||||
}
|
||||
|
||||
full_test_span_gre_dir_acl()
|
||||
@ -84,16 +91,15 @@ full_test_span_gre_dir_acl()
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $tundev \
|
||||
"protocol ip flower $tcflags dst_ip $match_dip"
|
||||
fail_test_span_gre_dir $tundev $direction
|
||||
test_span_gre_dir_acl "$tundev" "$direction" \
|
||||
"$forward_type" "$backward_type"
|
||||
"protocol ip flower dst_ip $match_dip"
|
||||
fail_test_span_gre_dir $tundev
|
||||
test_span_gre_dir_acl "$tundev" "$forward_type" "$backward_type"
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
# Test lack of mirroring after ACL mirror is uninstalled.
|
||||
fail_test_span_gre_dir_acl "$tundev" "$direction"
|
||||
fail_test_span_gre_dir_acl "$tundev"
|
||||
|
||||
log_test "$direction $what ($tcflags)"
|
||||
log_test "$direction $what"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
@ -108,30 +114,11 @@ test_ip6gretap()
|
||||
full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -37,8 +37,14 @@
|
||||
# | \ / |
|
||||
# | \____________________________________________/ |
|
||||
# | | |
|
||||
# | + lag2 (team) |
|
||||
# | 192.0.2.130/28 |
|
||||
# | + lag2 (team) ------> + gt4-dst (gretap) |
|
||||
# | 192.0.2.130/28 loc=192.0.2.130 |
|
||||
# | rem=192.0.2.129 |
|
||||
# | ttl=100 |
|
||||
# | tos=inherit |
|
||||
# | |
|
||||
# | |
|
||||
# | |
|
||||
# | |
|
||||
# +---------------------------------------------------------------------------+
|
||||
|
||||
@ -50,9 +56,6 @@ ALL_TESTS="
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
source mirror_gre_lib.sh
|
||||
|
||||
require_command $ARPING
|
||||
|
||||
vlan_host_create()
|
||||
{
|
||||
@ -122,16 +125,21 @@ h3_create()
|
||||
{
|
||||
vrf_create vrf-h3
|
||||
ip link set dev vrf-h3 up
|
||||
tc qdisc add dev $h3 clsact
|
||||
tc qdisc add dev $h4 clsact
|
||||
h3_create_team
|
||||
|
||||
tunnel_create gt4-dst gretap 192.0.2.130 192.0.2.129 \
|
||||
ttl 100 tos inherit
|
||||
ip link set dev gt4-dst master vrf-h3
|
||||
tc qdisc add dev gt4-dst clsact
|
||||
}
|
||||
|
||||
h3_destroy()
|
||||
{
|
||||
tc qdisc del dev gt4-dst clsact
|
||||
ip link set dev gt4-dst nomaster
|
||||
tunnel_destroy gt4-dst
|
||||
|
||||
h3_destroy_team
|
||||
tc qdisc del dev $h4 clsact
|
||||
tc qdisc del dev $h3 clsact
|
||||
ip link set dev vrf-h3 down
|
||||
vrf_destroy vrf-h3
|
||||
}
|
||||
@ -188,18 +196,12 @@ setup_prepare()
|
||||
h2_create
|
||||
h3_create
|
||||
switch_create
|
||||
|
||||
trap_install $h3 ingress
|
||||
trap_install $h4 ingress
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
pre_cleanup
|
||||
|
||||
trap_uninstall $h4 ingress
|
||||
trap_uninstall $h3 ingress
|
||||
|
||||
switch_destroy
|
||||
h3_destroy
|
||||
h2_destroy
|
||||
@ -218,7 +220,8 @@ test_lag_slave()
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress gt4 \
|
||||
"proto 802.1q flower vlan_id 333 $tcflags"
|
||||
"proto 802.1q flower vlan_id 333"
|
||||
vlan_capture_install gt4-dst "vlan_ethtype ipv4 ip_proto icmp type 8"
|
||||
|
||||
# Move $down_dev away from the team. That will prompt change in
|
||||
# txability of the connected device, without changing its upness. The
|
||||
@ -226,13 +229,14 @@ test_lag_slave()
|
||||
# other slave.
|
||||
ip link set dev $down_dev nomaster
|
||||
sleep 2
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $up_dev 1 10
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 gt4-dst 100 10
|
||||
|
||||
# Test lack of connectivity when neither slave is txable.
|
||||
ip link set dev $up_dev nomaster
|
||||
sleep 2
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h3 1 0
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h4 1 0
|
||||
mirror_test vrf-h1 192.0.2.1 192.0.2.18 gt4-dst 100 0
|
||||
|
||||
vlan_capture_uninstall gt4-dst
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
# Recreate H3's team device, because mlxsw, which this test is
|
||||
@ -243,7 +247,7 @@ test_lag_slave()
|
||||
# Wait for ${h,swp}{3,4}.
|
||||
setup_wait
|
||||
|
||||
log_test "$what ($tcflags)"
|
||||
log_test "$what"
|
||||
}
|
||||
|
||||
test_mirror_gretap_first()
|
||||
@ -256,30 +260,11 @@ test_mirror_gretap_second()
|
||||
test_lag_slave $h4 $h3 "mirror to gretap: LAG second slave"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -5,22 +5,34 @@ source "$net_forwarding_dir/mirror_lib.sh"
|
||||
quick_test_span_gre_dir_ips()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
|
||||
do_test_span_dir_ips 10 h3-$tundev "$@"
|
||||
do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2" \
|
||||
"$forward_type" "$backward_type"
|
||||
}
|
||||
|
||||
fail_test_span_gre_dir_ips()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
do_test_span_dir_ips 0 h3-$tundev "$@"
|
||||
do_test_span_dir_ips 0 h3-$tundev "$ip1" "$ip2"
|
||||
}
|
||||
|
||||
test_span_gre_dir_ips()
|
||||
{
|
||||
local tundev=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
test_span_dir_ips h3-$tundev "$@"
|
||||
test_span_dir_ips h3-$tundev "$forward_type" \
|
||||
"$backward_type" "$ip1" "$ip2"
|
||||
}
|
||||
|
||||
full_test_span_gre_dir_ips()
|
||||
@ -35,12 +47,12 @@ full_test_span_gre_dir_ips()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $tundev "matchall $tcflags"
|
||||
test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
|
||||
mirror_install $swp1 $direction $tundev "matchall"
|
||||
test_span_dir_ips "h3-$tundev" "$forward_type" \
|
||||
"$backward_type" "$ip1" "$ip2"
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction $what ($tcflags)"
|
||||
log_test "$direction $what"
|
||||
}
|
||||
|
||||
full_test_span_gre_dir_vlan_ips()
|
||||
@ -56,45 +68,63 @@ full_test_span_gre_dir_vlan_ips()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $tundev "matchall $tcflags"
|
||||
mirror_install $swp1 $direction $tundev "matchall"
|
||||
|
||||
test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
|
||||
test_span_dir_ips "h3-$tundev" "$forward_type" \
|
||||
"$backward_type" "$ip1" "$ip2"
|
||||
|
||||
tc filter add dev $h3 ingress pref 77 prot 802.1q \
|
||||
flower $vlan_match \
|
||||
action pass
|
||||
mirror_test v$h1 $ip1 $ip2 $h3 77 10
|
||||
mirror_test v$h1 $ip1 $ip2 $h3 77 '>= 10'
|
||||
tc filter del dev $h3 ingress pref 77
|
||||
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction $what ($tcflags)"
|
||||
log_test "$direction $what"
|
||||
}
|
||||
|
||||
quick_test_span_gre_dir()
|
||||
{
|
||||
quick_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local tundev=$1; shift
|
||||
local forward_type=${1-8}; shift
|
||||
local backward_type=${1-0}; shift
|
||||
|
||||
quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 \
|
||||
"$forward_type" "$backward_type"
|
||||
}
|
||||
|
||||
fail_test_span_gre_dir()
|
||||
{
|
||||
fail_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
local tundev=$1; shift
|
||||
|
||||
test_span_gre_dir()
|
||||
{
|
||||
test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
fail_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
full_test_span_gre_dir()
|
||||
{
|
||||
full_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local tundev=$1; shift
|
||||
local direction=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
full_test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \
|
||||
"$backward_type" "$what" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
full_test_span_gre_dir_vlan()
|
||||
{
|
||||
full_test_span_gre_dir_vlan_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local tundev=$1; shift
|
||||
local direction=$1; shift
|
||||
local vlan_match=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
full_test_span_gre_dir_vlan_ips "$tundev" "$direction" "$vlan_match" \
|
||||
"$forward_type" "$backward_type" \
|
||||
"$what" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
full_test_span_gre_stp_ips()
|
||||
@ -104,27 +134,39 @@ full_test_span_gre_stp_ips()
|
||||
local what=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local h3mac=$(mac_get $h3)
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \
|
||||
"$forward_type" "$backward_type"
|
||||
|
||||
bridge link set dev $nbpdev state disabled
|
||||
sleep 1
|
||||
fail_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
fail_test_span_gre_dir_ips $tundev $ip1 $ip2
|
||||
|
||||
bridge link set dev $nbpdev state forwarding
|
||||
sleep 1
|
||||
quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
|
||||
quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \
|
||||
"$forward_type" "$backward_type"
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: STP state ($tcflags)"
|
||||
log_test "$what: STP state"
|
||||
}
|
||||
|
||||
full_test_span_gre_stp()
|
||||
{
|
||||
full_test_span_gre_stp_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local tundev=$1; shift
|
||||
local nbpdev=$1; shift
|
||||
local what=$1; shift
|
||||
local forward_type=${1-8}; shift
|
||||
local backward_type=${1-0}; shift
|
||||
|
||||
full_test_span_gre_stp_ips "$tundev" "$nbpdev" "$what" \
|
||||
192.0.2.1 192.0.2.2 \
|
||||
"$forward_type" "$backward_type"
|
||||
}
|
||||
|
@ -60,41 +60,32 @@ test_span_gre_neigh()
|
||||
local addr=$1; shift
|
||||
local tundev=$1; shift
|
||||
local direction=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local what=$1; shift
|
||||
|
||||
RET=0
|
||||
|
||||
ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:55
|
||||
mirror_install $swp1 $direction $tundev "matchall $tcflags"
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 $direction $tundev "matchall"
|
||||
fail_test_span_gre_dir $tundev "$forward_type" "$backward_type"
|
||||
ip neigh del dev $swp3 $addr
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev "$forward_type" "$backward_type"
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction $what: neighbor change ($tcflags)"
|
||||
log_test "$direction $what: neighbor change"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
{
|
||||
test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap"
|
||||
test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap"
|
||||
test_span_gre_neigh 192.0.2.130 gt4 ingress 8 0 "mirror to gretap"
|
||||
test_span_gre_neigh 192.0.2.130 gt4 egress 0 8 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap"
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 ingress 8 0 "mirror to ip6gretap"
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 egress 0 8 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
@ -102,14 +93,6 @@ trap cleanup EXIT
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -75,42 +75,31 @@ cleanup()
|
||||
test_gretap()
|
||||
{
|
||||
RET=0
|
||||
mirror_install $swp1 ingress gt4 "matchall $tcflags"
|
||||
mirror_install $swp1 ingress gt4 "matchall"
|
||||
|
||||
# For IPv4, test that there's no mirroring without the route directing
|
||||
# the traffic to tunnel remote address. Then add it and test that
|
||||
# mirroring starts. For IPv6 we can't test this due to the limitation
|
||||
# that routes for locally-specified IPv6 addresses can't be added.
|
||||
fail_test_span_gre_dir gt4 ingress
|
||||
fail_test_span_gre_dir gt4
|
||||
|
||||
ip route add 192.0.2.130/32 via 192.0.2.162
|
||||
quick_test_span_gre_dir gt4 ingress
|
||||
quick_test_span_gre_dir gt4
|
||||
ip route del 192.0.2.130/32 via 192.0.2.162
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
log_test "mirror to gre with next-hop remote ($tcflags)"
|
||||
log_test "mirror to gre with next-hop remote"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress gt6 "matchall $tcflags"
|
||||
quick_test_span_gre_dir gt6 ingress
|
||||
mirror_install $swp1 ingress gt6 "matchall"
|
||||
quick_test_span_gre_dir gt6
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "mirror to ip6gre with next-hop remote ($tcflags)"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
log_test "mirror to ip6gre with next-hop remote"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
@ -118,14 +107,6 @@ trap cleanup EXIT
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -63,30 +63,11 @@ test_gretap()
|
||||
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -153,21 +153,21 @@ test_span_gre_forbidden_cpu()
|
||||
RET=0
|
||||
|
||||
# Run the pass-test first, to prime neighbor table.
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
# Now forbid the VLAN at the bridge and see it fail.
|
||||
bridge vlan del dev br1 vid 555 self
|
||||
sleep 1
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
bridge vlan add dev br1 vid 555 self
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan forbidden at a bridge ($tcflags)"
|
||||
log_test "$what: vlan forbidden at a bridge"
|
||||
}
|
||||
|
||||
test_gretap_forbidden_cpu()
|
||||
@ -187,22 +187,22 @@ test_span_gre_forbidden_egress()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
bridge vlan del dev $swp3 vid 555
|
||||
sleep 1
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
bridge vlan add dev $swp3 vid 555
|
||||
# Re-prime FDB
|
||||
$ARPING -I br1.555 192.0.2.130 -fqc 1
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan forbidden at a bridge egress ($tcflags)"
|
||||
log_test "$what: vlan forbidden at a bridge egress"
|
||||
}
|
||||
|
||||
test_gretap_forbidden_egress()
|
||||
@ -223,30 +223,30 @@ test_span_gre_untagged_egress()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_vlan_dir $h3 555 ingress "$ul_proto"
|
||||
quick_test_span_gre_dir $tundev
|
||||
quick_test_span_vlan_dir $h3 555 "$ul_proto"
|
||||
|
||||
h3_addr_add_del del $h3.555
|
||||
bridge vlan add dev $swp3 vid 555 pvid untagged
|
||||
h3_addr_add_del add $h3
|
||||
sleep 5
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_vlan_dir $h3 555 ingress "$ul_proto"
|
||||
quick_test_span_gre_dir $tundev
|
||||
fail_test_span_vlan_dir $h3 555 "$ul_proto"
|
||||
|
||||
h3_addr_add_del del $h3
|
||||
bridge vlan add dev $swp3 vid 555
|
||||
h3_addr_add_del add $h3.555
|
||||
sleep 5
|
||||
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_vlan_dir $h3 555 ingress "$ul_proto"
|
||||
quick_test_span_gre_dir $tundev
|
||||
quick_test_span_vlan_dir $h3 555 "$ul_proto"
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: vlan untagged at a bridge egress ($tcflags)"
|
||||
log_test "$what: vlan untagged at a bridge egress"
|
||||
}
|
||||
|
||||
test_gretap_untagged_egress()
|
||||
@ -267,19 +267,19 @@ test_span_gre_fdb_roaming()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 ingress $tundev "matchall $tcflags"
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
mirror_install $swp1 ingress $tundev "matchall"
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
while ((RET == 0)); do
|
||||
bridge fdb del dev $swp3 $h3mac vlan 555 master 2>/dev/null
|
||||
bridge fdb add dev $swp2 $h3mac vlan 555 master static
|
||||
sleep 1
|
||||
fail_test_span_gre_dir $tundev ingress
|
||||
fail_test_span_gre_dir $tundev
|
||||
|
||||
if ! bridge fdb sh dev $swp2 vlan 555 master \
|
||||
| grep -q $h3mac; then
|
||||
printf "TEST: %-60s [RETRY]\n" \
|
||||
"$what: MAC roaming ($tcflags)"
|
||||
"$what: MAC roaming"
|
||||
# ARP or ND probably reprimed the FDB while the test
|
||||
# was running. We would get a spurious failure.
|
||||
RET=0
|
||||
@ -292,11 +292,11 @@ test_span_gre_fdb_roaming()
|
||||
# Re-prime FDB
|
||||
$ARPING -I br1.555 192.0.2.130 -fqc 1
|
||||
sleep 1
|
||||
quick_test_span_gre_dir $tundev ingress
|
||||
quick_test_span_gre_dir $tundev
|
||||
|
||||
mirror_uninstall $swp1 ingress
|
||||
|
||||
log_test "$what: MAC roaming ($tcflags)"
|
||||
log_test "$what: MAC roaming"
|
||||
}
|
||||
|
||||
test_gretap_fdb_roaming()
|
||||
@ -319,30 +319,11 @@ test_ip6gretap_stp()
|
||||
full_test_span_gre_stp gt6 $swp3 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -44,14 +44,17 @@ mirror_test()
|
||||
local type="icmp echoreq"
|
||||
fi
|
||||
|
||||
if [[ -z ${expect//[[:digit:]]/} ]]; then
|
||||
expect="== $expect"
|
||||
fi
|
||||
|
||||
local t0=$(tc_rule_stats_get $dev $pref)
|
||||
$MZ $proto $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \
|
||||
-c 10 -d 100msec -t $type
|
||||
sleep 0.5
|
||||
local t1=$(tc_rule_stats_get $dev $pref)
|
||||
local delta=$((t1 - t0))
|
||||
# Tolerate a couple stray extra packets.
|
||||
((expect <= delta && delta <= expect + 2))
|
||||
((delta $expect))
|
||||
check_err $? "Expected to capture $expect packets, got $delta."
|
||||
}
|
||||
|
||||
@ -59,36 +62,42 @@ do_test_span_dir_ips()
|
||||
{
|
||||
local expect=$1; shift
|
||||
local dev=$1; shift
|
||||
local direction=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
local forward_type=${1-8}; shift
|
||||
local backward_type=${1-0}; shift
|
||||
|
||||
icmp_capture_install $dev
|
||||
icmp_capture_install $dev "type $forward_type"
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
|
||||
icmp_capture_uninstall $dev
|
||||
|
||||
icmp_capture_install $dev "type $backward_type"
|
||||
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
|
||||
icmp_capture_uninstall $dev
|
||||
}
|
||||
|
||||
quick_test_span_dir_ips()
|
||||
{
|
||||
do_test_span_dir_ips 10 "$@"
|
||||
}
|
||||
local dev=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
local forward_type=${1-8}; shift
|
||||
local backward_type=${1-0}; shift
|
||||
|
||||
fail_test_span_dir_ips()
|
||||
{
|
||||
do_test_span_dir_ips 0 "$@"
|
||||
do_test_span_dir_ips 10 "$dev" "$ip1" "$ip2" \
|
||||
"$forward_type" "$backward_type"
|
||||
}
|
||||
|
||||
test_span_dir_ips()
|
||||
{
|
||||
local dev=$1; shift
|
||||
local direction=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
quick_test_span_dir_ips "$dev" "$direction" "$ip1" "$ip2"
|
||||
quick_test_span_dir_ips "$dev" "$ip1" "$ip2" \
|
||||
"$forward_type" "$backward_type"
|
||||
|
||||
icmp_capture_install $dev "type $forward_type"
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 10
|
||||
@ -99,14 +108,14 @@ test_span_dir_ips()
|
||||
icmp_capture_uninstall $dev
|
||||
}
|
||||
|
||||
fail_test_span_dir()
|
||||
{
|
||||
fail_test_span_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
test_span_dir()
|
||||
{
|
||||
test_span_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local dev=$1; shift
|
||||
local forward_type=$1; shift
|
||||
local backward_type=$1; shift
|
||||
|
||||
test_span_dir_ips "$dev" "$forward_type" "$backward_type" \
|
||||
192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
do_test_span_vlan_dir_ips()
|
||||
@ -114,7 +123,6 @@ do_test_span_vlan_dir_ips()
|
||||
local expect=$1; shift
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local direction=$1; shift
|
||||
local ul_proto=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
@ -123,27 +131,50 @@ do_test_span_vlan_dir_ips()
|
||||
# The traffic is meant for local box anyway, so will be trapped to
|
||||
# kernel.
|
||||
vlan_capture_install $dev "skip_hw vlan_id $vid vlan_ethtype $ul_proto"
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
|
||||
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
|
||||
mirror_test v$h1 $ip1 $ip2 $dev 100 "$expect"
|
||||
mirror_test v$h2 $ip2 $ip1 $dev 100 "$expect"
|
||||
vlan_capture_uninstall $dev
|
||||
}
|
||||
|
||||
quick_test_span_vlan_dir_ips()
|
||||
{
|
||||
do_test_span_vlan_dir_ips 10 "$@"
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local ul_proto=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
do_test_span_vlan_dir_ips '>= 10' "$dev" "$vid" "$ul_proto" \
|
||||
"$ip1" "$ip2"
|
||||
}
|
||||
|
||||
fail_test_span_vlan_dir_ips()
|
||||
{
|
||||
do_test_span_vlan_dir_ips 0 "$@"
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local ul_proto=$1; shift
|
||||
local ip1=$1; shift
|
||||
local ip2=$1; shift
|
||||
|
||||
do_test_span_vlan_dir_ips 0 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2"
|
||||
}
|
||||
|
||||
quick_test_span_vlan_dir()
|
||||
{
|
||||
quick_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local ul_proto=$1; shift
|
||||
|
||||
quick_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \
|
||||
192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
||||
fail_test_span_vlan_dir()
|
||||
{
|
||||
fail_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
|
||||
local dev=$1; shift
|
||||
local vid=$1; shift
|
||||
local ul_proto=$1; shift
|
||||
|
||||
fail_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \
|
||||
192.0.2.1 192.0.2.2
|
||||
}
|
||||
|
@ -40,12 +40,16 @@ setup_prepare()
|
||||
|
||||
vlan_create $h2 111 v$h2 192.0.2.18/28
|
||||
bridge vlan add dev $swp2 vid 111
|
||||
|
||||
trap_install $h3 ingress
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
pre_cleanup
|
||||
|
||||
trap_uninstall $h3 ingress
|
||||
|
||||
vlan_destroy $h2 111
|
||||
vlan_destroy $h1 111
|
||||
vlan_destroy $h3 555
|
||||
@ -63,11 +67,11 @@ test_vlan_dir()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $swp3.555 "matchall $tcflags"
|
||||
test_span_dir "$h3.555" "$direction" "$forward_type" "$backward_type"
|
||||
mirror_install $swp1 $direction $swp3.555 "matchall"
|
||||
test_span_dir "$h3.555" "$forward_type" "$backward_type"
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction mirror to vlan ($tcflags)"
|
||||
log_test "$direction mirror to vlan"
|
||||
}
|
||||
|
||||
test_vlan()
|
||||
@ -84,14 +88,12 @@ test_tagged_vlan_dir()
|
||||
|
||||
RET=0
|
||||
|
||||
mirror_install $swp1 $direction $swp3.555 "matchall $tcflags"
|
||||
do_test_span_vlan_dir_ips 10 "$h3.555" 111 "$direction" ip \
|
||||
192.0.2.17 192.0.2.18
|
||||
do_test_span_vlan_dir_ips 0 "$h3.555" 555 "$direction" ip \
|
||||
192.0.2.17 192.0.2.18
|
||||
mirror_install $swp1 $direction $swp3.555 "matchall"
|
||||
do_test_span_vlan_dir_ips '>= 10' "$h3.555" 111 ip 192.0.2.17 192.0.2.18
|
||||
do_test_span_vlan_dir_ips 0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18
|
||||
mirror_uninstall $swp1 $direction
|
||||
|
||||
log_test "$direction mirror tagged to vlan ($tcflags)"
|
||||
log_test "$direction mirror tagged to vlan"
|
||||
}
|
||||
|
||||
test_tagged_vlan()
|
||||
@ -100,32 +102,11 @@ test_tagged_vlan()
|
||||
test_tagged_vlan_dir egress 0 8
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
trap_install $h3 ingress
|
||||
|
||||
tests_run
|
||||
|
||||
trap_uninstall $h3 ingress
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
tcflags="skip_hw"
|
||||
test_all
|
||||
|
||||
if ! tc_offload_check; then
|
||||
echo "WARN: Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
test_all
|
||||
fi
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
@ -199,10 +199,10 @@ tc_rule_stats_get()
|
||||
{
|
||||
local dev=$1; shift
|
||||
local pref=$1; shift
|
||||
local dir=$1; shift
|
||||
local dir=${1:-ingress}; shift
|
||||
local selector=${1:-.packets}; shift
|
||||
|
||||
tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \
|
||||
tc -j -s filter show dev $dev $dir pref $pref \
|
||||
| jq ".[1].options.actions[].stats$selector"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user