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
52 vlan_destroy
$swp3 555
60 local direction
=$1; shift
61 local forward_type
=$1; shift
62 local backward_type
=$1; shift
66 mirror_install
$swp1 $direction $swp3.555
"matchall $tcflags"
67 test_span_dir
"$h3.555" "$direction" "$forward_type" "$backward_type"
68 mirror_uninstall
$swp1 $direction
70 log_test
"$direction mirror to vlan ($tcflags)"
75 test_vlan_dir ingress
8 0
76 test_vlan_dir egress
0 8
79 test_tagged_vlan_dir
()
81 local direction
=$1; shift
82 local forward_type
=$1; shift
83 local backward_type
=$1; shift
87 mirror_install
$swp1 $direction $swp3.555
"matchall $tcflags"
88 do_test_span_vlan_dir_ips
10 "$h3.555" 111 "$direction" \
90 do_test_span_vlan_dir_ips
0 "$h3.555" 555 "$direction" \
92 mirror_uninstall
$swp1 $direction
94 log_test
"$direction mirror tagged to vlan ($tcflags)"
99 test_tagged_vlan_dir ingress
8 0
100 test_tagged_vlan_dir egress
0 8
105 slow_path_trap_install
$swp1 ingress
106 slow_path_trap_install
$swp1 egress
107 trap_install
$h3 ingress
111 trap_uninstall
$h3 ingress
112 slow_path_trap_uninstall
$swp1 egress
113 slow_path_trap_uninstall
$swp1 ingress
124 if ! tc_offload_check
; then
125 echo "WARN: Could not test offloaded functionality"