selftests: mirror: Drop direction argument from several functions

The argument is not used by these functions except to propagate it for
ultimately no purpose.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Petr Machata 2024-06-27 16:48:39 +02:00 committed by David S. Miller
parent d5fbb2eb33
commit 28e67746b7
10 changed files with 69 additions and 90 deletions

View File

@ -119,11 +119,11 @@ test_span_gre_ttl_inherit()
ip link set dev $tundev type $type ttl inherit
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
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)"
@ -139,10 +139,10 @@ test_span_gre_tos_fixed()
ip link set dev $tundev type $type tos 0x10
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
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)"
@ -158,9 +158,9 @@ test_span_failable()
mirror_install $swp1 ingress $tundev "matchall $tcflags"
if ((should_fail)); then
fail_test_span_gre_dir $tundev ingress
fail_test_span_gre_dir $tundev
else
quick_test_span_gre_dir $tundev ingress
quick_test_span_gre_dir $tundev
fi
mirror_uninstall $swp1 ingress

View File

@ -91,17 +91,17 @@ test_two_spans()
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
quick_test_span_gre_dir gt4
quick_test_span_gre_dir gt6
mirror_uninstall $swp1 ingress
fail_test_span_gre_dir gt4 ingress
quick_test_span_gre_dir gt6 egress
fail_test_span_gre_dir gt4
quick_test_span_gre_dir gt6
mirror_install $swp1 ingress gt4 "matchall $tcflags"
mirror_uninstall $swp1 egress
quick_test_span_gre_dir gt4 ingress
fail_test_span_gre_dir gt6 egress
quick_test_span_gre_dir gt4
fail_test_span_gre_dir gt6
mirror_uninstall $swp1 ingress
log_test "two simultaneously configured mirrors ($tcflags)"

View File

@ -99,11 +99,11 @@ test_span_gre_tun_up()
ip link set dev $tundev down
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
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)"
@ -119,7 +119,7 @@ test_span_gre_egress_up()
ip link set dev $swp3 down
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
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,7 +127,7 @@ 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)"
@ -145,10 +145,10 @@ test_span_gre_remote_ip()
ip link set dev $tundev type $type remote $wrong_ip
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
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)"
@ -166,9 +166,9 @@ test_span_gre_tun_del()
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir $tundev ingress
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
@ -177,7 +177,7 @@ test_span_gre_tun_del()
# 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
quick_test_span_gre_dir $tundev
mirror_uninstall $swp1 ingress
log_test "$what: tunnel deleted ($tcflags)"
@ -193,13 +193,13 @@ test_span_gre_route_del()
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir $tundev ingress
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

View File

@ -65,20 +65,18 @@ cleanup()
test_span_gre_dir_acl()
{
local tundev=$1; shift
local direction=$1; shift
local forward_type=$1; shift
local backward_type=$1; shift
test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \
test_span_gre_dir_ips "$tundev" "$forward_type" \
"$backward_type" 192.0.2.3 192.0.2.4
}
fail_test_span_gre_dir_acl()
{
local tundev=$1; shift
local direction=$1; shift
fail_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.3 192.0.2.4
fail_test_span_gre_dir_ips "$tundev" 192.0.2.3 192.0.2.4
}
full_test_span_gre_dir_acl()
@ -94,13 +92,12 @@ full_test_span_gre_dir_acl()
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"
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)"
}

View File

@ -5,33 +5,30 @@ source "$net_forwarding_dir/mirror_lib.sh"
quick_test_span_gre_dir_ips()
{
local tundev=$1; shift
local direction=$1; shift
local ip1=$1; shift
local ip2=$1; shift
do_test_span_dir_ips 10 h3-$tundev "$direction" "$ip1" "$ip2"
do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2"
}
fail_test_span_gre_dir_ips()
{
local tundev=$1; shift
local direction=$1; shift
local ip1=$1; shift
local ip2=$1; shift
do_test_span_dir_ips 0 h3-$tundev "$direction" "$ip1" "$ip2"
do_test_span_dir_ips 0 h3-$tundev "$ip1" "$ip2"
}
test_span_gre_dir_ips()
{
local tundev=$1; shift
local direction=$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 "$direction" "$forward_type" \
test_span_dir_ips h3-$tundev "$forward_type" \
"$backward_type" "$ip1" "$ip2"
}
@ -48,7 +45,7 @@ full_test_span_gre_dir_ips()
RET=0
mirror_install $swp1 $direction $tundev "matchall $tcflags"
test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
test_span_dir_ips "h3-$tundev" "$forward_type" \
"$backward_type" "$ip1" "$ip2"
mirror_uninstall $swp1 $direction
@ -70,7 +67,7 @@ full_test_span_gre_dir_vlan_ips()
mirror_install $swp1 $direction $tundev "matchall $tcflags"
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 \
@ -87,17 +84,15 @@ full_test_span_gre_dir_vlan_ips()
quick_test_span_gre_dir()
{
local tundev=$1; shift
local direction=$1; shift
quick_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.1 192.0.2.2
quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2
}
fail_test_span_gre_dir()
{
local tundev=$1; shift
local direction=$1; shift
fail_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.1 192.0.2.2
fail_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2
}
test_span_gre_dir()
@ -149,15 +144,15 @@ full_test_span_gre_stp_ips()
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
quick_test_span_gre_dir_ips $tundev $ip1 $ip2
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
mirror_uninstall $swp1 ingress

View File

@ -66,9 +66,9 @@ test_span_gre_neigh()
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
fail_test_span_gre_dir $tundev
ip neigh del dev $swp3 $addr
quick_test_span_gre_dir $tundev ingress
quick_test_span_gre_dir $tundev
mirror_uninstall $swp1 $direction
log_test "$direction $what: neighbor change ($tcflags)"

View File

@ -81,10 +81,10 @@ test_gretap()
# 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
@ -96,7 +96,7 @@ test_ip6gretap()
RET=0
mirror_install $swp1 ingress gt6 "matchall $tcflags"
quick_test_span_gre_dir gt6 ingress
quick_test_span_gre_dir gt6
mirror_uninstall $swp1 ingress
log_test "mirror to ip6gre with next-hop remote ($tcflags)"

View File

@ -154,16 +154,16 @@ test_span_gre_forbidden_cpu()
# Run the pass-test first, to prime neighbor table.
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir $tundev ingress
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
@ -188,17 +188,17 @@ test_span_gre_forbidden_egress()
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir $tundev ingress
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
@ -225,24 +225,24 @@ test_span_gre_untagged_egress()
mirror_install $swp1 ingress $tundev "matchall $tcflags"
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
@ -268,13 +268,13 @@ test_span_gre_fdb_roaming()
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
quick_test_span_gre_dir $tundev ingress
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
@ -292,7 +292,7 @@ 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

View File

@ -59,7 +59,6 @@ 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
@ -72,11 +71,10 @@ do_test_span_dir_ips()
quick_test_span_dir_ips()
{
local dev=$1; shift
local direction=$1; shift
local ip1=$1; shift
local ip2=$1; shift
do_test_span_dir_ips 10 "$dev" "$direction" "$ip1" "$ip2"
do_test_span_dir_ips 10 "$dev" "$ip1" "$ip2"
}
fail_test_span_dir_ips()
@ -92,13 +90,12 @@ fail_test_span_dir_ips()
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"
icmp_capture_install $dev "type $forward_type"
mirror_test v$h1 $ip1 $ip2 $dev 100 10
@ -120,11 +117,10 @@ fail_test_span_dir()
test_span_dir()
{
local dev=$1; shift
local direction=$1; shift
local forward_type=$1; shift
local backward_type=$1; shift
test_span_dir_ips "$dev" "$direction" "$forward_type" "$backward_type" \
test_span_dir_ips "$dev" "$forward_type" "$backward_type" \
192.0.2.1 192.0.2.2
}
@ -133,7 +129,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
@ -151,36 +146,31 @@ quick_test_span_vlan_dir_ips()
{
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
do_test_span_vlan_dir_ips 10 "$dev" "$vid" "$direction" "$ul_proto" \
"$ip1" "$ip2"
do_test_span_vlan_dir_ips 10 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2"
}
fail_test_span_vlan_dir_ips()
{
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
do_test_span_vlan_dir_ips 0 "$dev" "$vid" "$direction" "$ul_proto" \
"$ip1" "$ip2"
do_test_span_vlan_dir_ips 0 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2"
}
quick_test_span_vlan_dir()
{
local dev=$1; shift
local vid=$1; shift
local direction=$1; shift
local ul_proto=$1; shift
quick_test_span_vlan_dir_ips "$dev" "$vid" "$direction" "$ul_proto" \
quick_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \
192.0.2.1 192.0.2.2
}
@ -188,9 +178,8 @@ fail_test_span_vlan_dir()
{
local dev=$1; shift
local vid=$1; shift
local direction=$1; shift
local ul_proto=$1; shift
fail_test_span_vlan_dir_ips "$dev" "$vid" "$direction" "$ul_proto" \
fail_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \
192.0.2.1 192.0.2.2
}

View File

@ -64,7 +64,7 @@ test_vlan_dir()
RET=0
mirror_install $swp1 $direction $swp3.555 "matchall $tcflags"
test_span_dir "$h3.555" "$direction" "$forward_type" "$backward_type"
test_span_dir "$h3.555" "$forward_type" "$backward_type"
mirror_uninstall $swp1 $direction
log_test "$direction mirror to vlan ($tcflags)"
@ -85,10 +85,8 @@ 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
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)"