Commit 28e67746 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

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: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarDanielle Ratson <danieller@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d5fbb2eb
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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

+6 −6
Original line number Diff line number Diff line
@@ -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)"
+12 −12
Original line number Diff line number Diff line
@@ -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

+5 −8
Original line number Diff line number Diff line
@@ -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)"
}
+10 −15
Original line number Diff line number Diff line
@@ -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

Loading