2 # SPDX-License-Identifier: GPL-2.0
4 # This test uses standard topology for testing mirroring. See mirror_topo_lib.sh
7 # Test for "tc action mirred egress mirror" that mirrors to a vlan device.
17 source mirror_topo_lib.sh
35 vlan_create $h3 555 v$h3
36 matchall_sink_create $h3.555
38 vlan_create $h1 111 v$h1 192.0.2.17/28
39 bridge vlan add dev $swp1 vid 111
41 vlan_create $h2 111 v$h2 192.0.2.18/28
42 bridge vlan add dev $swp2 vid 111
44 trap_install $h3 ingress
51 trap_uninstall $h3 ingress
56 vlan_destroy $swp3 555
64 local direction=$1; shift
65 local forward_type=$1; shift
66 local backward_type=$1; shift
70 mirror_install $swp1 $direction $swp3.555 "matchall"
71 test_span_dir "$h3.555" "$forward_type" "$backward_type"
72 mirror_uninstall $swp1 $direction
74 log_test "$direction mirror to vlan"
79 test_vlan_dir ingress 8 0
80 test_vlan_dir egress 0 8
83 test_tagged_vlan_dir()
85 local direction=$1; shift
86 local forward_type=$1; shift
87 local backward_type=$1; shift
91 mirror_install $swp1 $direction $swp3.555 "matchall"
92 do_test_span_vlan_dir_ips '>= 10' "$h3.555" 111 ip 192.0.2.17 192.0.2.18
93 do_test_span_vlan_dir_ips 0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18
94 mirror_uninstall $swp1 $direction
96 log_test "$direction mirror tagged to vlan"
101 test_tagged_vlan_dir ingress 8 0
102 test_tagged_vlan_dir egress 0 8