1 # SPDX-License-Identifier: GPL-2.0
3 source "$net_forwarding_dir/mirror_lib.sh"
5 quick_test_span_gre_dir_ips
()
10 local forward_type
=$1; shift
11 local backward_type
=$1; shift
13 do_test_span_dir_ips
10 h3-
$tundev "$ip1" "$ip2" \
14 "$forward_type" "$backward_type"
17 fail_test_span_gre_dir_ips
()
19 local tundev
=$1; shift
23 do_test_span_dir_ips
0 h3-
$tundev "$ip1" "$ip2"
26 test_span_gre_dir_ips
()
28 local tundev
=$1; shift
29 local forward_type
=$1; shift
30 local backward_type
=$1; shift
34 test_span_dir_ips h3-
$tundev "$forward_type" \
35 "$backward_type" "$ip1" "$ip2"
38 full_test_span_gre_dir_ips
()
40 local tundev
=$1; shift
41 local direction
=$1; shift
42 local forward_type
=$1; shift
43 local backward_type
=$1; shift
50 mirror_install
$swp1 $direction $tundev "matchall"
51 test_span_dir_ips
"h3-$tundev" "$forward_type" \
52 "$backward_type" "$ip1" "$ip2"
53 mirror_uninstall
$swp1 $direction
55 log_test
"$direction $what"
58 full_test_span_gre_dir_vlan_ips
()
60 local tundev
=$1; shift
61 local direction
=$1; shift
62 local vlan_match
=$1; shift
63 local forward_type
=$1; shift
64 local backward_type
=$1; shift
71 mirror_install
$swp1 $direction $tundev "matchall"
73 test_span_dir_ips
"h3-$tundev" "$forward_type" \
74 "$backward_type" "$ip1" "$ip2"
76 tc filter add dev
$h3 ingress pref
77 prot
802.1q \
79 mirror_test v
$h1 $ip1 $ip2 $h3 77 '>= 10'
80 tc filter del dev
$h3 ingress pref
77
82 mirror_uninstall
$swp1 $direction
84 log_test
"$direction $what"
87 quick_test_span_gre_dir
()
89 local tundev
=$1; shift
90 local forward_type
=${1-8}; shift
91 local backward_type
=${1-0}; shift
93 quick_test_span_gre_dir_ips
"$tundev" 192.0.2.1 192.0.2.2 \
94 "$forward_type" "$backward_type"
97 fail_test_span_gre_dir
()
99 local tundev
=$1; shift
101 fail_test_span_gre_dir_ips
"$tundev" 192.0.2.1 192.0.2.2
104 full_test_span_gre_dir
()
106 local tundev
=$1; shift
107 local direction
=$1; shift
108 local forward_type
=$1; shift
109 local backward_type
=$1; shift
112 full_test_span_gre_dir_ips
"$tundev" "$direction" "$forward_type" \
113 "$backward_type" "$what" 192.0.2.1 192.0.2.2
116 full_test_span_gre_dir_vlan
()
118 local tundev
=$1; shift
119 local direction
=$1; shift
120 local vlan_match
=$1; shift
121 local forward_type
=$1; shift
122 local backward_type
=$1; shift
125 full_test_span_gre_dir_vlan_ips
"$tundev" "$direction" "$vlan_match" \
126 "$forward_type" "$backward_type" \
127 "$what" 192.0.2.1 192.0.2.2
130 full_test_span_gre_stp_ips
()
132 local tundev
=$1; shift
133 local nbpdev
=$1; shift
137 local forward_type
=$1; shift
138 local backward_type
=$1; shift
139 local h3mac
=$
(mac_get
$h3)
143 mirror_install
$swp1 ingress
$tundev "matchall"
144 quick_test_span_gre_dir_ips
$tundev $ip1 $ip2 \
145 "$forward_type" "$backward_type"
147 bridge link
set dev
$nbpdev state disabled
149 fail_test_span_gre_dir_ips
$tundev $ip1 $ip2
151 bridge link
set dev
$nbpdev state forwarding
153 quick_test_span_gre_dir_ips
$tundev $ip1 $ip2 \
154 "$forward_type" "$backward_type"
156 mirror_uninstall
$swp1 ingress
158 log_test
"$what: STP state"
161 full_test_span_gre_stp
()
163 local tundev
=$1; shift
164 local nbpdev
=$1; shift
166 local forward_type
=${1-8}; shift
167 local backward_type
=${1-0}; shift
169 full_test_span_gre_stp_ips
"$tundev" "$nbpdev" "$what" \
170 192.0.2.1 192.0.2.2 \
171 "$forward_type" "$backward_type"