hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/tools/testing/selftests/net/forwarding/tc_actions.sh
....@@ -2,7 +2,8 @@
22 # SPDX-License-Identifier: GPL-2.0
33
44 ALL_TESTS="gact_drop_and_ok_test mirred_egress_redirect_test \
5
- mirred_egress_mirror_test gact_trap_test"
5
+ mirred_egress_mirror_test matchall_mirred_egress_mirror_test \
6
+ gact_trap_test"
67 NUM_NETIFS=4
78 source tc_common.sh
89 source lib.sh
....@@ -50,6 +51,9 @@
5051 mirred_egress_test()
5152 {
5253 local action=$1
54
+ local protocol=$2
55
+ local classifier=$3
56
+ local classifier_args=$4
5357
5458 RET=0
5559
....@@ -62,9 +66,9 @@
6266 tc_check_packets "dev $h2 ingress" 101 1
6367 check_fail $? "Matched without redirect rule inserted"
6468
65
- tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
66
- $tcflags dst_ip 192.0.2.2 action mirred egress $action \
67
- dev $swp2
69
+ tc filter add dev $swp1 ingress protocol $protocol pref 1 handle 101 \
70
+ $classifier $tcflags $classifier_args \
71
+ action mirred egress $action dev $swp2
6872
6973 $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
7074 -t ip -q
....@@ -72,10 +76,11 @@
7276 tc_check_packets "dev $h2 ingress" 101 1
7377 check_err $? "Did not match incoming $action packet"
7478
75
- tc filter del dev $swp1 ingress protocol ip pref 1 handle 101 flower
79
+ tc filter del dev $swp1 ingress protocol $protocol pref 1 handle 101 \
80
+ $classifier
7681 tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
7782
78
- log_test "mirred egress $action ($tcflags)"
83
+ log_test "mirred egress $classifier $action ($tcflags)"
7984 }
8085
8186 gact_drop_and_ok_test()
....@@ -187,12 +192,17 @@
187192
188193 mirred_egress_redirect_test()
189194 {
190
- mirred_egress_test "redirect"
195
+ mirred_egress_test "redirect" "ip" "flower" "dst_ip 192.0.2.2"
191196 }
192197
193198 mirred_egress_mirror_test()
194199 {
195
- mirred_egress_test "mirror"
200
+ mirred_egress_test "mirror" "ip" "flower" "dst_ip 192.0.2.2"
201
+}
202
+
203
+matchall_mirred_egress_mirror_test()
204
+{
205
+ mirred_egress_test "mirror" "all" "matchall" ""
196206 }
197207
198208 trap cleanup EXIT