Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: forwarding: tc_actions.sh: add matchall mirror test

Add test for matchall classifier with mirred egress mirror action.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
075c8aa7 19f06771

+18 -8
+18 -8
tools/testing/selftests/net/forwarding/tc_actions.sh
··· 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 ··· 51 50 mirred_egress_test() 52 51 { 53 52 local action=$1 53 + local protocol=$2 54 + local classifier=$3 55 + local classifier_args=$4 54 56 55 57 RET=0 56 58 ··· 66 62 tc_check_packets "dev $h2 ingress" 101 1 67 63 check_fail $? "Matched without redirect rule inserted" 68 64 69 - tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \ 70 - $tcflags dst_ip 192.0.2.2 action mirred egress $action \ 71 - dev $swp2 65 + tc filter add dev $swp1 ingress protocol $protocol pref 1 handle 101 \ 66 + $classifier $tcflags $classifier_args \ 67 + action mirred egress $action dev $swp2 72 68 73 69 $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ 74 70 -t ip -q ··· 76 72 tc_check_packets "dev $h2 ingress" 101 1 77 73 check_err $? "Did not match incoming $action packet" 78 74 79 - tc filter del dev $swp1 ingress protocol ip pref 1 handle 101 flower 75 + tc filter del dev $swp1 ingress protocol $protocol pref 1 handle 101 \ 76 + $classifier 80 77 tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower 81 78 82 - log_test "mirred egress $action ($tcflags)" 79 + log_test "mirred egress $classifier $action ($tcflags)" 83 80 } 84 81 85 82 gact_drop_and_ok_test() ··· 192 187 193 188 mirred_egress_redirect_test() 194 189 { 195 - mirred_egress_test "redirect" 190 + mirred_egress_test "redirect" "ip" "flower" "dst_ip 192.0.2.2" 196 191 } 197 192 198 193 mirred_egress_mirror_test() 199 194 { 200 - mirred_egress_test "mirror" 195 + mirred_egress_test "mirror" "ip" "flower" "dst_ip 192.0.2.2" 196 + } 197 + 198 + matchall_mirred_egress_mirror_test() 199 + { 200 + mirred_egress_test "mirror" "all" "matchall" "" 201 201 } 202 202 203 203 trap cleanup EXIT