Skip to content

Commit 200066a

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
selftests: Extend the tc action test for action mirror
Currently the tc action test is used only to test mirred redirect action. This patch extends it for mirred mirror. Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Arkadi Sharshevsky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e6c6a92 commit 200066a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tools/testing/selftests/net/forwarding/tc_actions.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ switch_destroy()
4545
simple_if_fini $swp1 192.0.2.2/24
4646
}
4747

48-
mirred_egress_redirect_test()
48+
mirred_egress_test()
4949
{
50+
local action=$1
51+
5052
RET=0
5153

5254
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
@@ -59,19 +61,19 @@ mirred_egress_redirect_test()
5961
check_fail $? "Matched without redirect rule inserted"
6062

6163
tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
62-
$tcflags dst_ip 192.0.2.2 action mirred egress redirect \
64+
$tcflags dst_ip 192.0.2.2 action mirred egress $action \
6365
dev $swp2
6466

6567
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
6668
-t ip -q
6769

6870
tc_check_packets "dev $h2 ingress" 101 1
69-
check_err $? "Did not match incoming redirected packet"
71+
check_err $? "Did not match incoming $action packet"
7072

7173
tc filter del dev $swp1 ingress protocol ip pref 1 handle 101 flower
7274
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
7375

74-
log_test "mirred egress redirect ($tcflags)"
76+
log_test "mirred egress $action ($tcflags)"
7577
}
7678

7779
gact_drop_and_ok_test()
@@ -180,15 +182,17 @@ setup_prepare
180182
setup_wait
181183

182184
gact_drop_and_ok_test
183-
mirred_egress_redirect_test
185+
mirred_egress_test "redirect"
186+
mirred_egress_test "mirror"
184187

185188
tc_offload_check
186189
if [[ $? -ne 0 ]]; then
187190
log_info "Could not test offloaded functionality"
188191
else
189192
tcflags="skip_sw"
190193
gact_drop_and_ok_test
191-
mirred_egress_redirect_test
194+
mirred_egress_test "redirect"
195+
mirred_egress_test "mirror"
192196
gact_trap_test
193197
fi
194198

0 commit comments

Comments
 (0)