| .. | .. |
|---|
| 2 | 2 | # SPDX-License-Identifier: GPL-2.0 |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | 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" |
|---|
| 6 | 7 | NUM_NETIFS=4 |
|---|
| 7 | 8 | source tc_common.sh |
|---|
| 8 | 9 | source lib.sh |
|---|
| .. | .. |
|---|
| 50 | 51 | mirred_egress_test() |
|---|
| 51 | 52 | { |
|---|
| 52 | 53 | local action=$1 |
|---|
| 54 | + local protocol=$2 |
|---|
| 55 | + local classifier=$3 |
|---|
| 56 | + local classifier_args=$4 |
|---|
| 53 | 57 | |
|---|
| 54 | 58 | RET=0 |
|---|
| 55 | 59 | |
|---|
| .. | .. |
|---|
| 62 | 66 | tc_check_packets "dev $h2 ingress" 101 1 |
|---|
| 63 | 67 | check_fail $? "Matched without redirect rule inserted" |
|---|
| 64 | 68 | |
|---|
| 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 |
|---|
| 68 | 72 | |
|---|
| 69 | 73 | $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ |
|---|
| 70 | 74 | -t ip -q |
|---|
| .. | .. |
|---|
| 72 | 76 | tc_check_packets "dev $h2 ingress" 101 1 |
|---|
| 73 | 77 | check_err $? "Did not match incoming $action packet" |
|---|
| 74 | 78 | |
|---|
| 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 |
|---|
| 76 | 81 | tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower |
|---|
| 77 | 82 | |
|---|
| 78 | | - log_test "mirred egress $action ($tcflags)" |
|---|
| 83 | + log_test "mirred egress $classifier $action ($tcflags)" |
|---|
| 79 | 84 | } |
|---|
| 80 | 85 | |
|---|
| 81 | 86 | gact_drop_and_ok_test() |
|---|
| .. | .. |
|---|
| 187 | 192 | |
|---|
| 188 | 193 | mirred_egress_redirect_test() |
|---|
| 189 | 194 | { |
|---|
| 190 | | - mirred_egress_test "redirect" |
|---|
| 195 | + mirred_egress_test "redirect" "ip" "flower" "dst_ip 192.0.2.2" |
|---|
| 191 | 196 | } |
|---|
| 192 | 197 | |
|---|
| 193 | 198 | mirred_egress_mirror_test() |
|---|
| 194 | 199 | { |
|---|
| 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" "" |
|---|
| 196 | 206 | } |
|---|
| 197 | 207 | |
|---|
| 198 | 208 | trap cleanup EXIT |
|---|