]>
Commit | Line | Data |
---|---|---|
d7c5426b | 1 | AT_BANNER([datapath-sanity]) |
69c2bdfe | 2 | |
d7c5426b | 3 | AT_SETUP([datapath - ping between two ports]) |
cf7659b6 JR |
4 | OVS_TRAFFIC_VSWITCHD_START() |
5 | ||
6 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
69c2bdfe AZ |
7 | |
8 | ADD_NAMESPACES(at_ns0, at_ns1) | |
9 | ||
10 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
11 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
12 | ||
de22d08f | 13 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 14 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
15 | ]) |
16 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 17 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
18 | ]) |
19 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
cfe17b43 JS |
20 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
21 | ]) | |
22 | ||
d7c5426b | 23 | OVS_TRAFFIC_VSWITCHD_STOP |
cfe17b43 JS |
24 | AT_CLEANUP |
25 | ||
e0b92701 DDP |
26 | AT_SETUP([datapath - http between two ports]) |
27 | OVS_TRAFFIC_VSWITCHD_START() | |
28 | ||
29 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
30 | ||
31 | ADD_NAMESPACES(at_ns0, at_ns1) | |
32 | ||
33 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
34 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
35 | ||
36 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
37 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
38 | ]) | |
39 | ||
7ed40afe | 40 | OVS_START_L7([at_ns1], [http]) |
e0b92701 DDP |
41 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
42 | ||
43 | OVS_TRAFFIC_VSWITCHD_STOP | |
44 | AT_CLEANUP | |
45 | ||
d7c5426b | 46 | AT_SETUP([datapath - ping between two ports on vlan]) |
cf7659b6 JR |
47 | OVS_TRAFFIC_VSWITCHD_START() |
48 | ||
49 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
cfe17b43 JS |
50 | |
51 | ADD_NAMESPACES(at_ns0, at_ns1) | |
52 | ||
53 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
54 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
55 | ||
56 | ADD_VLAN(p0, at_ns0, 100, "10.2.2.1/24") | |
57 | ADD_VLAN(p1, at_ns1, 100, "10.2.2.2/24") | |
58 | ||
de22d08f | 59 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 60 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
61 | ]) |
62 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 63 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
64 | ]) |
65 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
cfe17b43 JS |
66 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
67 | ]) | |
68 | ||
d7c5426b | 69 | OVS_TRAFFIC_VSWITCHD_STOP |
cfe17b43 JS |
70 | AT_CLEANUP |
71 | ||
c5abeef4 EG |
72 | AT_SETUP([datapath - ping between two ports on cvlan]) |
73 | OVS_TRAFFIC_VSWITCHD_START() | |
0de1b425 | 74 | OVS_CHECK_8021AD() |
c5abeef4 EG |
75 | |
76 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
77 | ||
78 | ADD_NAMESPACES(at_ns0, at_ns1) | |
79 | ||
80 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
81 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
82 | ||
83 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
84 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
85 | ||
86 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
87 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
88 | ||
89 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
90 | ||
91 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
92 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
93 | ]) | |
94 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
95 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
96 | ]) | |
97 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
98 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
99 | ]) | |
100 | ||
101 | OVS_TRAFFIC_VSWITCHD_STOP | |
102 | AT_CLEANUP | |
103 | ||
d7c5426b | 104 | AT_SETUP([datapath - ping6 between two ports]) |
cf7659b6 JR |
105 | OVS_TRAFFIC_VSWITCHD_START() |
106 | ||
107 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
cfe17b43 JS |
108 | |
109 | ADD_NAMESPACES(at_ns0, at_ns1) | |
110 | ||
111 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
112 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
113 | ||
c10840ff JS |
114 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
115 | dnl waiting, we get occasional failures due to the following error: | |
cfe17b43 | 116 | dnl "connect: Cannot assign requested address" |
c10840ff | 117 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
cfe17b43 | 118 | |
de22d08f | 119 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 120 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
121 | ]) |
122 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 123 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
124 | ]) |
125 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 JS |
126 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
127 | ]) | |
128 | ||
d7c5426b | 129 | OVS_TRAFFIC_VSWITCHD_STOP |
cfe17b43 JS |
130 | AT_CLEANUP |
131 | ||
d7c5426b | 132 | AT_SETUP([datapath - ping6 between two ports on vlan]) |
cf7659b6 JR |
133 | OVS_TRAFFIC_VSWITCHD_START() |
134 | ||
135 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
cfe17b43 JS |
136 | |
137 | ADD_NAMESPACES(at_ns0, at_ns1) | |
138 | ||
139 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
140 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
141 | ||
142 | ADD_VLAN(p0, at_ns0, 100, "fc00:1::1/96") | |
143 | ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96") | |
144 | ||
c10840ff JS |
145 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
146 | dnl waiting, we get occasional failures due to the following error: | |
cfe17b43 | 147 | dnl "connect: Cannot assign requested address" |
68ffb694 | 148 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2]) |
cfe17b43 | 149 | |
de22d08f | 150 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 151 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
152 | ]) |
153 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 154 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
155 | ]) |
156 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 JS |
157 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
158 | ]) | |
159 | ||
d7c5426b | 160 | OVS_TRAFFIC_VSWITCHD_STOP |
69c2bdfe | 161 | AT_CLEANUP |
810e1785 | 162 | |
c5abeef4 EG |
163 | AT_SETUP([datapath - ping6 between two ports on cvlan]) |
164 | OVS_TRAFFIC_VSWITCHD_START() | |
0de1b425 | 165 | OVS_CHECK_8021AD() |
c5abeef4 EG |
166 | |
167 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
168 | ||
169 | ADD_NAMESPACES(at_ns0, at_ns1) | |
170 | ||
171 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
172 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
173 | ||
174 | ADD_SVLAN(p0, at_ns0, 4094, "fc00:ffff::1/96") | |
175 | ADD_SVLAN(p1, at_ns1, 4094, "fc00:ffff::2/96") | |
176 | ||
177 | ADD_CVLAN(p0.4094, at_ns0, 100, "fc00:1::1/96") | |
178 | ADD_CVLAN(p1.4094, at_ns1, 100, "fc00:1::2/96") | |
179 | ||
180 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2]) | |
181 | ||
182 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
183 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
184 | ]) | |
185 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
186 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
187 | ]) | |
188 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
189 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
190 | ]) | |
191 | ||
192 | OVS_TRAFFIC_VSWITCHD_STOP | |
193 | AT_CLEANUP | |
194 | ||
ddb5f937 LR |
195 | AT_SETUP([datapath - ping over bond]) |
196 | OVS_TRAFFIC_VSWITCHD_START() | |
197 | ||
198 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
199 | ||
200 | ADD_NAMESPACES(at_ns0, at_ns1) | |
201 | ||
202 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
203 | ADD_VETH_BOND(p1 p2, at_ns1, br0, bond0, lacp=active bond_mode=balance-tcp, "10.1.1.2/24") | |
204 | ||
205 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2]) | |
206 | ||
207 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
208 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
209 | ]) | |
210 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
211 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
212 | ]) | |
213 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
214 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
215 | ]) | |
216 | ||
217 | OVS_TRAFFIC_VSWITCHD_STOP | |
218 | AT_CLEANUP | |
219 | ||
810e1785 | 220 | AT_SETUP([datapath - ping over vxlan tunnel]) |
dfb21e96 | 221 | OVS_CHECK_VXLAN() |
810e1785 | 222 | |
cf7659b6 JR |
223 | OVS_TRAFFIC_VSWITCHD_START() |
224 | ADD_BR([br-underlay]) | |
225 | ||
226 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
227 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
228 | ||
810e1785 JS |
229 | ADD_NAMESPACES(at_ns0) |
230 | ||
231 | dnl Set up underlay link from host into the namespace using veth pair. | |
232 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
233 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
234 | AT_CHECK([ip link set dev br-underlay up]) | |
235 | ||
236 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
237 | dnl linux device inside the namespace. | |
238 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], [10.1.1.100/24]) | |
239 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
240 | [id 0 dstport 4789]) | |
241 | ||
242 | dnl First, check the underlay | |
243 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
244 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
245 | ]) | |
246 | ||
247 | dnl Okay, now check the overlay with different packet sizes | |
248 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
249 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
250 | ]) | |
251 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
252 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
253 | ]) | |
254 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
d5f2dd0b EG |
255 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
256 | ]) | |
257 | ||
258 | OVS_TRAFFIC_VSWITCHD_STOP | |
259 | AT_CLEANUP | |
260 | ||
261 | AT_SETUP([datapath - ping over vxlan6 tunnel]) | |
67e3ddf1 | 262 | OVS_CHECK_VXLAN_UDP6ZEROCSUM() |
d5f2dd0b EG |
263 | |
264 | OVS_TRAFFIC_VSWITCHD_START() | |
265 | ADD_BR([br-underlay]) | |
266 | ||
267 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
268 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
269 | ||
270 | ADD_NAMESPACES(at_ns0) | |
271 | ||
272 | dnl Set up underlay link from host into the namespace using veth pair. | |
273 | ADD_VETH(p0, at_ns0, br-underlay, "fc00::1/64", [], [], "nodad") | |
274 | AT_CHECK([ip addr add dev br-underlay "fc00::100/64" nodad]) | |
275 | AT_CHECK([ip link set dev br-underlay up]) | |
276 | ||
277 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
278 | dnl linux device inside the namespace. | |
279 | ADD_OVS_TUNNEL6([vxlan], [br0], [at_vxlan0], [fc00::1], [10.1.1.100/24]) | |
280 | ADD_NATIVE_TUNNEL6([vxlan], [at_vxlan1], [at_ns0], [fc00::100], [10.1.1.1/24], | |
281 | [id 0 dstport 4789 udp6zerocsumtx udp6zerocsumrx]) | |
282 | ||
283 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100]) | |
284 | ||
285 | dnl First, check the underlay | |
286 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::100 | FORMAT_PING], [0], [dnl | |
287 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
288 | ]) | |
289 | ||
290 | dnl Okay, now check the overlay with different packet sizes | |
291 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
292 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
293 | ]) | |
294 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
295 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
296 | ]) | |
297 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
523256cc JS |
298 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
299 | ]) | |
300 | ||
301 | OVS_TRAFFIC_VSWITCHD_STOP | |
302 | AT_CLEANUP | |
303 | ||
304 | AT_SETUP([datapath - ping over gre tunnel]) | |
cae92b42 | 305 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
523256cc JS |
306 | OVS_CHECK_GRE() |
307 | ||
308 | OVS_TRAFFIC_VSWITCHD_START() | |
309 | ADD_BR([br-underlay]) | |
310 | ||
311 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
312 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
313 | ||
314 | ADD_NAMESPACES(at_ns0) | |
315 | ||
316 | dnl Set up underlay link from host into the namespace using veth pair. | |
317 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
318 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
319 | AT_CHECK([ip link set dev br-underlay up]) | |
320 | ||
321 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
322 | dnl linux device inside the namespace. | |
323 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
324 | ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24]) | |
325 | ||
326 | dnl First, check the underlay | |
327 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
328 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
329 | ]) | |
330 | ||
331 | dnl Okay, now check the overlay with different packet sizes | |
332 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
333 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
334 | ]) | |
335 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
336 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
337 | ]) | |
338 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
92b8af2c JS |
339 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
340 | ]) | |
341 | ||
342 | OVS_TRAFFIC_VSWITCHD_STOP | |
343 | AT_CLEANUP | |
344 | ||
a3173ee1 WT |
345 | AT_SETUP([datapath - ping over ip6gre L2 tunnel]) |
346 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) | |
347 | OVS_CHECK_GRE() | |
348 | OVS_CHECK_ERSPAN() | |
349 | ||
350 | OVS_TRAFFIC_VSWITCHD_START() | |
351 | ADD_BR([br-underlay]) | |
352 | ||
353 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
354 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
355 | ||
356 | ADD_NAMESPACES(at_ns0) | |
357 | ||
358 | dnl Set up underlay link from host into the namespace using veth pair. | |
359 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", [], [], nodad) | |
360 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
361 | AT_CHECK([ip link set dev br-underlay up]) | |
362 | ||
363 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
364 | dnl linux device inside the namespace. | |
365 | ADD_OVS_TUNNEL6([ip6gre], [br0], [at_gre0], [fc00:100::1], [10.1.1.100/24], | |
366 | [options:packet_type=legacy_l2]) | |
367 | ADD_NATIVE_TUNNEL6([ip6gretap], [ns_gretap0], [at_ns0], [fc00:100::100], | |
368 | [10.1.1.1/24], [local fc00:100::1]) | |
369 | ||
370 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
371 | ||
372 | dnl First, check the underlay | |
373 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
374 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
375 | ]) | |
376 | ||
377 | dnl Okay, now check the overlay with different packet sizes | |
378 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
379 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
380 | ]) | |
381 | OVS_TRAFFIC_VSWITCHD_STOP | |
382 | AT_CLEANUP | |
383 | ||
384 | ||
98514eea | 385 | AT_SETUP([datapath - ping over erspan v1 tunnel]) |
cae92b42 | 386 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
387 | OVS_CHECK_GRE() |
388 | OVS_CHECK_ERSPAN() | |
389 | ||
390 | OVS_TRAFFIC_VSWITCHD_START() | |
391 | ADD_BR([br-underlay]) | |
392 | ||
393 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
394 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
395 | ||
396 | ADD_NAMESPACES(at_ns0) | |
397 | ||
398 | dnl Set up underlay link from host into the namespace using veth pair. | |
399 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
400 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
401 | AT_CHECK([ip link set dev br-underlay up]) | |
402 | ||
403 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
404 | dnl linux device inside the namespace. | |
405 | ADD_OVS_TUNNEL([erspan], [br0], [at_erspan0], [172.31.1.1], [10.1.1.100/24], [options:key=1 options:erspan_ver=1 options:erspan_idx=7]) | |
406 | ADD_NATIVE_TUNNEL([erspan], [ns_erspan0], [at_ns0], [172.31.1.100], [10.1.1.1/24], [seq key 1 erspan_ver 1 erspan 7]) | |
407 | ||
408 | dnl First, check the underlay | |
409 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
410 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
411 | ]) | |
412 | ||
413 | dnl Okay, now check the overlay with different packet sizes | |
414 | dnl NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
415 | NS_CHECK_EXEC([at_ns0], [ping -s 1200 -i 0.3 -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl | |
416 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
417 | ]) | |
418 | OVS_TRAFFIC_VSWITCHD_STOP | |
419 | AT_CLEANUP | |
420 | ||
421 | AT_SETUP([datapath - ping over erspan v2 tunnel]) | |
cae92b42 | 422 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
423 | OVS_CHECK_GRE() |
424 | OVS_CHECK_ERSPAN() | |
425 | ||
426 | OVS_TRAFFIC_VSWITCHD_START() | |
427 | ADD_BR([br-underlay]) | |
428 | ||
429 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
430 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
431 | ||
432 | ADD_NAMESPACES(at_ns0) | |
433 | ||
434 | dnl Set up underlay link from host into the namespace using veth pair. | |
435 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
436 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
437 | AT_CHECK([ip link set dev br-underlay up]) | |
438 | ||
439 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
440 | dnl linux device inside the namespace. | |
441 | ADD_OVS_TUNNEL([erspan], [br0], [at_erspan0], [172.31.1.1], [10.1.1.100/24], [options:key=1 options:erspan_ver=2 options:erspan_dir=1 options:erspan_hwid=0x7]) | |
442 | ADD_NATIVE_TUNNEL([erspan], [ns_erspan0], [at_ns0], [172.31.1.100], [10.1.1.1/24], [seq key 1 erspan_ver 2 erspan_dir egress erspan_hwid 7]) | |
443 | ||
444 | dnl First, check the underlay | |
445 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
446 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
447 | ]) | |
448 | ||
449 | dnl Okay, now check the overlay with different packet sizes | |
450 | dnl NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
451 | NS_CHECK_EXEC([at_ns0], [ping -s 1200 -i 0.3 -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl | |
452 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
453 | ]) | |
454 | OVS_TRAFFIC_VSWITCHD_STOP | |
455 | AT_CLEANUP | |
456 | ||
457 | AT_SETUP([datapath - ping over ip6erspan v1 tunnel]) | |
cae92b42 | 458 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
459 | OVS_CHECK_GRE() |
460 | OVS_CHECK_ERSPAN() | |
461 | ||
462 | OVS_TRAFFIC_VSWITCHD_START() | |
463 | ADD_BR([br-underlay]) | |
464 | ||
465 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
466 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
467 | ||
468 | ADD_NAMESPACES(at_ns0) | |
469 | ||
470 | dnl Set up underlay link from host into the namespace using veth pair. | |
471 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", [], [], nodad) | |
472 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
473 | AT_CHECK([ip link set dev br-underlay up]) | |
474 | ||
475 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
476 | dnl linux device inside the namespace. | |
477 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
478 | [options:key=123 options:erspan_ver=1 options:erspan_idx=0x7]) | |
479 | ADD_NATIVE_TUNNEL6([ip6erspan], [ns_erspan0], [at_ns0], [fc00:100::100], | |
480 | [10.1.1.1/24], [local fc00:100::1 seq key 123 erspan_ver 1 erspan 7]) | |
481 | ||
482 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
483 | ||
484 | dnl First, check the underlay | |
485 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
486 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
487 | ]) | |
488 | ||
489 | dnl Okay, now check the overlay with different packet sizes | |
490 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
491 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
492 | ]) | |
493 | OVS_TRAFFIC_VSWITCHD_STOP | |
494 | AT_CLEANUP | |
495 | ||
496 | AT_SETUP([datapath - ping over ip6erspan v2 tunnel]) | |
cae92b42 | 497 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
498 | OVS_CHECK_GRE() |
499 | OVS_CHECK_ERSPAN() | |
500 | ||
501 | OVS_TRAFFIC_VSWITCHD_START() | |
502 | ADD_BR([br-underlay]) | |
503 | ||
504 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
505 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
506 | ||
507 | ADD_NAMESPACES(at_ns0) | |
508 | ||
509 | dnl Set up underlay link from host into the namespace using veth pair. | |
510 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", [], [], nodad) | |
511 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
512 | AT_CHECK([ip link set dev br-underlay up]) | |
513 | ||
514 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
515 | dnl linux device inside the namespace. | |
516 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
517 | [options:key=121 options:erspan_ver=2 options:erspan_dir=0 options:erspan_hwid=0x7]) | |
518 | ADD_NATIVE_TUNNEL6([ip6erspan], [ns_erspan0], [at_ns0], [fc00:100::100], | |
519 | [10.1.1.1/24], | |
520 | [local fc00:100::1 seq key 121 erspan_ver 2 erspan_dir ingress erspan_hwid 0x7]) | |
521 | ||
522 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
523 | ||
524 | dnl First, check the underlay | |
525 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
526 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
527 | ]) | |
528 | ||
529 | dnl Okay, now check the overlay with different packet sizes | |
530 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
531 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
532 | ]) | |
533 | OVS_TRAFFIC_VSWITCHD_STOP | |
534 | AT_CLEANUP | |
535 | ||
92b8af2c JS |
536 | AT_SETUP([datapath - ping over geneve tunnel]) |
537 | OVS_CHECK_GENEVE() | |
538 | ||
539 | OVS_TRAFFIC_VSWITCHD_START() | |
540 | ADD_BR([br-underlay]) | |
541 | ||
542 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
543 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
544 | ||
545 | ADD_NAMESPACES(at_ns0) | |
546 | ||
547 | dnl Set up underlay link from host into the namespace using veth pair. | |
548 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
549 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
550 | AT_CHECK([ip link set dev br-underlay up]) | |
551 | ||
552 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
553 | dnl linux device inside the namespace. | |
554 | ADD_OVS_TUNNEL([geneve], [br0], [at_gnv0], [172.31.1.1], [10.1.1.100/24]) | |
555 | ADD_NATIVE_TUNNEL([geneve], [ns_gnv0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
556 | [vni 0]) | |
557 | ||
558 | dnl First, check the underlay | |
559 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
560 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
561 | ]) | |
562 | ||
563 | dnl Okay, now check the overlay with different packet sizes | |
564 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
565 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
566 | ]) | |
567 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
568 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
569 | ]) | |
570 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
b31f1b04 EG |
571 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
572 | ]) | |
573 | ||
574 | OVS_TRAFFIC_VSWITCHD_STOP | |
575 | AT_CLEANUP | |
576 | ||
bed941ba YHW |
577 | AT_SETUP([datapath - flow resume with geneve tun_metadata]) |
578 | OVS_CHECK_GENEVE() | |
579 | ||
580 | OVS_TRAFFIC_VSWITCHD_START() | |
581 | ADD_BR([br-underlay]) | |
582 | ||
fcfd14ce YS |
583 | AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile 2> /dev/null]) |
584 | ||
bed941ba YHW |
585 | ADD_NAMESPACES(at_ns0) |
586 | ||
587 | dnl Set up underlay link from host into the namespace using veth pair. | |
588 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
589 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
590 | AT_CHECK([ip link set dev br-underlay up]) | |
591 | ||
592 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
593 | dnl linux device inside the namespace. | |
594 | ADD_OVS_TUNNEL([geneve], [br0], [at_gnv0], [172.31.1.1], [10.1.1.100/24]) | |
595 | ADD_NATIVE_TUNNEL([geneve], [ns_gnv0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
596 | [vni 0]) | |
597 | ||
598 | dnl Set up flows | |
599 | AT_DATA([flows.txt], [dnl | |
600 | table=0, arp action=NORMAL | |
601 | table=0, in_port=LOCAL icmp action=output:at_gnv0 | |
602 | table=0, in_port=at_gnv0 icmp action=set_field:0xa->tun_metadata0,resubmit(,1) | |
603 | table=1, icmp action=controller(pause), resubmit(,2) | |
604 | table=2, tun_metadata0=0xa, icmp action=output:LOCAL | |
605 | ]) | |
606 | AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"]) | |
607 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
608 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
609 | ||
bed941ba YHW |
610 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl |
611 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
612 | ]) | |
613 | ||
fcfd14ce | 614 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
bed941ba YHW |
615 | OVS_TRAFFIC_VSWITCHD_STOP |
616 | AT_CLEANUP | |
617 | ||
b31f1b04 | 618 | AT_SETUP([datapath - ping over geneve6 tunnel]) |
67e3ddf1 | 619 | OVS_CHECK_GENEVE_UDP6ZEROCSUM() |
b31f1b04 EG |
620 | |
621 | OVS_TRAFFIC_VSWITCHD_START() | |
622 | ADD_BR([br-underlay]) | |
623 | ||
624 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
625 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
626 | ||
627 | ADD_NAMESPACES(at_ns0) | |
628 | ||
629 | dnl Set up underlay link from host into the namespace using veth pair. | |
630 | ADD_VETH(p0, at_ns0, br-underlay, "fc00::1/64", [], [], "nodad") | |
631 | AT_CHECK([ip addr add dev br-underlay "fc00::100/64" nodad]) | |
632 | AT_CHECK([ip link set dev br-underlay up]) | |
633 | ||
634 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
635 | dnl linux device inside the namespace. | |
636 | ADD_OVS_TUNNEL6([geneve], [br0], [at_gnv0], [fc00::1], [10.1.1.100/24]) | |
637 | ADD_NATIVE_TUNNEL6([geneve], [ns_gnv0], [at_ns0], [fc00::100], [10.1.1.1/24], | |
638 | [vni 0 udp6zerocsumtx udp6zerocsumrx]) | |
639 | ||
640 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100]) | |
641 | ||
642 | dnl First, check the underlay | |
643 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::100 | FORMAT_PING], [0], [dnl | |
644 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
645 | ]) | |
646 | ||
647 | dnl Okay, now check the overlay with different packet sizes | |
648 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
649 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
650 | ]) | |
651 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
652 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
653 | ]) | |
654 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
810e1785 JS |
655 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
656 | ]) | |
657 | ||
658 | OVS_TRAFFIC_VSWITCHD_STOP | |
659 | AT_CLEANUP | |
07659514 | 660 | |
eb27d96b | 661 | AT_SETUP([datapath - ping over gre tunnel by simulated packets]) |
e06c44a8 | 662 | OVS_CHECK_MIN_KERNEL(3, 10) |
eb27d96b YS |
663 | |
664 | OVS_TRAFFIC_VSWITCHD_START() | |
665 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
666 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
667 | ||
668 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
669 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
670 | ||
671 | ADD_NAMESPACES(at_ns0) | |
672 | ||
673 | dnl Set up underlay link from host into the namespace using veth pair. | |
674 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
675 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
676 | AT_CHECK([ip link set dev br-underlay up]) | |
677 | ||
678 | dnl Set up tunnel endpoints on OVS outside the namespace. | |
679 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
680 | ||
681 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
682 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
683 | dnl around it. | |
684 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
685 | on_exit 'iptables -D INPUT 1' | |
686 | ||
687 | ip netns exec at_ns0 tcpdump -n -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
688 | sleep 1 | |
689 | ||
690 | dnl First, check the underlay. | |
691 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
692 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
693 | ]) | |
694 | ||
695 | dnl We don't actually add gretap port as below, instead, we will | |
696 | dnl emulate one that sends packets. Suppose its mac address is f2:ff:00:00:00:04. | |
697 | dnl ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24]) | |
698 | ||
699 | dnl Now, check the overlay by sending out raw arp and icmp packets. | |
700 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff00000003080045000042ec2c4000402ff3bcac1f0101ac1f016400006558fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=NORMAL" | |
701 | ||
702 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0, length 46: ARP, Reply 10.1.1.100 is-at f2:ff:00:00:00:01.* length 28" 2>&1 1>/dev/null]) | |
703 | ||
704 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500007aec8e4000402ff322ac1f0101ac1f016400006558f2ff00000001f2ff00000004080045000054548f40004001cfb30a0101010a0101640800e6e829270003e1a3435b00000000ff1a050000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=NORMAL" | |
705 | ||
706 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0, length 102: IP 10.1.1.100 > 10.1.1.1: ICMP echo reply,.* length 64$" 2>&1 1>/dev/null]) | |
707 | ||
708 | OVS_TRAFFIC_VSWITCHD_STOP | |
709 | AT_CLEANUP | |
710 | ||
711 | AT_SETUP([datapath - ping over erspan v1 tunnel by simulated packets]) | |
e06c44a8 | 712 | OVS_CHECK_MIN_KERNEL(3, 10) |
eb27d96b YS |
713 | |
714 | OVS_TRAFFIC_VSWITCHD_START() | |
715 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
716 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
717 | ||
718 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
719 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
720 | ||
721 | ADD_NAMESPACES(at_ns0) | |
722 | ||
723 | dnl Set up underlay link from host into the namespace using veth pair. | |
724 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
725 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
726 | AT_CHECK([ip link set dev br-underlay up]) | |
727 | ||
728 | dnl Set up tunnel endpoints on OVS outside the namespace and emulate a native | |
729 | dnl linux device inside the namespace. | |
730 | ADD_OVS_TUNNEL([erspan], [br0], [at_erspan0], [172.31.1.1], [10.1.1.100/24], [options:key=1 options:erspan_ver=1 options:erspan_idx=7]) | |
731 | ||
732 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
733 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
734 | dnl around it. | |
735 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
736 | on_exit 'iptables -D INPUT 1' | |
737 | ||
738 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
739 | sleep 1 | |
740 | ||
741 | dnl First, check the underlay | |
742 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
743 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
744 | ]) | |
745 | ||
746 | dnl Okay, now send out an arp request from 10.1.1.1 for 10.1.1.100 in erspan. | |
747 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500004e151d4000402fcac0ac1f0101ac1f0164100088be000000061000000100000007fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
748 | ||
749 | dnl 0002 is arp reply, followed by mac address of 10.1.1.100. | |
750 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0030: 0806 0001 0800 0604 0002 f2ff 0000 0001" 2>&1 1>/dev/null]) | |
751 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0a01 0164 f2ff 0000 0004 0a01 0101" 2>&1 1>/dev/null]) | |
752 | ||
753 | dnl Okay, now check the overlay with raw icmp packets. | |
754 | AT_FAIL_IF([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 122" 2>&1 1>/dev/null]) | |
755 | ||
756 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500008e70cb4000402f6ed2ac1f0101ac1f0164100088be000000051000000100000007f2ff00000001f2ff0000000408004500005c4a3340004001da070a0101010a010164080084f238fb0001f36a6b5b0000000021870e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f actions=normal" | |
757 | ||
758 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 122" 2>&1 1>/dev/null]) | |
759 | ||
760 | OVS_TRAFFIC_VSWITCHD_STOP | |
761 | AT_CLEANUP | |
762 | ||
763 | AT_SETUP([datapath - ping over erspan v2 tunnel by simulated packets]) | |
e06c44a8 | 764 | OVS_CHECK_MIN_KERNEL(3, 10) |
eb27d96b YS |
765 | |
766 | OVS_TRAFFIC_VSWITCHD_START() | |
767 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
768 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
769 | ||
770 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
771 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
772 | ||
773 | ADD_NAMESPACES(at_ns0) | |
774 | ||
775 | dnl Set up underlay link from host into the namespace using veth pair. | |
776 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
777 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
778 | AT_CHECK([ip link set dev br-underlay up]) | |
779 | ||
780 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
781 | dnl linux device inside the namespace. | |
782 | ADD_OVS_TUNNEL([erspan], [br0], [at_erspan0], [172.31.1.1], [10.1.1.100/24], [options:key=1 options:erspan_ver=2 options:erspan_dir=1 options:erspan_hwid=0x7]) | |
783 | ||
784 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
785 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
786 | dnl around it. | |
787 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
788 | on_exit 'iptables -D INPUT 1' | |
789 | ||
790 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
791 | sleep 1 | |
792 | ||
793 | dnl First, check the underlay. | |
794 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
795 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
796 | ]) | |
797 | ||
798 | dnl Okay, send raw arp request and icmp echo request. | |
799 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff00000003080045000052373d4000402fa89cac1f0101ac1f0164100088be00000006200000016f54b41700008078fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
800 | ||
801 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0030: 0000 0001 0806 0001 0800 0604 0002 f2ff" 2>&1 1>/dev/null]) | |
802 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0000 0001 0a01 0164 f2ff 0000 0004 0a01" 2>&1 1>/dev/null]) | |
803 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0101" 2>&1 1>/dev/null]) | |
804 | ||
805 | dnl Because tcpdump might not be able to parse erspan headers, we check icmp echo reply | |
806 | dnl by packet length. | |
807 | AT_FAIL_IF([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 126" 2>&1 1>/dev/null]) | |
808 | ||
809 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500009287e14000402f57b8ac1f0101ac1f0164100088be0000000520000001144cd5a400008078f2ff00000001f2ff0000000408004500005c38d640004001eb640a0101010a01016408005e57585f0001df6c6b5b0000000045bc050000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f actions=normal" | |
810 | ||
811 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 126" 2>&1 1>/dev/null]) | |
812 | ||
813 | OVS_TRAFFIC_VSWITCHD_STOP | |
814 | AT_CLEANUP | |
815 | ||
816 | AT_SETUP([datapath - ping over ip6erspan v1 tunnel by simulated packets]) | |
e06c44a8 | 817 | OVS_CHECK_MIN_KERNEL(3, 10) |
eb27d96b YS |
818 | |
819 | OVS_TRAFFIC_VSWITCHD_START() | |
820 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
821 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
822 | ||
823 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
824 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
825 | ||
826 | ADD_NAMESPACES(at_ns0) | |
827 | ||
828 | dnl Set up underlay link from host into the namespace using veth pair. | |
829 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", f2:ff:00:00:00:03, [], nodad) | |
830 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
831 | AT_CHECK([ip link set dev br-underlay up]) | |
832 | ||
833 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
834 | dnl linux device inside the namespace. | |
835 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
836 | [options:key=123 options:erspan_ver=1 options:erspan_idx=0x7]) | |
837 | ||
838 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
839 | ||
840 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
841 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
842 | dnl around it. | |
843 | ip6tables -I INPUT 1 -i br-underlay -j ACCEPT | |
844 | on_exit 'ip6tables -D INPUT 1' | |
845 | ||
846 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host fc00:100::1 -l > p0.pcap & | |
847 | sleep 1 | |
848 | ||
849 | dnl First, check the underlay. | |
850 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
851 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
852 | ]) | |
853 | ||
854 | dnl Okay, now send raw arp request and icmp echo request. | |
855 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531003a2f40fc000100000000000000000000000001fc000100000000000000000000000100100088be000000051000007b00000007fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
856 | ||
857 | dnl Check arp reply. | |
858 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0000 0001 0806 0001 0800 0604 0002 f2ff" 2>&1 1>/dev/null]) | |
859 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0000 0001 0a01 0164 f2ff 0000 0004 0a01" 2>&1 1>/dev/null]) | |
860 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0060: 0101" 2>&1 1>/dev/null]) | |
861 | ||
862 | AT_FAIL_IF([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0,.* length 114" 2>&1 1>/dev/null]) | |
863 | ||
864 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531007a3c40fc000100000000000000000000000001fc0001000000000000000000000001002f00040104010100100088be000000061000407b00000007f2ff00000001f2ff0000000408004500005429b640004001fa8c0a0101010a01016408005c2c7526000118d3685b00000000e4aa020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=normal" | |
865 | ||
866 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0,.* length 114" 2>&1 1>/dev/null]) | |
867 | ||
868 | OVS_TRAFFIC_VSWITCHD_STOP | |
869 | AT_CLEANUP | |
870 | ||
871 | AT_SETUP([datapath - ping over ip6erspan v2 tunnel by simulated packets]) | |
e06c44a8 | 872 | OVS_CHECK_MIN_KERNEL(3, 10) |
eb27d96b YS |
873 | |
874 | OVS_TRAFFIC_VSWITCHD_START() | |
875 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
876 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
877 | ||
878 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
879 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
880 | ||
881 | ADD_NAMESPACES(at_ns0) | |
882 | ||
883 | dnl Set up underlay link from host into the namespace using veth pair. | |
884 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", f2:ff:00:00:00:03, [], nodad) | |
885 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
886 | AT_CHECK([ip link set dev br-underlay up]) | |
887 | ||
888 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
889 | dnl linux device inside the namespace. | |
890 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
891 | [options:key=121 options:erspan_ver=2 options:erspan_dir=0 options:erspan_hwid=0x7]) | |
892 | ||
893 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
894 | ||
895 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
896 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
897 | dnl around it. | |
898 | ip6tables -I INPUT 1 -i br-underlay -j ACCEPT | |
899 | on_exit 'ip6tables -D INPUT 1' | |
900 | ||
901 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host fc00:100::1 -l > p0.pcap & | |
902 | sleep 1 | |
903 | ||
904 | dnl First, check the underlay. | |
905 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
906 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
907 | ]) | |
908 | ||
909 | dnl Okay, now send raw arp request and icmp echo request. | |
910 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531003e2f40fc000100000000000000000000000001fc000100000000000000000000000100100088be0000000620000079af514f9900008070fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
911 | ||
912 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0004 f2ff 0000 0001 0806 0001 0800 0604" 2>&1 1>/dev/null]) | |
913 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0002 f2ff 0000 0001 0a01 0164 f2ff 0000" 2>&1 1>/dev/null]) | |
914 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0060: 0004 0a01 0101" 2>&1 1>/dev/null]) | |
915 | ||
916 | AT_FAIL_IF([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0, .* length 118" 2>&1 1>/dev/null]) | |
917 | ||
918 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531007e3c40fc000100000000000000000000000001fc0001000000000000000000000001002f00040104010100100088be0000000720004079af514f9b00008070f2ff00000001f2ff00000004080045000054ffcb4000400124770a0101010a0101640800419e23ac000112d7685b000000004caf0c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=normal" | |
919 | ||
920 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0, .* length 118" 2>&1 1>/dev/null]) | |
921 | ||
922 | OVS_TRAFFIC_VSWITCHD_STOP | |
923 | AT_CLEANUP | |
924 | ||
7ae62a67 WT |
925 | AT_SETUP([datapath - clone action]) |
926 | OVS_TRAFFIC_VSWITCHD_START() | |
927 | ||
928 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2) | |
929 | ||
930 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
931 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
7ae62a67 | 932 | |
88b5874e WT |
933 | AT_CHECK([ovs-vsctl -- set interface ovs-p0 ofport_request=1 \ |
934 | -- set interface ovs-p1 ofport_request=2]) | |
7ae62a67 | 935 | |
88b5874e WT |
936 | AT_DATA([flows.txt], [dnl |
937 | priority=1 actions=NORMAL | |
938 | priority=10 in_port=1,ip,actions=clone(mod_dl_dst(50:54:00:00:00:0a),set_field:192.168.3.3->ip_dst), output:2 | |
939 | priority=10 in_port=2,ip,actions=clone(mod_dl_src(ae:c6:7e:54:8d:4d),mod_dl_dst(50:54:00:00:00:0b),set_field:192.168.4.4->ip_dst, controller), output:1 | |
940 | ]) | |
941 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
7ae62a67 | 942 | |
88b5874e | 943 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) |
7ae62a67 WT |
944 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl |
945 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
946 | ]) | |
947 | ||
e8833217 DM |
948 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
949 | ||
88b5874e WT |
950 | AT_CHECK([cat ofctl_monitor.log | STRIP_MONITOR_CSUM], [0], [dnl |
951 | icmp,vlan_tci=0x0000,dl_src=ae:c6:7e:54:8d:4d,dl_dst=50:54:00:00:00:0b,nw_src=10.1.1.2,nw_dst=192.168.4.4,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=0,icmp_code=0 icmp_csum: <skip> | |
952 | icmp,vlan_tci=0x0000,dl_src=ae:c6:7e:54:8d:4d,dl_dst=50:54:00:00:00:0b,nw_src=10.1.1.2,nw_dst=192.168.4.4,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=0,icmp_code=0 icmp_csum: <skip> | |
953 | icmp,vlan_tci=0x0000,dl_src=ae:c6:7e:54:8d:4d,dl_dst=50:54:00:00:00:0b,nw_src=10.1.1.2,nw_dst=192.168.4.4,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=0,icmp_code=0 icmp_csum: <skip> | |
954 | ]) | |
7ae62a67 WT |
955 | |
956 | OVS_TRAFFIC_VSWITCHD_STOP | |
957 | AT_CLEANUP | |
958 | ||
457402dc YHW |
959 | AT_SETUP([datapath - mpls actions]) |
960 | OVS_TRAFFIC_VSWITCHD_START([_ADD_BR([br1])]) | |
961 | ||
962 | ADD_NAMESPACES(at_ns0, at_ns1) | |
963 | ||
964 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
965 | ADD_VETH(p1, at_ns1, br1, "10.1.1.2/24") | |
966 | ||
967 | AT_CHECK([ip link add patch0 type veth peer name patch1]) | |
968 | on_exit 'ip link del patch0' | |
969 | ||
970 | AT_CHECK([ip link set dev patch0 up]) | |
971 | AT_CHECK([ip link set dev patch1 up]) | |
972 | AT_CHECK([ovs-vsctl add-port br0 patch0]) | |
973 | AT_CHECK([ovs-vsctl add-port br1 patch1]) | |
974 | ||
975 | AT_DATA([flows.txt], [dnl | |
976 | table=0,priority=100,dl_type=0x0800 actions=push_mpls:0x8847,set_mpls_label:3,resubmit(,1) | |
977 | table=0,priority=100,dl_type=0x8847,mpls_label=3 actions=pop_mpls:0x0800,resubmit(,1) | |
978 | table=0,priority=10 actions=resubmit(,1) | |
979 | table=1,priority=10 actions=normal | |
980 | ]) | |
981 | ||
982 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
983 | AT_CHECK([ovs-ofctl add-flows br1 flows.txt]) | |
984 | ||
985 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
986 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
987 | ]) | |
988 | ||
989 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
990 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
991 | ]) | |
992 | ||
993 | OVS_TRAFFIC_VSWITCHD_STOP | |
994 | AT_CLEANUP | |
df711aae MV |
995 | |
996 | AT_SETUP([datapath - multiple mpls label pop]) | |
997 | OVS_TRAFFIC_VSWITCHD_START([_ADD_BR([br1])]) | |
998 | ||
999 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1000 | ||
1001 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1002 | ADD_VETH(p1, at_ns1, br1, "10.1.1.2/24") | |
1003 | ||
1004 | AT_CHECK([ip link add patch0 type veth peer name patch1]) | |
1005 | on_exit 'ip link del patch0' | |
1006 | ||
1007 | AT_CHECK([ip link set dev patch0 up]) | |
1008 | AT_CHECK([ip link set dev patch1 up]) | |
1009 | AT_CHECK([ovs-vsctl add-port br0 patch0]) | |
1010 | AT_CHECK([ovs-vsctl add-port br1 patch1]) | |
1011 | ||
1012 | AT_DATA([flows.txt], [dnl | |
1013 | table=0,priority=100,dl_type=0x0800 actions=push_mpls:0x8847,set_mpls_label:3,push_mpls:0x8847,set_mpls_label:2,push_mpls:0x8847,set_mpls_label:1,resubmit(,3) | |
1014 | table=0,priority=100,dl_type=0x8847,mpls_label=1 actions=pop_mpls:0x8847,resubmit(,1) | |
1015 | table=1,priority=100,dl_type=0x8847,mpls_label=2 actions=pop_mpls:0x8847,resubmit(,2) | |
1016 | table=2,priority=100,dl_type=0x8847,mpls_label=3 actions=pop_mpls:0x0800,resubmit(,3) | |
1017 | table=0,priority=10 actions=resubmit(,3) | |
1018 | table=3,priority=10 actions=normal | |
1019 | ]) | |
1020 | ||
1021 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1022 | AT_CHECK([ovs-ofctl add-flows br1 flows.txt]) | |
1023 | ||
1024 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
1025 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1026 | ]) | |
1027 | ||
1028 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
1029 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1030 | ]) | |
1031 | OVS_TRAFFIC_VSWITCHD_STOP | |
1032 | AT_CLEANUP | |
1033 | ||
aaca4fe0 | 1034 | AT_SETUP([datapath - basic truncate action]) |
9c1ab985 | 1035 | AT_SKIP_IF([test $HAVE_NC = no]) |
aaca4fe0 WT |
1036 | OVS_TRAFFIC_VSWITCHD_START() |
1037 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1038 | ||
1039 | dnl Create p0 and ovs-p0(1) | |
1040 | ADD_NAMESPACES(at_ns0) | |
1041 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1042 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
1043 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
1044 | ||
1045 | dnl Create p1(3) and ovs-p1(2), packets received from ovs-p1 will appear in p1 | |
1046 | AT_CHECK([ip link add p1 type veth peer name ovs-p1]) | |
1047 | on_exit 'ip link del ovs-p1' | |
1048 | AT_CHECK([ip link set dev ovs-p1 up]) | |
1049 | AT_CHECK([ip link set dev p1 up]) | |
1050 | AT_CHECK([ovs-vsctl add-port br0 ovs-p1 -- set interface ovs-p1 ofport_request=2]) | |
1051 | dnl Use p1 to check the truncated packet | |
1052 | AT_CHECK([ovs-vsctl add-port br0 p1 -- set interface p1 ofport_request=3]) | |
1053 | ||
1054 | dnl Create p2(5) and ovs-p2(4) | |
1055 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
1056 | on_exit 'ip link del ovs-p2' | |
1057 | AT_CHECK([ip link set dev ovs-p2 up]) | |
1058 | AT_CHECK([ip link set dev p2 up]) | |
1059 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=4]) | |
1060 | dnl Use p2 to check the truncated packet | |
1061 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=5]) | |
1062 | ||
1063 | dnl basic test | |
1064 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1065 | AT_DATA([flows.txt], [dnl | |
1066 | in_port=3 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1067 | in_port=5 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1068 | in_port=1 dl_dst=e6:66:c1:22:22:22 actions=output(port=2,max_len=100),output:4 | |
1069 | ]) | |
1070 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1071 | ||
1072 | dnl use this file as payload file for ncat | |
1073 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
1074 | on_exit 'rm -f payload200.bin' | |
a037f175 | 1075 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
1076 | |
1077 | dnl packet with truncated size | |
1078 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1079 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1080 | n_bytes=100 | |
1081 | ]) | |
1082 | dnl packet with original size | |
1083 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1084 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1085 | n_bytes=242 | |
1086 | ]) | |
1087 | ||
1088 | dnl more complicated output actions | |
1089 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1090 | AT_DATA([flows.txt], [dnl | |
1091 | in_port=3 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1092 | in_port=5 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1093 | in_port=1 dl_dst=e6:66:c1:22:22:22 actions=output(port=2,max_len=100),output:4,output(port=2,max_len=100),output(port=4,max_len=100),output:2,output(port=4,max_len=200),output(port=2,max_len=65535) | |
1094 | ]) | |
1095 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1096 | ||
a037f175 | 1097 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
1098 | |
1099 | dnl 100 + 100 + 242 + min(65535,242) = 684 | |
1100 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1101 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1102 | n_bytes=684 | |
1103 | ]) | |
1104 | dnl 242 + 100 + min(242,200) = 542 | |
1105 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1106 | n_bytes=542 | |
1107 | ]) | |
1108 | ||
1109 | dnl SLOW_ACTION: disable kernel datapath truncate support | |
1110 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
c7eca965 | 1111 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) |
aaca4fe0 WT |
1112 | |
1113 | dnl SLOW_ACTION test1: check datapatch actions | |
1114 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1115 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1116 | ||
3041e1fc | 1117 | AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_type=0x800,dl_src=e6:66:c1:11:11:11,dl_dst=e6:66:c1:22:22:22,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,tp_src=8,tp_dst=9"], [0], [stdout]) |
aaca4fe0 WT |
1118 | AT_CHECK([tail -3 stdout], [0], |
1119 | [Datapath actions: trunc(100),3,5,trunc(100),3,trunc(100),5,3,trunc(200),5,trunc(65535),3 | |
1120 | This flow is handled by the userspace slow path because it: | |
393e9f7c | 1121 | - Uses action(s) not supported by datapath. |
aaca4fe0 | 1122 | ]) |
aaca4fe0 WT |
1123 | |
1124 | dnl SLOW_ACTION test2: check actual packet truncate | |
1125 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1126 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a037f175 | 1127 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
1128 | |
1129 | dnl 100 + 100 + 242 + min(65535,242) = 684 | |
1130 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1131 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1132 | n_bytes=684 | |
1133 | ]) | |
1134 | ||
1135 | dnl 242 + 100 + min(242,200) = 542 | |
1136 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1137 | n_bytes=542 | |
1138 | ]) | |
1139 | ||
1140 | OVS_TRAFFIC_VSWITCHD_STOP | |
1141 | AT_CLEANUP | |
1142 | ||
348f1f67 YS |
1143 | dnl Create 2 bridges and 2 namespaces to test truncate over |
1144 | dnl GRE tunnel: | |
1145 | dnl br0: overlay bridge | |
1146 | dnl ns1: connect to br0, with IP:10.1.1.2 | |
1147 | dnl br-underlay: with IP: 172.31.1.100 | |
1148 | dnl ns0: connect to br-underlay, with IP: 10.1.1.1 | |
1149 | AT_SETUP([datapath - truncate and output to gre tunnel by simulated packets]) | |
e06c44a8 | 1150 | OVS_CHECK_MIN_KERNEL(3, 10) |
348f1f67 YS |
1151 | AT_SKIP_IF([test $HAVE_NC = no]) |
1152 | OVS_TRAFFIC_VSWITCHD_START() | |
1153 | ||
1154 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"02:90:8c:a8:a1:49\"]) | |
1155 | ADD_NAMESPACES(at_ns0) | |
1156 | ADD_NAMESPACES(at_ns1) | |
1157 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
1158 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
1159 | ||
1160 | dnl Set up underlay link from host into the namespace using veth pair. | |
1161 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", fa:ad:fa:25:05:60) | |
1162 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
1163 | AT_CHECK([ip link set dev br-underlay up]) | |
1164 | ||
1165 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
1166 | dnl linux device inside the namespace. | |
1167 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
1168 | ||
1169 | dnl The below native tunnel isn't actually added. We simulate it to send | |
1170 | dnl and receive packets. | |
1171 | dnl ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
1172 | dnl [], [address e6:66:c1:11:11:11]) | |
1173 | dnl AT_CHECK([ovs-vsctl -- set interface at_gre0 ofport_request=1]) | |
1174 | dnl NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
1175 | ||
1176 | dnl Set up (p1 and ovs-p1) at br0 | |
1177 | ADD_VETH(p1, at_ns1, br0, '10.1.1.2/24') | |
1178 | AT_CHECK([ovs-vsctl -- set interface ovs-p1 ofport_request=2]) | |
1179 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
1180 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
1181 | ||
1182 | dnl Set up (p2 and ovs-p2) as loopback for verifying packet size | |
1183 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
1184 | on_exit 'ip link del ovs-p2' | |
1185 | AT_CHECK([ip link set dev ovs-p2 up]) | |
1186 | AT_CHECK([ip link set dev p2 up]) | |
1187 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=3]) | |
1188 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=4]) | |
1189 | ||
1190 | dnl use this file as payload file for ncat | |
1191 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
1192 | on_exit 'rm -f payload200.bin' | |
1193 | ||
1194 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1195 | AT_DATA([flows.txt], [dnl | |
1196 | priority=99,in_port=1,actions=output(port=2,max_len=100),output(port=3,max_len=100) | |
1197 | priority=99,in_port=2,udp,actions=output(port=1,max_len=100) | |
1198 | priority=1,in_port=4,ip,actions=drop | |
1199 | priority=1,actions=drop | |
1200 | ]) | |
1201 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1202 | ||
1203 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1204 | AT_DATA([flows-underlay.txt], [dnl | |
1205 | priority=99,dl_type=0x0800,nw_proto=47,in_port=1,actions=LOCAL | |
1206 | priority=99,dl_type=0x0800,nw_proto=47,in_port=LOCAL,ip_dst=172.31.1.1/24,actions=1 | |
1207 | priority=1,actions=drop | |
1208 | ]) | |
1209 | ||
1210 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1211 | ||
1212 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
1213 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) | |
1214 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1215 | ||
1216 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1217 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1218 | n_bytes=242 | |
1219 | ]) | |
1220 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1221 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1222 | n_bytes=138 | |
1223 | ]) | |
1224 | ||
1225 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
1226 | dnl This 200-byte packet is simulated on behalf of ns_gre0 | |
1227 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=02908ca8a149faadfa25056008004500010a9e9d4000402f4084ac1f0101ac1f016400006558e666c1222222e666c11111110800450000e46f8e40004011b4760a0101010a010102e026162e00d016e6a366ebf904c74132c6fed42a9e9e46240b4d9fd13c9b47d9704a388e70a5e77db16934a6188dc01d86aa20007ace2cf9cdb111f208474b88ffc851c871f0e3fb4fff138c1d288d437efff487e2b86a9c99fbf4229a6485e133bcf3e16f6e345207fda0932d9eeb602740456fd077b4847d25481337bd716155cc245be129ccc11bf82b834767b3760b52fe913c0e24f31c0e1b27f88acf7bba6b985fb64ee2cd6fc6bba1a9c1f021e253e1728b046fd4d023307e3296361a37ea2617ebcb2537e0284a81050dd0ee actions=LOCAL" | |
1228 | ||
1229 | dnl After truncation = 100 byte at loopback device p2(4) | |
1230 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1231 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl | |
1232 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
1233 | ]) | |
1234 | ||
1235 | dnl SLOW_ACTION: disable datapath truncate support | |
1236 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
1237 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) | |
1238 | ||
1239 | dnl SLOW_ACTION test1: check datapatch actions | |
1240 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1241 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1242 | ||
1243 | dnl SLOW_ACTION test2: check actual packet truncate | |
1244 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1245 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1246 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1247 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1248 | ||
1249 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
1250 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) | |
1251 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1252 | ||
1253 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1254 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1255 | n_bytes=242 | |
1256 | ]) | |
1257 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1258 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1259 | n_bytes=138 | |
1260 | ]) | |
1261 | ||
1262 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
1263 | dnl This 200-byte packet is simulated on behalf of ns_gre0 | |
1264 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=02908ca8a149faadfa25056008004500010a9e9d4000402f4084ac1f0101ac1f016400006558e666c1222222e666c11111110800450000e46f8e40004011b4760a0101010a010102e026162e00d016e6a366ebf904c74132c6fed42a9e9e46240b4d9fd13c9b47d9704a388e70a5e77db16934a6188dc01d86aa20007ace2cf9cdb111f208474b88ffc851c871f0e3fb4fff138c1d288d437efff487e2b86a9c99fbf4229a6485e133bcf3e16f6e345207fda0932d9eeb602740456fd077b4847d25481337bd716155cc245be129ccc11bf82b834767b3760b52fe913c0e24f31c0e1b27f88acf7bba6b985fb64ee2cd6fc6bba1a9c1f021e253e1728b046fd4d023307e3296361a37ea2617ebcb2537e0284a81050dd0ee actions=LOCAL" | |
1265 | ||
1266 | dnl After truncation = 100 byte at loopback device p2(4) | |
1267 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1268 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl | |
1269 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
1270 | ]) | |
1271 | ||
1272 | OVS_TRAFFIC_VSWITCHD_STOP | |
1273 | AT_CLEANUP | |
1274 | ||
aaca4fe0 WT |
1275 | dnl Create 2 bridges and 2 namespaces to test truncate over |
1276 | dnl GRE tunnel: | |
1277 | dnl br0: overlay bridge | |
1278 | dnl ns1: connect to br0, with IP:10.1.1.2 | |
1279 | dnl br-underlay: with IP: 172.31.1.100 | |
1280 | dnl ns0: connect to br-underlay, with IP: 10.1.1.1 | |
1281 | AT_SETUP([datapath - truncate and output to gre tunnel]) | |
9c1ab985 | 1282 | AT_SKIP_IF([test $HAVE_NC = no]) |
348f1f67 | 1283 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
aaca4fe0 WT |
1284 | OVS_CHECK_GRE() |
1285 | OVS_TRAFFIC_VSWITCHD_START() | |
1286 | ||
1287 | ADD_BR([br-underlay]) | |
1288 | ADD_NAMESPACES(at_ns0) | |
1289 | ADD_NAMESPACES(at_ns1) | |
1290 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
1291 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
1292 | ||
1293 | dnl Set up underlay link from host into the namespace using veth pair. | |
1294 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
1295 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
1296 | AT_CHECK([ip link set dev br-underlay up]) | |
1297 | ||
1298 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
1299 | dnl linux device inside the namespace. | |
1300 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
2b9f3924 WT |
1301 | ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24], |
1302 | [], [address e6:66:c1:11:11:11]) | |
aaca4fe0 | 1303 | AT_CHECK([ovs-vsctl -- set interface at_gre0 ofport_request=1]) |
aaca4fe0 WT |
1304 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) |
1305 | ||
1306 | dnl Set up (p1 and ovs-p1) at br0 | |
1307 | ADD_VETH(p1, at_ns1, br0, '10.1.1.2/24') | |
1308 | AT_CHECK([ovs-vsctl -- set interface ovs-p1 ofport_request=2]) | |
1309 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
1310 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
1311 | ||
1312 | dnl Set up (p2 and ovs-p2) as loopback for verifying packet size | |
1313 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
1314 | on_exit 'ip link del ovs-p2' | |
1315 | AT_CHECK([ip link set dev ovs-p2 up]) | |
1316 | AT_CHECK([ip link set dev p2 up]) | |
1317 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=3]) | |
1318 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=4]) | |
1319 | ||
1320 | dnl use this file as payload file for ncat | |
1321 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
1322 | on_exit 'rm -f payload200.bin' | |
1323 | ||
1324 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1325 | AT_DATA([flows.txt], [dnl | |
1326 | priority=99,in_port=1,actions=output(port=2,max_len=100),output(port=3,max_len=100) | |
1327 | priority=99,in_port=2,udp,actions=output(port=1,max_len=100) | |
1328 | priority=1,in_port=4,ip,actions=drop | |
1329 | priority=1,actions=drop | |
1330 | ]) | |
1331 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1332 | ||
1333 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1334 | AT_DATA([flows-underlay.txt], [dnl | |
1335 | priority=99,dl_type=0x0800,nw_proto=47,in_port=1,actions=LOCAL | |
1336 | priority=99,dl_type=0x0800,nw_proto=47,in_port=LOCAL,ip_dst=172.31.1.1/24,actions=1 | |
1337 | priority=1,actions=drop | |
1338 | ]) | |
1339 | ||
1340 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1341 | ||
1342 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
a037f175 | 1343 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) |
aaca4fe0 WT |
1344 | AT_CHECK([ovs-appctl revalidator/purge], [0]) |
1345 | ||
1346 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1347 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1348 | n_bytes=242 | |
1349 | ]) | |
1350 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1351 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1352 | n_bytes=138 | |
1353 | ]) | |
1354 | ||
1355 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
a037f175 | 1356 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 < payload200.bin]) |
aaca4fe0 WT |
1357 | dnl After truncation = 100 byte at loopback device p2(4) |
1358 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
32b0cc65 JS |
1359 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl |
1360 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
aaca4fe0 WT |
1361 | ]) |
1362 | ||
1363 | dnl SLOW_ACTION: disable datapath truncate support | |
1364 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
c7eca965 | 1365 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) |
aaca4fe0 WT |
1366 | |
1367 | dnl SLOW_ACTION test1: check datapatch actions | |
1368 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1369 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1370 | ||
aaca4fe0 WT |
1371 | dnl SLOW_ACTION test2: check actual packet truncate |
1372 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1373 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1374 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1375 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1376 | ||
1377 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
a037f175 | 1378 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) |
aaca4fe0 WT |
1379 | AT_CHECK([ovs-appctl revalidator/purge], [0]) |
1380 | ||
1381 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1382 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1383 | n_bytes=242 | |
1384 | ]) | |
1385 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1386 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1387 | n_bytes=138 | |
1388 | ]) | |
1389 | ||
1390 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
a037f175 | 1391 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 < payload200.bin]) |
aaca4fe0 WT |
1392 | dnl After truncation = 100 byte at loopback device p2(4) |
1393 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
32b0cc65 JS |
1394 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl |
1395 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
aaca4fe0 WT |
1396 | ]) |
1397 | ||
1398 | OVS_TRAFFIC_VSWITCHD_STOP | |
1399 | AT_CLEANUP | |
1400 | ||
ee8941ab JS |
1401 | AT_BANNER([conntrack]) |
1402 | ||
07659514 JS |
1403 | AT_SETUP([conntrack - controller]) |
1404 | CHECK_CONNTRACK() | |
cf7659b6 | 1405 | OVS_TRAFFIC_VSWITCHD_START() |
daf4d3c1 | 1406 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) |
07659514 JS |
1407 | |
1408 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1409 | ||
1410 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1411 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1412 | ||
1413 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1414 | AT_DATA([flows.txt], [dnl | |
1415 | priority=1,action=drop | |
1416 | priority=10,arp,action=normal | |
1417 | priority=100,in_port=1,udp,action=ct(commit),controller | |
1418 | priority=100,in_port=2,ct_state=-trk,udp,action=ct(table=0) | |
1419 | priority=100,in_port=2,ct_state=+trk+est,udp,action=controller | |
1420 | ]) | |
1421 | ||
6cfa8ec3 | 1422 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 JS |
1423 | |
1424 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
1425 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
1426 | ||
1427 | dnl Send an unsolicited reply from port 2. This should be dropped. | |
4573c42e | 1428 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=0\) '50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000']) |
07659514 JS |
1429 | |
1430 | dnl OK, now start a new connection from port 1. | |
4573c42e | 1431 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit\),controller '50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000']) |
07659514 JS |
1432 | |
1433 | dnl Now try a reply from port 2. | |
4573c42e | 1434 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=0\) '50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000']) |
07659514 | 1435 | |
e8833217 DM |
1436 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
1437 | ||
07659514 JS |
1438 | dnl Check this output. We only see the latter two packets, not the first. |
1439 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
f274a047 | 1440 | NXT_PACKET_IN2 (xid=0x0): total_len=42 in_port=1 (via action) data_len=42 (unbuffered) |
07659514 | 1441 | udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1,tp_dst=2 udp_csum:0 |
45e46e92 | 1442 | NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=42 (unbuffered) |
07659514 JS |
1443 | udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=2,tp_dst=1 udp_csum:0 |
1444 | ]) | |
1445 | ||
1446 | OVS_TRAFFIC_VSWITCHD_STOP | |
1447 | AT_CLEANUP | |
1448 | ||
a76a37ef JR |
1449 | AT_SETUP([conntrack - force commit]) |
1450 | CHECK_CONNTRACK() | |
1451 | OVS_TRAFFIC_VSWITCHD_START() | |
1452 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) | |
1453 | ||
1454 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1455 | ||
1456 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1457 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1458 | ||
1459 | AT_DATA([flows.txt], [dnl | |
1460 | priority=1,action=drop | |
1461 | priority=10,arp,action=normal | |
68c94b1a | 1462 | priority=100,in_port=1,udp,action=ct(force,commit),controller |
a76a37ef JR |
1463 | priority=100,in_port=2,ct_state=-trk,udp,action=ct(table=0) |
1464 | priority=100,in_port=2,ct_state=+trk+est,udp,action=ct(force,commit,table=1) | |
1465 | table=1,in_port=2,ct_state=+trk,udp,action=controller | |
1466 | ]) | |
1467 | ||
1468 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1469 | ||
1470 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
1471 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
1472 | ||
1473 | dnl Send an unsolicited reply from port 2. This should be dropped. | |
1474 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1475 | ||
1476 | dnl OK, now start a new connection from port 1. | |
1477 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1478 | ||
1479 | dnl Now try a reply from port 2. | |
1480 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1481 | ||
1482 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1483 | ||
e8833217 DM |
1484 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
1485 | ||
a76a37ef JR |
1486 | dnl Check this output. We only see the latter two packets, not the first. |
1487 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
1488 | NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered) | |
1489 | udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1,tp_dst=2 udp_csum:0 | |
45e46e92 | 1490 | NXT_PACKET_IN2 (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=new|trk,ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1,ip,in_port=2 (via action) data_len=42 (unbuffered) |
a76a37ef JR |
1491 | udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=2,tp_dst=1 udp_csum:0 |
1492 | ]) | |
1493 | ||
1494 | dnl | |
1495 | dnl Check that the directionality has been changed by force commit. | |
1496 | dnl | |
1497 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [], [dnl | |
1498 | udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1),reply=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2) | |
1499 | ]) | |
1500 | ||
68c94b1a JS |
1501 | dnl OK, now send another packet from port 1 and see that it switches again |
1502 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1503 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1504 | ||
1505 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [], [dnl | |
1506 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2),reply=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1) | |
1507 | ]) | |
1508 | ||
a76a37ef JR |
1509 | OVS_TRAFFIC_VSWITCHD_STOP |
1510 | AT_CLEANUP | |
1511 | ||
c43a1331 YHW |
1512 | AT_SETUP([conntrack - ct flush by 5-tuple]) |
1513 | CHECK_CONNTRACK() | |
c43a1331 YHW |
1514 | OVS_TRAFFIC_VSWITCHD_START() |
1515 | ||
1516 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1517 | ||
1518 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1519 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1520 | ||
1521 | AT_DATA([flows.txt], [dnl | |
1522 | priority=1,action=drop | |
1523 | priority=10,arp,action=normal | |
1524 | priority=100,in_port=1,udp,action=ct(commit),2 | |
1525 | priority=100,in_port=2,udp,action=ct(zone=5,commit),1 | |
1526 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1527 | priority=100,in_port=2,icmp,action=ct(zone=5,commit),1 | |
1528 | ]) | |
1529 | ||
1530 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1531 | ||
1532 | dnl Test UDP from port 1 | |
1533 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1534 | ||
1535 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [], [dnl | |
1536 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2),reply=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1) | |
1537 | ]) | |
1538 | ||
1539 | AT_CHECK([ovs-appctl dpctl/flush-conntrack 'ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1']) | |
1540 | ||
1541 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [1], [dnl | |
1542 | ]) | |
1543 | ||
1544 | dnl Test UDP from port 2 | |
1545 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1546 | ||
1547 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [0], [dnl | |
1548 | udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1),reply=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2),zone=5 | |
1549 | ]) | |
1550 | ||
1551 | AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=5 'ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2']) | |
1552 | ||
1553 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1554 | ]) | |
1555 | ||
1556 | dnl Test ICMP traffic | |
1557 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
1558 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1559 | ]) | |
1560 | ||
1561 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [0], [stdout]) | |
1562 | AT_CHECK([cat stdout | FORMAT_CT(10.1.1.1)], [0],[dnl | |
1563 | icmp,orig=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=8,code=0),reply=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=0,code=0),zone=5 | |
1564 | ]) | |
1565 | ||
1566 | ICMP_ID=`cat stdout | cut -d ',' -f4 | cut -d '=' -f2` | |
1567 | ICMP_TUPLE=ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=1,icmp_id=$ICMP_ID,icmp_type=8,icmp_code=0 | |
1568 | AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=5 $ICMP_TUPLE]) | |
1569 | ||
1570 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [1], [dnl | |
1571 | ]) | |
1572 | ||
ffdcd110 | 1573 | OVS_TRAFFIC_VSWITCHD_STOP |
c43a1331 YHW |
1574 | AT_CLEANUP |
1575 | ||
e5cf8cce DDP |
1576 | AT_SETUP([conntrack - IPv4 ping]) |
1577 | CHECK_CONNTRACK() | |
1578 | OVS_TRAFFIC_VSWITCHD_START() | |
1579 | ||
1580 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1581 | ||
1582 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1583 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1584 | ||
1585 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1586 | AT_DATA([flows.txt], [dnl | |
1587 | priority=1,action=drop | |
1588 | priority=10,arp,action=normal | |
1589 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1590 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
1591 | priority=100,in_port=2,icmp,ct_state=+trk+est,action=1 | |
1592 | ]) | |
1593 | ||
1594 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1595 | ||
1596 | dnl Pings from ns0->ns1 should work fine. | |
1597 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
1598 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1599 | ]) | |
1600 | ||
1601 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1602 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0) | |
1603 | ]) | |
1604 | ||
1605 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1606 | ||
1607 | dnl Pings from ns1->ns0 should fail. | |
1608 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
1609 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
1610 | ]) | |
1611 | ||
1612 | OVS_TRAFFIC_VSWITCHD_STOP | |
1613 | AT_CLEANUP | |
1614 | ||
26509f88 DB |
1615 | AT_SETUP([conntrack - get_nconns and get/set_maxconns]) |
1616 | CHECK_CONNTRACK() | |
1617 | CHECK_CT_DPIF_SET_GET_MAXCONNS() | |
1618 | CHECK_CT_DPIF_GET_NCONNS() | |
1619 | OVS_TRAFFIC_VSWITCHD_START() | |
1620 | ||
1621 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1622 | ||
1623 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1624 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1625 | ||
1626 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1627 | AT_DATA([flows.txt], [dnl | |
1628 | priority=1,action=drop | |
1629 | priority=10,arp,action=normal | |
1630 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1631 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
1632 | priority=100,in_port=2,icmp,ct_state=+trk+est,action=1 | |
1633 | ]) | |
1634 | ||
1635 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1636 | ||
1637 | dnl Pings from ns0->ns1 should work fine. | |
1638 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
1639 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1640 | ]) | |
1641 | ||
1642 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1643 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0) | |
1644 | ]) | |
1645 | ||
1646 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns one-bad-dp], [2], [], [dnl | |
1647 | ovs-vswitchd: maxconns missing or malformed (Invalid argument) | |
1648 | ovs-appctl: ovs-vswitchd: server returned an error | |
1649 | ]) | |
1650 | ||
1651 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns a], [2], [], [dnl | |
1652 | ovs-vswitchd: maxconns missing or malformed (Invalid argument) | |
1653 | ovs-appctl: ovs-vswitchd: server returned an error | |
1654 | ]) | |
1655 | ||
1656 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns one-bad-dp 10], [2], [], [dnl | |
ffdcd110 | 1657 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1658 | ovs-appctl: ovs-vswitchd: server returned an error |
1659 | ]) | |
1660 | ||
1661 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns one-bad-dp], [2], [], [dnl | |
ffdcd110 | 1662 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1663 | ovs-appctl: ovs-vswitchd: server returned an error |
1664 | ]) | |
1665 | ||
1666 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns one-bad-dp], [2], [], [dnl | |
ffdcd110 | 1667 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1668 | ovs-appctl: ovs-vswitchd: server returned an error |
1669 | ]) | |
1670 | ||
1671 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns], [], [dnl | |
1672 | 1 | |
1673 | ]) | |
1674 | ||
1675 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1676 | 3000000 | |
1677 | ]) | |
1678 | ||
1679 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns 10], [], [dnl | |
1680 | setting maxconns successful | |
1681 | ]) | |
1682 | ||
1683 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1684 | 10 | |
1685 | ]) | |
1686 | ||
1687 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1688 | ||
1689 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns], [], [dnl | |
1690 | 0 | |
1691 | ]) | |
1692 | ||
1693 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1694 | 10 | |
1695 | ]) | |
1696 | ||
ffdcd110 | 1697 | OVS_TRAFFIC_VSWITCHD_STOP |
26509f88 DB |
1698 | AT_CLEANUP |
1699 | ||
e5cf8cce DDP |
1700 | AT_SETUP([conntrack - IPv6 ping]) |
1701 | CHECK_CONNTRACK() | |
1702 | OVS_TRAFFIC_VSWITCHD_START() | |
1703 | ||
1704 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1705 | ||
1706 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
1707 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
1708 | ||
1709 | AT_DATA([flows.txt], [dnl | |
1710 | ||
1711 | dnl ICMPv6 echo request and reply go to table 1. The rest of the traffic goes | |
1712 | dnl through normal action. | |
1713 | table=0,priority=10,icmp6,icmp_type=128,action=goto_table:1 | |
1714 | table=0,priority=10,icmp6,icmp_type=129,action=goto_table:1 | |
1715 | table=0,priority=1,action=normal | |
1716 | ||
1717 | dnl Allow everything from ns0->ns1. Only allow return traffic from ns1->ns0. | |
1718 | table=1,priority=100,in_port=1,icmp6,action=ct(commit),2 | |
1719 | table=1,priority=100,in_port=2,icmp6,ct_state=-trk,action=ct(table=0) | |
1720 | table=1,priority=100,in_port=2,icmp6,ct_state=+trk+est,action=1 | |
1721 | table=1,priority=1,action=drop | |
1722 | ]) | |
1723 | ||
1724 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1725 | ||
1726 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
1727 | ||
027f7e84 DDP |
1728 | dnl The above ping creates state in the connection tracker. We're not |
1729 | dnl interested in that state. | |
1730 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1731 | ||
e5cf8cce DDP |
1732 | dnl Pings from ns1->ns0 should fail. |
1733 | NS_CHECK_EXEC([at_ns1], [ping6 -q -c 3 -i 0.3 -w 2 fc00::1 | FORMAT_PING], [0], [dnl | |
1734 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
1735 | ]) | |
1736 | ||
1737 | dnl Pings from ns0->ns1 should work fine. | |
1738 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
1739 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1740 | ]) | |
1741 | ||
1742 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
1743 | icmpv6,orig=(src=fc00::1,dst=fc00::2,id=<cleared>,type=128,code=0),reply=(src=fc00::2,dst=fc00::1,id=<cleared>,type=129,code=0) | |
1744 | ]) | |
1745 | ||
1746 | OVS_TRAFFIC_VSWITCHD_STOP | |
1747 | AT_CLEANUP | |
1748 | ||
07659514 JS |
1749 | AT_SETUP([conntrack - preserve registers]) |
1750 | CHECK_CONNTRACK() | |
cf7659b6 | 1751 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1752 | |
1753 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1754 | ||
1755 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1756 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1757 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1758 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1759 | ||
1760 | dnl Allow any traffic from ns0->ns1, ns2->ns3. | |
1761 | AT_DATA([flows.txt], [dnl | |
1762 | priority=1,action=drop | |
1763 | priority=10,arp,action=normal | |
1764 | priority=10,icmp,action=normal | |
1765 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,table=0) | |
1766 | priority=100,in_port=1,tcp,ct_state=+trk,action=2 | |
1767 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0) | |
1768 | priority=100,in_port=2,tcp,ct_state=+trk,action=1 | |
1769 | priority=100,in_port=3,tcp,ct_state=-trk,action=load:0->NXM_NX_REG0[[]],ct(table=0) | |
1770 | priority=100,in_port=3,tcp,ct_state=+trk,reg0=0,action=load:1->NXM_NX_REG0[[]],ct(commit,table=0) | |
1771 | priority=100,in_port=3,tcp,ct_state=+trk,reg0=1,action=4 | |
1772 | priority=100,in_port=4,tcp,ct_state=-trk,action=ct(commit,table=0) | |
1773 | priority=100,in_port=4,tcp,ct_state=+trk,action=3 | |
1774 | ]) | |
1775 | ||
6cfa8ec3 | 1776 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1777 | |
7ed40afe JS |
1778 | OVS_START_L7([at_ns1], [http]) |
1779 | OVS_START_L7([at_ns3], [http]) | |
1780 | ||
07659514 | 1781 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1782 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1783 | ||
1784 | dnl HTTP requests from p2->p3 should work fine. | |
07659514 JS |
1785 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) |
1786 | ||
1787 | OVS_TRAFFIC_VSWITCHD_STOP | |
1788 | AT_CLEANUP | |
1789 | ||
1790 | AT_SETUP([conntrack - invalid]) | |
1791 | CHECK_CONNTRACK() | |
cf7659b6 | 1792 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1793 | |
1794 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1795 | ||
1796 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1797 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1798 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1799 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1800 | ||
1801 | dnl Pass traffic from ns0->ns1 without committing, but attempt to track in | |
1802 | dnl the opposite direction. This should fail. | |
1803 | dnl Pass traffic from ns3->ns4 without committing, and this time match | |
1804 | dnl invalid traffic and allow it through. | |
1805 | AT_DATA([flows.txt], [dnl | |
1806 | priority=1,action=drop | |
1807 | priority=10,arp,action=normal | |
1808 | priority=10,icmp,action=normal | |
1809 | priority=100,in_port=1,tcp,action=ct(),2 | |
1810 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
1811 | priority=100,in_port=2,ct_state=+trk+new,tcp,action=1 | |
1812 | priority=100,in_port=3,tcp,action=ct(),4 | |
1813 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
1814 | priority=100,in_port=4,ct_state=+trk+inv,tcp,action=3 | |
1815 | priority=100,in_port=4,ct_state=+trk+new,tcp,action=3 | |
1816 | ]) | |
1817 | ||
6cfa8ec3 | 1818 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 JS |
1819 | |
1820 | dnl We set up our rules to allow the request without committing. The return | |
1821 | dnl traffic can't be identified, because the initial request wasn't committed. | |
1822 | dnl For the first pair of ports, this means that the connection fails. | |
7ed40afe JS |
1823 | OVS_START_L7([at_ns1], [http]) |
1824 | OVS_START_L7([at_ns3], [http]) | |
07659514 JS |
1825 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log], [4]) |
1826 | ||
1827 | dnl For the second pair, we allow packets from invalid connections, so it works. | |
07659514 JS |
1828 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) |
1829 | ||
1830 | OVS_TRAFFIC_VSWITCHD_STOP | |
1831 | AT_CLEANUP | |
1832 | ||
1833 | AT_SETUP([conntrack - zones]) | |
1834 | CHECK_CONNTRACK() | |
cf7659b6 | 1835 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1836 | |
1837 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1838 | ||
1839 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1840 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1841 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1842 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1843 | ||
1844 | dnl Allow any traffic from ns0->ns1. Allow return traffic, matching on zone. | |
1845 | dnl For ns2->ns3, use a different zone and see that the match fails. | |
1846 | AT_DATA([flows.txt], [dnl | |
1847 | priority=1,action=drop | |
1848 | priority=10,arp,action=normal | |
1849 | priority=10,icmp,action=normal | |
1850 | priority=100,in_port=1,tcp,action=ct(commit,zone=1),2 | |
1851 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=1) | |
1852 | priority=100,in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
1853 | priority=100,in_port=3,tcp,action=ct(commit,zone=2),4 | |
1854 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0,zone=2) | |
1855 | priority=100,in_port=4,ct_state=+trk,ct_zone=1,tcp,action=3 | |
1856 | ]) | |
1857 | ||
6cfa8ec3 | 1858 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1859 | |
7ed40afe JS |
1860 | OVS_START_L7([at_ns1], [http]) |
1861 | OVS_START_L7([at_ns3], [http]) | |
1862 | ||
07659514 | 1863 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1864 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1865 | ||
ec3aa16c | 1866 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 1867 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
07659514 JS |
1868 | ]) |
1869 | ||
1870 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
1871 | dnl Try 3 times, in 1 second intervals. | |
07659514 JS |
1872 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
1873 | ||
ec3aa16c | 1874 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 1875 | tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) |
07659514 JS |
1876 | ]) |
1877 | ||
1878 | OVS_TRAFFIC_VSWITCHD_STOP | |
1879 | AT_CLEANUP | |
1880 | ||
1881 | AT_SETUP([conntrack - zones from field]) | |
1882 | CHECK_CONNTRACK() | |
cf7659b6 | 1883 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1884 | |
1885 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1886 | ||
1887 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1888 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1889 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1890 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1891 | ||
1892 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1893 | AT_DATA([flows.txt], [dnl | |
1894 | priority=1,action=drop | |
1895 | priority=10,arp,action=normal | |
1896 | priority=10,icmp,action=normal | |
1897 | priority=100,in_port=1,tcp,action=load:0x1001->NXM_NX_REG0[[0..15]],ct(commit,zone=NXM_NX_REG0[[0..15]]),2 | |
1898 | priority=100,in_port=2,ct_state=-trk,tcp,action=load:0x1001->NXM_NX_REG0[[0..15]],ct(table=0,zone=NXM_NX_REG0[[0..15]]) | |
1899 | priority=100,in_port=2,ct_state=+trk,ct_zone=0x1001,tcp,action=1 | |
1900 | priority=100,in_port=3,tcp,action=load:0x1002->NXM_NX_REG0[[0..15]],ct(commit,zone=NXM_NX_REG0[[0..15]]),4 | |
1901 | priority=100,in_port=4,ct_state=-trk,tcp,action=load:0x1002->NXM_NX_REG0[[0..15]],ct(table=0,zone=NXM_NX_REG0[[0..15]]) | |
1902 | priority=100,in_port=4,ct_state=+trk,ct_zone=0x1001,tcp,action=3 | |
1903 | ]) | |
1904 | ||
6cfa8ec3 | 1905 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1906 | |
7ed40afe JS |
1907 | OVS_START_L7([at_ns1], [http]) |
1908 | OVS_START_L7([at_ns3], [http]) | |
1909 | ||
07659514 | 1910 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1911 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1912 | ||
ec3aa16c | 1913 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 1914 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=4097,protoinfo=(state=<cleared>) |
07659514 JS |
1915 | ]) |
1916 | ||
1917 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
1918 | dnl Try 3 times, in 1 second intervals. | |
07659514 JS |
1919 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
1920 | ||
ec3aa16c | 1921 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 1922 | tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),zone=4098,protoinfo=(state=<cleared>) |
07659514 JS |
1923 | ]) |
1924 | ||
1925 | OVS_TRAFFIC_VSWITCHD_STOP | |
1926 | AT_CLEANUP | |
1927 | ||
1928 | AT_SETUP([conntrack - multiple bridges]) | |
1929 | CHECK_CONNTRACK() | |
1930 | OVS_TRAFFIC_VSWITCHD_START( | |
cf7659b6 | 1931 | [_ADD_BR([br1]) --\ |
07659514 JS |
1932 | add-port br0 patch+ -- set int patch+ type=patch options:peer=patch- --\ |
1933 | add-port br1 patch- -- set int patch- type=patch options:peer=patch+ --]) | |
1934 | ||
1935 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1936 | ||
1937 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1938 | ADD_VETH(p1, at_ns1, br1, "10.1.1.2/24") | |
1939 | ||
1940 | dnl Allow any traffic from ns0->br1, allow established in reverse. | |
1941 | AT_DATA([flows-br0.txt], [dnl | |
1942 | priority=1,action=drop | |
1943 | priority=10,arp,action=normal | |
1944 | priority=10,icmp,action=normal | |
1945 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(commit,zone=1),1 | |
1946 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(table=0,zone=1) | |
1947 | priority=100,in_port=1,tcp,ct_state=+trk+est,ct_zone=1,action=2 | |
1948 | ]) | |
1949 | ||
1950 | dnl Allow any traffic from br0->ns1, allow established in reverse. | |
1951 | AT_DATA([flows-br1.txt], [dnl | |
1952 | priority=1,action=drop | |
1953 | priority=10,arp,action=normal | |
1954 | priority=10,icmp,action=normal | |
1955 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(table=0,zone=2) | |
1956 | priority=100,in_port=1,tcp,ct_state=+trk+new,ct_zone=2,action=ct(commit,zone=2),2 | |
1957 | priority=100,in_port=1,tcp,ct_state=+trk+est,ct_zone=2,action=2 | |
1958 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0,zone=2) | |
1959 | priority=100,in_port=2,tcp,ct_state=+trk+est,ct_zone=2,action=ct(commit,zone=2),1 | |
1960 | ]) | |
1961 | ||
6cfa8ec3 JR |
1962 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) |
1963 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-br1.txt]) | |
07659514 JS |
1964 | |
1965 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 1966 | OVS_START_L7([at_ns1], [http]) |
07659514 JS |
1967 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1968 | ||
1969 | OVS_TRAFFIC_VSWITCHD_STOP | |
1970 | AT_CLEANUP | |
1971 | ||
1972 | AT_SETUP([conntrack - multiple zones]) | |
1973 | CHECK_CONNTRACK() | |
cf7659b6 | 1974 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1975 | |
1976 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1977 | ||
1978 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1979 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1980 | ||
1981 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1982 | AT_DATA([flows.txt], [dnl | |
1983 | priority=1,action=drop | |
1984 | priority=10,arp,action=normal | |
1985 | priority=10,icmp,action=normal | |
1986 | priority=100,in_port=1,tcp,action=ct(commit,zone=1),ct(commit,zone=2),2 | |
1987 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=2) | |
1988 | priority=100,in_port=2,ct_state=+trk,ct_zone=2,tcp,action=1 | |
1989 | ]) | |
1990 | ||
6cfa8ec3 | 1991 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1992 | |
7ed40afe JS |
1993 | OVS_START_L7([at_ns1], [http]) |
1994 | ||
07659514 | 1995 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1996 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1997 | ||
1998 | dnl (again) HTTP requests from p0->p1 should work fine. | |
1999 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
2000 | ||
ec3aa16c | 2001 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 JR |
2002 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
2003 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) | |
07659514 JS |
2004 | ]) |
2005 | ||
2006 | OVS_TRAFFIC_VSWITCHD_STOP | |
2007 | AT_CLEANUP | |
2008 | ||
0e27c629 JS |
2009 | AT_SETUP([conntrack - multiple namespaces, internal ports]) |
2010 | CHECK_CONNTRACK() | |
4573c42e | 2011 | CHECK_CONNTRACK_LOCAL_STACK() |
0e27c629 JS |
2012 | OVS_TRAFFIC_VSWITCHD_START( |
2013 | [set-fail-mode br0 secure -- ]) | |
2014 | ||
2015 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2016 | ||
2017 | ADD_INT(p0, at_ns0, br0, "10.1.1.1/24") | |
2018 | ADD_INT(p1, at_ns1, br0, "10.1.1.2/24") | |
2019 | ||
2020 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
2021 | dnl | |
2022 | dnl If skb->nfct is leaking from inside the namespace, this test will fail. | |
2023 | AT_DATA([flows.txt], [dnl | |
2024 | priority=1,action=drop | |
2025 | priority=10,arp,action=normal | |
2026 | priority=10,icmp,action=normal | |
2027 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,zone=1),2 | |
2028 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=1) | |
2029 | priority=100,in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
2030 | ]) | |
2031 | ||
2032 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
2033 | ||
7ed40afe JS |
2034 | OVS_START_L7([at_ns1], [http]) |
2035 | ||
0e27c629 | 2036 | dnl HTTP requests from p0->p1 should work fine. |
0e27c629 JS |
2037 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2038 | ||
2039 | dnl (again) HTTP requests from p0->p1 should work fine. | |
2040 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
2041 | ||
ec3aa16c | 2042 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 2043 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
0e27c629 JS |
2044 | ]) |
2045 | ||
2046 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
2047 | /ioctl(SIOCGIFINDEX) on .* device failed: No such device/d | |
2048 | /removing policing failed: No such device/d"]) | |
2049 | AT_CLEANUP | |
2050 | ||
8e53fe8c JS |
2051 | AT_SETUP([conntrack - ct_mark]) |
2052 | CHECK_CONNTRACK() | |
cf7659b6 | 2053 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
2054 | |
2055 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2056 | ||
2057 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2058 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2059 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
2060 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
2061 | ||
2062 | dnl Allow traffic between ns0<->ns1 using the ct_mark. | |
2063 | dnl Check that different marks do not match for traffic between ns2<->ns3. | |
2064 | AT_DATA([flows.txt], [dnl | |
2065 | priority=1,action=drop | |
2066 | priority=10,arp,action=normal | |
2067 | priority=10,icmp,action=normal | |
2068 | priority=100,in_port=1,tcp,action=ct(commit,exec(set_field:1->ct_mark)),2 | |
2069 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
2070 | priority=100,in_port=2,ct_state=+trk,ct_mark=1,tcp,action=1 | |
2071 | priority=100,in_port=3,tcp,action=ct(commit,exec(set_field:2->ct_mark)),4 | |
2072 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
2073 | priority=100,in_port=4,ct_state=+trk,ct_mark=1,tcp,action=3 | |
2074 | ]) | |
2075 | ||
6cfa8ec3 | 2076 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
8e53fe8c | 2077 | |
7ed40afe JS |
2078 | OVS_START_L7([at_ns1], [http]) |
2079 | OVS_START_L7([at_ns3], [http]) | |
2080 | ||
8e53fe8c | 2081 | dnl HTTP requests from p0->p1 should work fine. |
8e53fe8c | 2082 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
420c73b2 JR |
2083 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2084 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),mark=1,protoinfo=(state=<cleared>) | |
8e53fe8c JS |
2085 | ]) |
2086 | ||
2087 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
2088 | dnl Try 3 times, in 1 second intervals. | |
8e53fe8c | 2089 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
ec3aa16c | 2090 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 2091 | tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),mark=2,protoinfo=(state=<cleared>) |
8e53fe8c JS |
2092 | ]) |
2093 | ||
2094 | OVS_TRAFFIC_VSWITCHD_STOP | |
2095 | AT_CLEANUP | |
2096 | ||
4d182934 JS |
2097 | AT_SETUP([conntrack - ct_mark bit-fiddling]) |
2098 | CHECK_CONNTRACK() | |
2099 | OVS_TRAFFIC_VSWITCHD_START() | |
2100 | ||
2101 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2102 | ||
2103 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2104 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2105 | ||
2106 | dnl Allow traffic between ns0<->ns1 using the ct_mark. Return traffic should | |
2107 | dnl cause an additional bit to be set in the connection (and be allowed). | |
2108 | AT_DATA([flows.txt], [dnl | |
2109 | table=0,priority=1,action=drop | |
2110 | table=0,priority=10,arp,action=normal | |
2111 | table=0,priority=10,icmp,action=normal | |
2112 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
2113 | table=0,priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=1,commit,exec(set_field:0x2/0x6->ct_mark)) | |
723af132 JS |
2114 | table=1,in_port=1,ct_state=+new,tcp,action=ct(commit,exec(set_field:0x5/0x5->ct_mark)),2 |
2115 | table=1,in_port=1,ct_state=-new,tcp,action=2 | |
2116 | table=1,in_port=2,ct_state=+trk,ct_mark=3,tcp,action=1 | |
4d182934 JS |
2117 | ]) |
2118 | ||
2119 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2120 | ||
7ed40afe JS |
2121 | OVS_START_L7([at_ns1], [http]) |
2122 | ||
4d182934 | 2123 | dnl HTTP requests from p0->p1 should work fine. |
4d182934 JS |
2124 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2125 | ||
420c73b2 JR |
2126 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2127 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),mark=3,protoinfo=(state=<cleared>) | |
4d182934 JS |
2128 | ]) |
2129 | ||
2130 | OVS_TRAFFIC_VSWITCHD_STOP | |
2131 | AT_CLEANUP | |
2132 | ||
8e53fe8c JS |
2133 | AT_SETUP([conntrack - ct_mark from register]) |
2134 | CHECK_CONNTRACK() | |
cf7659b6 | 2135 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
2136 | |
2137 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2138 | ||
2139 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2140 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2141 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
2142 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
2143 | ||
2144 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
2145 | AT_DATA([flows.txt], [dnl | |
2146 | priority=1,action=drop | |
2147 | priority=10,arp,action=normal | |
2148 | priority=10,icmp,action=normal | |
2149 | priority=100,in_port=1,tcp,action=load:1->NXM_NX_REG0[[0..31]],ct(commit,exec(move:NXM_NX_REG0[[0..31]]->NXM_NX_CT_MARK[[]])),2 | |
2150 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
2151 | priority=100,in_port=2,ct_state=+trk,ct_mark=1,tcp,action=1 | |
2152 | priority=100,in_port=3,tcp,action=load:2->NXM_NX_REG0[[0..31]],ct(commit,exec(move:NXM_NX_REG0[[0..31]]->NXM_NX_CT_MARK[[]])),4 | |
2153 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
2154 | priority=100,in_port=4,ct_state=+trk,ct_mark=1,tcp,action=3 | |
2155 | ]) | |
2156 | ||
6cfa8ec3 | 2157 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
8e53fe8c | 2158 | |
7ed40afe JS |
2159 | OVS_START_L7([at_ns1], [http]) |
2160 | OVS_START_L7([at_ns3], [http]) | |
2161 | ||
8e53fe8c | 2162 | dnl HTTP requests from p0->p1 should work fine. |
8e53fe8c | 2163 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
420c73b2 JR |
2164 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2165 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),mark=1,protoinfo=(state=<cleared>) | |
8e53fe8c JS |
2166 | ]) |
2167 | ||
2168 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
2169 | dnl Try 3 times, in 1 second intervals. | |
8e53fe8c | 2170 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
ec3aa16c | 2171 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 2172 | tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),mark=2,protoinfo=(state=<cleared>) |
8e53fe8c JS |
2173 | ]) |
2174 | ||
2175 | OVS_TRAFFIC_VSWITCHD_STOP | |
2176 | AT_CLEANUP | |
2177 | ||
9daf2348 JS |
2178 | AT_SETUP([conntrack - ct_label]) |
2179 | CHECK_CONNTRACK() | |
cf7659b6 | 2180 | OVS_TRAFFIC_VSWITCHD_START() |
9daf2348 JS |
2181 | |
2182 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2183 | ||
2184 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2185 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2186 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
2187 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
2188 | ||
2189 | dnl Allow traffic between ns0<->ns1 using the ct_label. | |
2190 | dnl Check that different labels do not match for traffic between ns2<->ns3. | |
2191 | AT_DATA([flows.txt], [dnl | |
2192 | priority=1,action=drop | |
2193 | priority=10,arp,action=normal | |
2194 | priority=10,icmp,action=normal | |
2195 | priority=100,in_port=1,tcp,action=ct(commit,exec(set_field:0x0a000d000005000001->ct_label)),2 | |
2196 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
2197 | priority=100,in_port=2,ct_state=+trk,ct_label=0x0a000d000005000001,tcp,action=1 | |
2198 | priority=100,in_port=3,tcp,action=ct(commit,exec(set_field:0x2->ct_label)),4 | |
2199 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
2200 | priority=100,in_port=4,ct_state=+trk,ct_label=0x0a000d000005000001,tcp,action=3 | |
2201 | ]) | |
2202 | ||
6cfa8ec3 | 2203 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
9daf2348 | 2204 | |
7ed40afe JS |
2205 | OVS_START_L7([at_ns1], [http]) |
2206 | OVS_START_L7([at_ns3], [http]) | |
2207 | ||
9daf2348 | 2208 | dnl HTTP requests from p0->p1 should work fine. |
9daf2348 JS |
2209 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2210 | ||
2211 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
2212 | dnl Try 3 times, in 1 second intervals. | |
9daf2348 JS |
2213 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
2214 | ||
2215 | OVS_TRAFFIC_VSWITCHD_STOP | |
2216 | AT_CLEANUP | |
2217 | ||
4d182934 JS |
2218 | AT_SETUP([conntrack - ct_label bit-fiddling]) |
2219 | CHECK_CONNTRACK() | |
2220 | OVS_TRAFFIC_VSWITCHD_START() | |
2221 | ||
2222 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2223 | ||
2224 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2225 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2226 | ||
2227 | dnl Allow traffic between ns0<->ns1 using the ct_labels. Return traffic should | |
2228 | dnl cause an additional bit to be set in the connection labels (and be allowed) | |
2229 | AT_DATA([flows.txt], [dnl | |
2230 | table=0,priority=1,action=drop | |
2231 | table=0,priority=10,arp,action=normal | |
2232 | table=0,priority=10,icmp,action=normal | |
2233 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
2234 | table=0,priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=1,commit,exec(set_field:0x200000000/0x200000004->ct_label)) | |
723af132 JS |
2235 | table=1,in_port=1,tcp,ct_state=+new,action=ct(commit,exec(set_field:0x5/0x5->ct_label)),2 |
2236 | table=1,in_port=1,tcp,ct_state=-new,action=2 | |
2237 | table=1,in_port=2,ct_state=+trk,ct_label=0x200000001,tcp,action=1 | |
4d182934 JS |
2238 | ]) |
2239 | ||
2240 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2241 | ||
7ed40afe JS |
2242 | OVS_START_L7([at_ns1], [http]) |
2243 | ||
4d182934 | 2244 | dnl HTTP requests from p0->p1 should work fine. |
4d182934 JS |
2245 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2246 | ||
420c73b2 JR |
2247 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2248 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),labels=0x200000001,protoinfo=(state=<cleared>) | |
4d182934 JS |
2249 | ]) |
2250 | ||
2251 | OVS_TRAFFIC_VSWITCHD_STOP | |
2252 | AT_CLEANUP | |
2253 | ||
f2d105b5 JS |
2254 | AT_SETUP([conntrack - ct metadata, multiple zones]) |
2255 | CHECK_CONNTRACK() | |
2256 | OVS_TRAFFIC_VSWITCHD_START() | |
2257 | ||
2258 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2259 | ||
2260 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2261 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2262 | ||
2263 | dnl Allow traffic between ns0<->ns1 using the ct_mark and ct_labels in zone=1, | |
2264 | dnl but do *not* set any of these for the ct() in zone=2. Traffic should pass, | |
2265 | dnl and we should see that the conntrack entries only apply the ct_mark and | |
2266 | dnl ct_labels to the connection in zone=1. | |
2267 | AT_DATA([flows.txt], [dnl | |
2268 | table=0,priority=1,action=drop | |
2269 | table=0,priority=10,arp,action=normal | |
2270 | table=0,priority=10,icmp,action=normal | |
2271 | table=0,priority=100,in_port=1,tcp,action=ct(zone=1,table=1) | |
2272 | table=0,priority=100,in_port=2,ct_state=-trk,tcp,action=ct(zone=1,table=1,commit,exec(set_field:0x200000000/0x200000004->ct_label,set_field:0x2/0x6->ct_mark)) | |
723af132 JS |
2273 | table=1,in_port=1,tcp,ct_state=+new,action=ct(zone=1,commit,exec(set_field:0x5/0x5->ct_label,set_field:0x5/0x5->ct_mark)),ct(commit,zone=2),2 |
2274 | table=1,in_port=1,tcp,ct_state=-new,action=ct(zone=2),2 | |
2275 | table=1,in_port=2,tcp,action=ct(zone=2),1 | |
f2d105b5 JS |
2276 | ]) |
2277 | ||
2278 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2279 | ||
7ed40afe JS |
2280 | OVS_START_L7([at_ns1], [http]) |
2281 | ||
f2d105b5 | 2282 | dnl HTTP requests from p0->p1 should work fine. |
f2d105b5 JS |
2283 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2284 | ||
420c73b2 JR |
2285 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2286 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,mark=3,labels=0x200000001,protoinfo=(state=<cleared>) | |
2287 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) | |
f2d105b5 JS |
2288 | ]) |
2289 | ||
2290 | OVS_TRAFFIC_VSWITCHD_STOP | |
2291 | AT_CLEANUP | |
2292 | ||
a867c010 YHW |
2293 | AT_SETUP([conntrack - new connections]) |
2294 | CHECK_CONNTRACK() | |
2295 | OVS_TRAFFIC_VSWITCHD_START() | |
2296 | ||
2297 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2298 | ||
2299 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2300 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2301 | ||
2302 | AT_DATA([flows1.txt], [dnl | |
2303 | table=0, priority=1,action=drop | |
2304 | table=0, priority=10,arp,action=normal | |
2305 | table=0, priority=100,tcp,action=ct(table=1) | |
2306 | table=0, priority=100,udp,action=ct(table=1) | |
2307 | table=1, priority=100,in_port=1,tcp,ct_state=+trk+new,action=ct(commit) | |
2308 | table=1, priority=100,in_port=1,udp,ct_state=+trk+new,action=ct(commit) | |
2309 | table=1, priority=100,in_port=1,ct_state=+trk+est,action=2 | |
2310 | table=1, priority=100,in_port=2,ct_state=+trk+est,action=1 | |
2311 | ]) | |
2312 | ||
2313 | ovs-appctl vlog/set dbg | |
2314 | ||
2315 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows1.txt]) | |
2316 | ||
2317 | dnl TCP traffic from ns0 to ns1 should fail. | |
2318 | OVS_START_L7([at_ns1], [http]) | |
2319 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log], [4]) | |
2320 | ||
2321 | dnl Send UDP packet on port 1 twice. | |
2322 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
2323 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
2324 | ||
2325 | dnl There should not be any packet that matches the established ct_state. | |
2326 | AT_CHECK([ovs-ofctl dump-flows br0 "table=1 in_port=1,ct_state=+trk+est" | ofctl_strip], [0], [dnl | |
2327 | NXST_FLOW reply: | |
2328 | table=1, priority=100,ct_state=+est+trk,in_port=1 actions=output:2 | |
2329 | ]) | |
2330 | ||
2331 | OVS_TRAFFIC_VSWITCHD_STOP | |
2332 | AT_CLEANUP | |
2333 | ||
8e53fe8c | 2334 | AT_SETUP([conntrack - ICMP related]) |
9c1ab985 | 2335 | AT_SKIP_IF([test $HAVE_NC = no]) |
8e53fe8c | 2336 | CHECK_CONNTRACK() |
cf7659b6 | 2337 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
2338 | |
2339 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2340 | ||
2341 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2342 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2343 | ||
2344 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
2345 | AT_DATA([flows.txt], [dnl | |
2346 | priority=1,action=drop | |
2347 | priority=10,arp,action=normal | |
2348 | priority=100,in_port=1,udp,action=ct(commit,exec(set_field:1->ct_mark)),2 | |
2349 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
2350 | priority=100,in_port=2,icmp,ct_state=+trk+rel,ct_mark=1,action=1 | |
2351 | ]) | |
2352 | ||
6cfa8ec3 | 2353 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
8e53fe8c | 2354 | |
bde2e7b5 | 2355 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. |
b54971f7 | 2356 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc $NC_EOF_OPT -u 10.1.1.2 10000"]) |
8e53fe8c JS |
2357 | |
2358 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2359 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
2360 | n_packets=1, n_bytes=44, priority=100,udp,in_port=1 actions=ct(commit,exec(load:0x1->NXM_NX_CT_MARK[[]])),output:2 | |
2361 | n_packets=1, n_bytes=72, priority=100,ct_state=+rel+trk,ct_mark=0x1,icmp,in_port=2 actions=output:1 | |
2362 | n_packets=1, n_bytes=72, priority=100,ct_state=-trk,icmp,in_port=2 actions=ct(table=0) | |
bde2e7b5 | 2363 | n_packets=2, n_bytes=84, priority=10,arp actions=NORMAL |
8e53fe8c JS |
2364 | NXST_FLOW reply: |
2365 | ]) | |
2366 | ||
2367 | OVS_TRAFFIC_VSWITCHD_STOP | |
2368 | AT_CLEANUP | |
2369 | ||
d0e42062 JR |
2370 | AT_SETUP([conntrack - ICMP related to original direction]) |
2371 | AT_SKIP_IF([test $HAVE_NC = no]) | |
2372 | CHECK_CONNTRACK() | |
2373 | OVS_TRAFFIC_VSWITCHD_START() | |
2374 | ||
2375 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2376 | ||
2377 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2378 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2379 | ||
2380 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
2381 | AT_DATA([flows.txt], [dnl | |
2382 | priority=1000,arp,action=normal | |
2383 | priority=100,ip,action=ct(table=1) | |
2384 | priority=1,action=drop | |
2385 | table=1,ip,action=ct(zone=34673,table=2) | |
2386 | table=2,in_port=2,udp,action=ct(commit,zone=34673),1 | |
2387 | table=2,in_port=1,udp,action=ct(commit,zone=34673),2 | |
2388 | table=2,in_port=2,ct_state=+rel,icmp,action=1 | |
2389 | ]) | |
2390 | ||
2391 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2392 | ||
2393 | dnl 1. Send and UDP packet to port 53 (src=192.100.1.8,dst=192.100.2.5) | |
2394 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '00010200020400232211223308004500001c000100004011f6fac0640108c06402050035003500087b9e']) | |
2395 | ||
2396 | dnl 2. Send and UDP packet to port 53 (src=192.100.2.5,dst=192.100.1.8) | |
2397 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 resubmit\(,0\) '00232211223300010200020408004500001c000100004011f6fac0640205c06401080035003500087b9e']) | |
2398 | ||
2399 | dnl 3. Send an ICMP port unreach reply for port 53, related to the 2nd | |
2400 | dnl packet, but in the original direction of the conntrack entry created | |
2401 | dnl for the 1st packet. | |
2402 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '000102000204002322112233080045000038000100003f01f7eec0640108c0640205030a80e5ffffffff4500001c000100003f11f7fac0640205c06401080035003500087b9e']) | |
2403 | ||
2404 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2405 | ||
2406 | dnl 4. Repeat 3. | |
2407 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '000102000204002322112233080045000038000100003f01f7eec0640108c0640205030a80e5ffffffff4500001c000100003f11f7fac0640205c06401080035003500087b9e']) | |
2408 | ||
2409 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2410 | ||
2411 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
2412 | n_packets=4, n_bytes=224, priority=100,ip actions=ct(table=1) | |
2413 | priority=1000,arp actions=NORMAL | |
2414 | table=1, n_packets=4, n_bytes=224, ip actions=ct(table=2,zone=34673) | |
2415 | table=2, n_packets=1, n_bytes=42, udp,in_port=1 actions=ct(commit,zone=34673),output:2 | |
2416 | table=2, n_packets=1, n_bytes=42, udp,in_port=2 actions=ct(commit,zone=34673),output:1 | |
2417 | table=2, n_packets=2, n_bytes=140, ct_state=+rel,icmp,in_port=2 actions=output:1 | |
2418 | NXST_FLOW reply: | |
2419 | ]) | |
2420 | ||
2421 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(192.100.1.8)], [0], [dnl | |
2422 | udp,orig=(src=192.100.1.8,dst=192.100.2.5,sport=<cleared>,dport=<cleared>),reply=(src=192.100.2.5,dst=192.100.1.8,sport=<cleared>,dport=<cleared>),zone=34673 | |
2423 | ]) | |
2424 | ||
2425 | OVS_TRAFFIC_VSWITCHD_STOP | |
2426 | AT_CLEANUP | |
2427 | ||
07659514 JS |
2428 | AT_SETUP([conntrack - ICMP related 2]) |
2429 | CHECK_CONNTRACK() | |
cf7659b6 | 2430 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
2431 | |
2432 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2433 | ||
2434 | ADD_VETH(p0, at_ns0, br0, "172.16.0.1/24") | |
2435 | ADD_VETH(p1, at_ns1, br0, "172.16.0.2/24") | |
2436 | ||
2437 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
2438 | AT_DATA([flows.txt], [dnl | |
5c2e106b DDP |
2439 | table=0,ip,action=ct(commit,table=1) |
2440 | table=1,ip,action=controller | |
07659514 JS |
2441 | ]) |
2442 | ||
6cfa8ec3 | 2443 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows.txt]) |
07659514 JS |
2444 | |
2445 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
2446 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
2447 | ||
2448 | dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request | |
5c2e106b | 2449 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303da490000000045000021317040004011b138ac100003ac10000411112222000d20966369616f0a']) |
07659514 JS |
2450 | |
2451 | dnl 2. Send and UDP packet to port 5555 | |
5c2e106b | 2452 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 resubmit\(,0\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a']) |
07659514 | 2453 | |
a81da080 DB |
2454 | dnl 3. Send an ICMP port unreach reply from a path midpoint for port 5555, related to the first packet |
2455 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f354ac100003ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a']) | |
07659514 | 2456 | |
e8833217 DM |
2457 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
2458 | ||
07659514 | 2459 | dnl Check this output. We only see the latter two packets, not the first. |
c2fcc6fc | 2460 | AT_CHECK([cat ofctl_monitor.log | grep -v ff02 | grep -v fe80 | grep -v no_match], [0], [dnl |
45e46e92 | 2461 | NXT_PACKET_IN2 (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=inv|trk,ip,in_port=2 (via action) data_len=75 (unbuffered) |
5c2e106b | 2462 | icmp,vlan_tci=0x0000,dl_src=c6:f5:4e:cb:72:db,dl_dst=f6:4c:47:35:28:c9,nw_src=172.16.0.4,nw_dst=172.16.0.3,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3 icmp_csum:da49 |
45e46e92 | 2463 | NXT_PACKET_IN2 (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=1 (via action) data_len=47 (unbuffered) |
07659514 | 2464 | udp,vlan_tci=0x0000,dl_src=e6:4c:47:35:28:c9,dl_dst=c6:f9:4e:cb:72:db,nw_src=172.16.0.1,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=41614,tp_dst=5555 udp_csum:2096 |
45e46e92 | 2465 | NXT_PACKET_IN2 (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=2 (via action) data_len=75 (unbuffered) |
a81da080 | 2466 | icmp,vlan_tci=0x0000,dl_src=c6:f9:4e:cb:72:db,dl_dst=e6:4c:47:35:28:c9,nw_src=172.16.0.3,nw_dst=172.16.0.1,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3 icmp_csum:553f |
07659514 JS |
2467 | ]) |
2468 | ||
5c2e106b DDP |
2469 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(172.16.0.1)], [0], [dnl |
2470 | udp,orig=(src=172.16.0.1,dst=172.16.0.2,sport=<cleared>,dport=<cleared>),reply=(src=172.16.0.2,dst=172.16.0.1,sport=<cleared>,dport=<cleared>) | |
2471 | ]) | |
2472 | ||
2473 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(172.16.0.3)], [0], [dnl | |
2474 | ]) | |
2475 | ||
07659514 JS |
2476 | OVS_TRAFFIC_VSWITCHD_STOP |
2477 | AT_CLEANUP | |
d787ad39 | 2478 | |
daf4d3c1 | 2479 | AT_SETUP([conntrack - IPv4 fragmentation]) |
d787ad39 | 2480 | CHECK_CONNTRACK() |
cf7659b6 | 2481 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2482 | |
2483 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2484 | ||
2485 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2486 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2487 | ||
2488 | dnl Sending ping through conntrack | |
2489 | AT_DATA([flows.txt], [dnl | |
2490 | priority=1,action=drop | |
2491 | priority=10,arp,action=normal | |
2492 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2493 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2494 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2495 | ]) | |
2496 | ||
6cfa8ec3 | 2497 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2498 | |
4ea96698 DB |
2499 | dnl Modify userspace conntrack fragmentation handling. |
2500 | DPCTL_MODIFY_FRAGMENTATION() | |
2501 | ||
27130224 AZ |
2502 | dnl Ipv4 fragmentation connectivity check. |
2503 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2504 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2505 | ]) | |
2506 | ||
2507 | dnl Ipv4 larger fragmentation connectivity check. | |
2508 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2509 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2510 | ]) | |
2511 | ||
4ea96698 DB |
2512 | dnl Check userspace conntrack fragmentation counters. |
2513 | DPCTL_CHECK_FRAGMENTATION_PASS() | |
2514 | ||
27130224 AZ |
2515 | OVS_TRAFFIC_VSWITCHD_STOP |
2516 | AT_CLEANUP | |
2517 | ||
0cf28088 JS |
2518 | AT_SETUP([conntrack - IPv4 fragmentation expiry]) |
2519 | CHECK_CONNTRACK() | |
2520 | OVS_TRAFFIC_VSWITCHD_START() | |
2521 | ||
2522 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2523 | ||
2524 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2525 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2526 | ||
2527 | AT_DATA([flows.txt], [dnl | |
2528 | priority=1,action=drop | |
2529 | priority=10,arp,action=normal | |
2530 | ||
2531 | dnl Only allow non-fragmented messages and 1st fragments of each message | |
2532 | priority=100,in_port=1,icmp,ip_frag=no,action=ct(commit,zone=9),2 | |
2533 | priority=100,in_port=1,icmp,ip_frag=firstaction=ct(commit,zone=9),2 | |
2534 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2535 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2536 | ]) | |
2537 | ||
2538 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2539 | ||
4ea96698 DB |
2540 | dnl Modify userspace conntrack fragmentation handling. |
2541 | DPCTL_MODIFY_FRAGMENTATION() | |
2542 | ||
0cf28088 JS |
2543 | dnl Ipv4 fragmentation connectivity check. |
2544 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 1 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2545 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
2546 | ]) | |
2547 | ||
4ea96698 DB |
2548 | dnl Check userspace conntrack fragmentation counters. |
2549 | DPCTL_CHECK_FRAGMENTATION_FAIL() | |
2550 | ||
0cf28088 JS |
2551 | OVS_TRAFFIC_VSWITCHD_STOP |
2552 | AT_CLEANUP | |
2553 | ||
27130224 AZ |
2554 | AT_SETUP([conntrack - IPv4 fragmentation + vlan]) |
2555 | CHECK_CONNTRACK() | |
cf7659b6 | 2556 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2557 | |
2558 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2559 | ||
2560 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2561 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2562 | ADD_VLAN(p0, at_ns0, 100, "10.2.2.1/24") | |
2563 | ADD_VLAN(p1, at_ns1, 100, "10.2.2.2/24") | |
2564 | ||
2565 | dnl Sending ping through conntrack | |
2566 | AT_DATA([flows.txt], [dnl | |
2567 | priority=1,action=drop | |
2568 | priority=10,arp,action=normal | |
2569 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2570 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2571 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2572 | ]) | |
2573 | ||
6cfa8ec3 | 2574 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2575 | |
4ea96698 DB |
2576 | dnl Modify userspace conntrack fragmentation handling. |
2577 | DPCTL_MODIFY_FRAGMENTATION() | |
2578 | ||
27130224 AZ |
2579 | dnl Ipv4 fragmentation connectivity check. |
2580 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2581 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2582 | ]) | |
2583 | ||
2584 | dnl Ipv4 larger fragmentation connectivity check. | |
2585 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2586 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2587 | ]) | |
2588 | ||
4ea96698 DB |
2589 | dnl Check userspace conntrack fragmentation counters. |
2590 | DPCTL_CHECK_FRAGMENTATION_PASS() | |
2591 | ||
27130224 AZ |
2592 | OVS_TRAFFIC_VSWITCHD_STOP |
2593 | AT_CLEANUP | |
2594 | ||
2526a3dc EG |
2595 | AT_SETUP([conntrack - IPv4 fragmentation + cvlan]) |
2596 | CHECK_CONNTRACK() | |
2526a3dc EG |
2597 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) |
2598 | OVS_CHECK_8021AD() | |
2599 | ||
2600 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2601 | ||
2602 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2603 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2604 | ||
2605 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
2606 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
2607 | ||
2608 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
2609 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
2610 | ||
2611 | dnl Sending ping through conntrack | |
2612 | AT_DATA([flows.txt], [dnl | |
2613 | priority=1,action=drop | |
2614 | priority=10,arp,action=normal | |
2615 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2616 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2617 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2618 | ]) | |
2619 | ||
2620 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2621 | ||
2622 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
2623 | ||
2624 | dnl Ipv4 fragmentation connectivity check. | |
2625 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2626 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2627 | ]) | |
2628 | ||
2629 | dnl Ipv4 fragmentation connectivity check. (outer svlan) | |
2630 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.255.2.2 | FORMAT_PING], [0], [dnl | |
2631 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2632 | ]) | |
2633 | ||
2634 | dnl Ipv4 larger fragmentation connectivity check. | |
2635 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2636 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2637 | ]) | |
2638 | ||
2639 | dnl Ipv4 larger fragmentation connectivity check. (outer svlan) | |
2640 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.255.2.2 | FORMAT_PING], [0], [dnl | |
2641 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2642 | ]) | |
2643 | ||
2644 | OVS_TRAFFIC_VSWITCHD_STOP | |
2645 | AT_CLEANUP | |
2646 | ||
e917d3ee DB |
2647 | AT_SETUP([conntrack - IPv4 fragmentation incomplete reassembled packet]) |
2648 | CHECK_CONNTRACK() | |
2649 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 DB |
2650 | DPCTL_SET_MIN_FRAG_SIZE() |
2651 | ||
e917d3ee DB |
2652 | |
2653 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2654 | ||
2655 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2656 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2657 | ||
2658 | AT_DATA([bundle.txt], [dnl | |
2659 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2660 | ]) | |
2661 | ||
2662 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2663 | ||
2664 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2665 | ]) | |
2666 | ||
2667 | OVS_TRAFFIC_VSWITCHD_STOP | |
2668 | AT_CLEANUP | |
2669 | ||
2670 | dnl Uses same first fragment as above 'incomplete reassembled packet' test. | |
2671 | AT_SETUP([conntrack - IPv4 fragmentation with fragments specified]) | |
2672 | CHECK_CONNTRACK() | |
e917d3ee | 2673 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2674 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2675 | |
2676 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2677 | ||
2678 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2679 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2680 | ||
2681 | AT_DATA([bundle.txt], [dnl | |
2682 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2683 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100320011a4860a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2684 | ]) | |
2685 | ||
2686 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2687 | ||
2688 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2689 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>) | |
2690 | ]) | |
2691 | ||
2692 | OVS_TRAFFIC_VSWITCHD_STOP | |
2693 | AT_CLEANUP | |
2694 | ||
b21ac618 DB |
2695 | AT_SETUP([conntrack - IPv4 fragmentation out of order]) |
2696 | CHECK_CONNTRACK() | |
b21ac618 | 2697 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2698 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2699 | |
2700 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2701 | ||
2702 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2703 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2704 | ||
2705 | AT_DATA([bundle.txt], [dnl | |
2706 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100320011a4860a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2707 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2708 | ]) | |
2709 | ||
2710 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2711 | ||
2712 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2713 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>) | |
2714 | ]) | |
2715 | ||
2716 | OVS_TRAFFIC_VSWITCHD_STOP | |
2717 | AT_CLEANUP | |
2718 | ||
2719 | AT_SETUP([conntrack - IPv4 fragmentation overlapping fragments by 1 octet]) | |
2720 | CHECK_CONNTRACK() | |
b21ac618 DB |
2721 | CHECK_CONNTRACK_FRAG_OVERLAP() |
2722 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2723 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2724 | |
2725 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2726 | ||
2727 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2728 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2729 | ||
2730 | AT_DATA([bundle.txt], [dnl | |
2731 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2732 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100310011a4870a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2733 | ]) | |
2734 | ||
2735 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
df0ecb2e | 2736 | dnl There is one byte of overlap, hence no packet gets thru. conntrack. |
b21ac618 DB |
2737 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2738 | ]) | |
2739 | ||
2740 | OVS_TRAFFIC_VSWITCHD_STOP | |
2741 | AT_CLEANUP | |
2742 | ||
2743 | AT_SETUP([conntrack - IPv4 fragmentation overlapping fragments by 1 octet out of order]) | |
2744 | CHECK_CONNTRACK() | |
b21ac618 DB |
2745 | CHECK_CONNTRACK_FRAG_OVERLAP() |
2746 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2747 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2748 | |
2749 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2750 | ||
2751 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2752 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2753 | ||
2754 | AT_DATA([bundle.txt], [dnl | |
2755 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100310011a4870a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2756 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2757 | ]) | |
2758 | ||
2759 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
df0ecb2e | 2760 | dnl There is one byte of overlap, hence no packet gets thru. conntrack. |
b21ac618 DB |
2761 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2762 | ]) | |
2763 | ||
2764 | OVS_TRAFFIC_VSWITCHD_STOP | |
2765 | AT_CLEANUP | |
2766 | ||
27130224 AZ |
2767 | AT_SETUP([conntrack - IPv6 fragmentation]) |
2768 | CHECK_CONNTRACK() | |
cf7659b6 | 2769 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2770 | |
2771 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2772 | ||
2773 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2774 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2775 | ||
2776 | dnl Sending ping through conntrack | |
2777 | AT_DATA([flows.txt], [dnl | |
2778 | priority=1,action=drop | |
2779 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2780 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2781 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2782 | priority=100,icmp6,icmp_type=135,action=normal | |
2783 | priority=100,icmp6,icmp_type=136,action=normal | |
2784 | ]) | |
2785 | ||
6cfa8ec3 | 2786 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2787 | |
c10840ff JS |
2788 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2789 | dnl waiting, we get occasional failures due to the following error: | |
27130224 | 2790 | dnl "connect: Cannot assign requested address" |
c10840ff | 2791 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
27130224 | 2792 | |
221a2668 | 2793 | dnl Ipv6 fragmentation connectivity check. |
27130224 AZ |
2794 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
2795 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2796 | ]) | |
2797 | ||
221a2668 | 2798 | dnl Ipv6 larger fragmentation connectivity check. |
27130224 AZ |
2799 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
2800 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2801 | ]) | |
2802 | ||
2803 | OVS_TRAFFIC_VSWITCHD_STOP | |
2804 | AT_CLEANUP | |
2805 | ||
0cf28088 JS |
2806 | AT_SETUP([conntrack - IPv6 fragmentation expiry]) |
2807 | CHECK_CONNTRACK() | |
2808 | OVS_TRAFFIC_VSWITCHD_START() | |
2809 | ||
2810 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2811 | ||
2812 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2813 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2814 | ||
2815 | AT_DATA([flows.txt], [dnl | |
2816 | priority=1,action=drop | |
2817 | ||
2818 | dnl Only allow non-fragmented messages and 1st fragments of each message | |
2819 | priority=10,in_port=1,ipv6,ip_frag=first,action=ct(commit,zone=9),2 | |
2820 | priority=10,in_port=1,ipv6,ip_frag=no,action=ct(commit,zone=9),2 | |
2821 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2822 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2823 | ||
2824 | dnl Neighbour Discovery | |
2825 | priority=100,icmp6,icmp_type=135,action=normal | |
2826 | priority=100,icmp6,icmp_type=136,action=normal | |
2827 | ]) | |
2828 | ||
2829 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2830 | ||
c10840ff JS |
2831 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2832 | dnl waiting, we get occasional failures due to the following error: | |
0cf28088 | 2833 | dnl "connect: Cannot assign requested address" |
c10840ff | 2834 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
0cf28088 | 2835 | |
0cf28088 JS |
2836 | dnl Send an IPv6 fragment. Some time later, it should expire. |
2837 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 1 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
2838 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
2839 | ]) | |
2840 | ||
2841 | dnl At this point, the kernel will either crash or everything is OK. | |
2842 | ||
2843 | OVS_TRAFFIC_VSWITCHD_STOP | |
2844 | AT_CLEANUP | |
2845 | ||
27130224 AZ |
2846 | AT_SETUP([conntrack - IPv6 fragmentation + vlan]) |
2847 | CHECK_CONNTRACK() | |
cf7659b6 | 2848 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2849 | |
2850 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2851 | ||
2852 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2853 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2854 | ||
2855 | ADD_VLAN(p0, at_ns0, 100, "fc00:1::3/96") | |
2856 | ADD_VLAN(p1, at_ns1, 100, "fc00:1::4/96") | |
2857 | ||
2858 | dnl Sending ping through conntrack | |
2859 | AT_DATA([flows.txt], [dnl | |
2860 | priority=1,action=drop | |
2861 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2862 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2863 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2864 | priority=100,icmp6,icmp_type=135,action=normal | |
2865 | priority=100,icmp6,icmp_type=136,action=normal | |
2866 | ]) | |
2867 | ||
6cfa8ec3 | 2868 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2869 | |
c10840ff JS |
2870 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2871 | dnl waiting, we get occasional failures due to the following error: | |
27130224 | 2872 | dnl "connect: Cannot assign requested address" |
c10840ff | 2873 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
27130224 | 2874 | |
27130224 AZ |
2875 | dnl Ipv4 fragmentation connectivity check. |
2876 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2877 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2878 | ]) | |
2879 | ||
2880 | dnl Ipv4 larger fragmentation connectivity check. | |
2881 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2882 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2883 | ]) | |
2884 | ||
2885 | OVS_TRAFFIC_VSWITCHD_STOP | |
2886 | AT_CLEANUP | |
2887 | ||
2526a3dc EG |
2888 | AT_SETUP([conntrack - IPv6 fragmentation + cvlan]) |
2889 | CHECK_CONNTRACK() | |
2526a3dc EG |
2890 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) |
2891 | OVS_CHECK_8021AD() | |
2892 | ||
2893 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2894 | ||
2895 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2896 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2897 | ||
2898 | ADD_SVLAN(p0, at_ns0, 4094, "fc00:ffff::3/96") | |
2899 | ADD_SVLAN(p1, at_ns1, 4094, "fc00:ffff::4/96") | |
2900 | ||
2901 | ADD_CVLAN(p0.4094, at_ns0, 100, "fc00:1::3/96") | |
2902 | ADD_CVLAN(p1.4094, at_ns1, 100, "fc00:1::4/96") | |
2903 | ||
2904 | dnl Sending ping through conntrack | |
2905 | AT_DATA([flows.txt], [dnl | |
2906 | priority=1,action=drop | |
2907 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2908 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2909 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2910 | priority=100,icmp6,icmp_type=135,action=normal | |
2911 | priority=100,icmp6,icmp_type=136,action=normal | |
2912 | ]) | |
2913 | ||
2914 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2915 | ||
2916 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::4]) | |
2917 | ||
2918 | dnl Ipv6 fragmentation connectivity check. | |
2919 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2920 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2921 | ]) | |
2922 | ||
2923 | dnl Ipv6 fragmentation connectivity check. (outer svlan) | |
2924 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:ffff::4 | FORMAT_PING], [0], [dnl | |
2925 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2926 | ]) | |
2927 | ||
2928 | dnl Ipv6 larger fragmentation connectivity check. | |
2929 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2930 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2931 | ]) | |
2932 | ||
2933 | dnl Ipv6 larger fragmentation connectivity check. (outer svlan) | |
2934 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:ffff::4 | FORMAT_PING], [0], [dnl | |
2935 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2936 | ]) | |
2937 | ||
2938 | OVS_TRAFFIC_VSWITCHD_STOP | |
2939 | AT_CLEANUP | |
2940 | ||
e917d3ee DB |
2941 | AT_SETUP([conntrack - IPv6 fragmentation incomplete reassembled packet]) |
2942 | CHECK_CONNTRACK() | |
2943 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2944 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2945 | |
2946 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2947 | ||
2948 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2949 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2950 | ||
2951 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e | 2952 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000005002cfffc000000000000000000000000000001fc0000000000000000000000000000021100000100000001000100020008f62900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) |
e917d3ee DB |
2953 | ]) |
2954 | ||
2955 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2956 | ||
2957 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2958 | ]) | |
2959 | ||
2960 | OVS_TRAFFIC_VSWITCHD_STOP | |
2961 | AT_CLEANUP | |
2962 | ||
2963 | AT_SETUP([conntrack - IPv6 fragmentation with fragments specified]) | |
2964 | CHECK_CONNTRACK() | |
e917d3ee | 2965 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2966 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2967 | |
2968 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2969 | ||
2970 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2971 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2972 | ||
2973 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
2974 | packet-out in_port=1, packet=50540000000A50540000000986DD6000000005002CFFFC000000000000000000000000000001FC0000000000000000000000000000021100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) |
2975 | packet-out in_port=1, packet=50540000000A50540000000986DD6000000000242CFFFC000000000000000000000000000001FC000000000000000000000000000002110004F80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
e917d3ee DB |
2976 | ]) |
2977 | ||
2978 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2979 | ||
2980 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2981 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2982 | ]) | |
2983 | ||
2984 | OVS_TRAFFIC_VSWITCHD_STOP | |
2985 | AT_CLEANUP | |
2986 | ||
b21ac618 DB |
2987 | AT_SETUP([conntrack - IPv6 fragmentation out of order]) |
2988 | CHECK_CONNTRACK() | |
b21ac618 | 2989 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2990 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2991 | |
2992 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2993 | ||
2994 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2995 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2996 | ||
2997 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
2998 | packet-out in_port=1, packet=50540000000A50540000000986DD6000000000242CFFFC000000000000000000000000000001FC000000000000000000000000000002110004F80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) |
2999 | packet-out in_port=1, packet=50540000000A50540000000986DD6000000005002CFFFC000000000000000000000000000001FC0000000000000000000000000000021100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) | |
b21ac618 DB |
3000 | ]) |
3001 | ||
3002 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
3003 | ||
3004 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3005 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
3006 | ]) | |
3007 | ||
3008 | OVS_TRAFFIC_VSWITCHD_STOP | |
3009 | AT_CLEANUP | |
3010 | ||
3011 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers]) | |
3012 | CHECK_CONNTRACK() | |
b21ac618 | 3013 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 3014 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
3015 | |
3016 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3017 | ||
3018 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3019 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3020 | ||
3021 | # Add different extension headers | |
3022 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
3023 | packet-out in_port=1, packet=50540000000A50540000000986DD60000000050800FFFC000000000000000000000000000001FC0000000000000000000000000000022C000000000000001100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) |
3024 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000000000000110004f80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
b21ac618 DB |
3025 | ]) |
3026 | ||
3027 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
3028 | ||
3029 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3030 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
3031 | ]) | |
3032 | ||
3033 | OVS_TRAFFIC_VSWITCHD_STOP | |
3034 | AT_CLEANUP | |
3035 | ||
3036 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers + out of order]) | |
3037 | CHECK_CONNTRACK() | |
b21ac618 | 3038 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 3039 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
3040 | |
3041 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3042 | ||
3043 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3044 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3045 | ||
3046 | # Add different extension headers | |
3047 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
3048 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000000000000110004f80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) |
3049 | packet-out in_port=1, packet=50540000000A50540000000986DD60000000050800FFFC000000000000000000000000000001FC0000000000000000000000000000022C000000000000001100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) | |
b21ac618 DB |
3050 | ]) |
3051 | ||
3052 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
3053 | ||
3054 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3055 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
3056 | ]) | |
3057 | ||
3058 | OVS_TRAFFIC_VSWITCHD_STOP | |
3059 | AT_CLEANUP | |
3060 | ||
3061 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers 2]) | |
3062 | CHECK_CONNTRACK() | |
b21ac618 | 3063 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 3064 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
3065 | |
3066 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3067 | ||
3068 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3069 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3070 | ||
3071 | # Add different extension headers | |
3072 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
3073 | packet-out in_port=1, packet=50540000000A50540000000986DD60000000050800FFFC000000000000000000000000000001FC0000000000000000000000000000022C000000050200001100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) |
3074 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000005020000110004f80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
b21ac618 DB |
3075 | ]) |
3076 | ||
3077 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
3078 | ||
3079 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3080 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
3081 | ]) | |
3082 | ||
3083 | OVS_TRAFFIC_VSWITCHD_STOP | |
3084 | AT_CLEANUP | |
3085 | ||
3086 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers 2 + out of order]) | |
3087 | CHECK_CONNTRACK() | |
b21ac618 | 3088 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 3089 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
3090 | |
3091 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3092 | ||
3093 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3094 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3095 | ||
3096 | # Add different extension headers | |
3097 | AT_DATA([bundle.txt], [dnl | |
df0ecb2e YS |
3098 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000005020000110004f80000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) |
3099 | packet-out in_port=1, packet=50540000000A50540000000986DD60000000050800FFFC000000000000000000000000000001FC0000000000000000000000000000022C000000050200001100000100000001000100020008267100010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070809001020304050607080900102030405060708090010203040506070, actions=ct(commit) | |
b21ac618 DB |
3100 | ]) |
3101 | ||
3102 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
3103 | ||
3104 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3105 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
3106 | ]) | |
3107 | ||
3108 | OVS_TRAFFIC_VSWITCHD_STOP | |
3109 | AT_CLEANUP | |
3110 | ||
27130224 | 3111 | AT_SETUP([conntrack - Fragmentation over vxlan]) |
dfb21e96 | 3112 | OVS_CHECK_VXLAN() |
27130224 | 3113 | CHECK_CONNTRACK() |
c6fb6677 | 3114 | CHECK_CONNTRACK_LOCAL_STACK() |
27130224 | 3115 | |
cf7659b6 JR |
3116 | OVS_TRAFFIC_VSWITCHD_START() |
3117 | ADD_BR([br-underlay]) | |
3118 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
3119 | ||
27130224 AZ |
3120 | ADD_NAMESPACES(at_ns0) |
3121 | ||
3122 | dnl Sending ping through conntrack | |
3123 | AT_DATA([flows.txt], [dnl | |
3124 | priority=1,action=drop | |
3125 | priority=10,arp,action=normal | |
3126 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),LOCAL | |
3a9eb803 | 3127 | priority=100,in_port=LOCAL,icmp,action=ct(table=1,zone=9) |
723af132 | 3128 | table=1,in_port=LOCAL,ct_state=+trk+est,icmp,action=1 |
27130224 AZ |
3129 | ]) |
3130 | ||
6cfa8ec3 | 3131 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 AZ |
3132 | |
3133 | dnl Set up underlay link from host into the namespace using veth pair. | |
3134 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
3135 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
3136 | AT_CHECK([ip link set dev br-underlay up]) | |
3137 | ||
3138 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
3139 | dnl linux device inside the namespace. | |
6e3a764c | 3140 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], [10.1.1.100/24]) |
27130224 AZ |
3141 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24], |
3142 | [id 0 dstport 4789]) | |
3143 | ||
3144 | dnl First, check the underlay | |
3145 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
3146 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3147 | ]) | |
3148 | ||
3149 | dnl Okay, now check the overlay with different packet sizes | |
3150 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3151 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3152 | ]) | |
3153 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3154 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3155 | ]) | |
3156 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3157 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3158 | ]) | |
3159 | ||
3160 | OVS_TRAFFIC_VSWITCHD_STOP | |
3161 | AT_CLEANUP | |
c4e34c61 | 3162 | |
84f646df | 3163 | AT_SETUP([conntrack - IPv6 Fragmentation over vxlan]) |
a9f70f3d | 3164 | OVS_CHECK_VXLAN() |
84f646df | 3165 | CHECK_CONNTRACK() |
c6fb6677 | 3166 | CHECK_CONNTRACK_LOCAL_STACK() |
84f646df JS |
3167 | |
3168 | OVS_TRAFFIC_VSWITCHD_START() | |
3169 | ADD_BR([br-underlay]) | |
3170 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
3171 | ||
3172 | ADD_NAMESPACES(at_ns0) | |
3173 | ||
3174 | dnl Sending ping through conntrack | |
3175 | AT_DATA([flows.txt], [dnl | |
3176 | priority=1,action=drop | |
3177 | priority=100,in_port=1,ipv6,action=ct(commit,zone=9),LOCAL | |
3178 | priority=100,in_port=LOCAL,ipv6,action=ct(table=1,zone=9) | |
723af132 | 3179 | table=1,in_port=LOCAL,ct_state=+trk+est,ipv6,action=1 |
84f646df JS |
3180 | |
3181 | dnl Neighbour Discovery | |
3182 | priority=1000,icmp6,icmp_type=135,action=normal | |
3183 | priority=1000,icmp6,icmp_type=136,action=normal | |
3184 | ]) | |
3185 | ||
3186 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3187 | ||
3188 | dnl Set up underlay link from host into the namespace using veth pair. | |
3189 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
3190 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
3191 | AT_CHECK([ip link set dev br-underlay up]) | |
3192 | ||
3193 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
3194 | dnl linux device inside the namespace. | |
6e3a764c | 3195 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], ["fc00::2/96"]) |
84f646df JS |
3196 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], ["fc00::1/96"], |
3197 | [id 0 dstport 4789]) | |
3198 | ||
c10840ff JS |
3199 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
3200 | dnl waiting, we get occasional failures due to the following error: | |
84f646df | 3201 | dnl "connect: Cannot assign requested address" |
c10840ff | 3202 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
84f646df JS |
3203 | |
3204 | dnl First, check the underlay | |
3205 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
3206 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3207 | ]) | |
3208 | ||
3209 | dnl Okay, now check the overlay with different packet sizes | |
3210 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3211 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3212 | ]) | |
3213 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3214 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3215 | ]) | |
3216 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3217 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3218 | ]) | |
3219 | ||
3220 | OVS_TRAFFIC_VSWITCHD_STOP | |
3221 | AT_CLEANUP | |
9ac0aada | 3222 | |
c4e34c61 RB |
3223 | AT_SETUP([conntrack - resubmit to ct multiple times]) |
3224 | CHECK_CONNTRACK() | |
3225 | ||
3226 | OVS_TRAFFIC_VSWITCHD_START( | |
3227 | [set-fail-mode br0 secure -- ]) | |
3228 | ||
3229 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3230 | ||
3231 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3232 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3233 | ||
3234 | AT_DATA([flows.txt], [dnl | |
3235 | table=0,priority=150,arp,action=normal | |
3236 | table=0,priority=100,ip,in_port=1,action=resubmit(,1),resubmit(,2) | |
3237 | ||
723af132 JS |
3238 | table=1,ip,action=ct(table=3) |
3239 | table=2,ip,action=ct(table=3) | |
c4e34c61 RB |
3240 | |
3241 | table=3,ip,action=drop | |
3242 | ]) | |
3243 | ||
3244 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
3245 | ||
3246 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3247 | 1 packets transmitted, 0 received, 100% packet loss, time 0ms | |
3248 | ]) | |
3249 | ||
3250 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
3251 | n_packets=1, n_bytes=98, priority=100,ip,in_port=1 actions=resubmit(,1),resubmit(,2) | |
3252 | n_packets=2, n_bytes=84, priority=150,arp actions=NORMAL | |
723af132 JS |
3253 | table=1, n_packets=1, n_bytes=98, ip actions=ct(table=3) |
3254 | table=2, n_packets=1, n_bytes=98, ip actions=ct(table=3) | |
c4e34c61 RB |
3255 | table=3, n_packets=2, n_bytes=196, ip actions=drop |
3256 | NXST_FLOW reply: | |
3257 | ]) | |
3258 | ||
3259 | OVS_TRAFFIC_VSWITCHD_STOP | |
3260 | AT_CLEANUP | |
9ac0aada | 3261 | |
187bb41f YHW |
3262 | AT_SETUP([conntrack - zone-based timeout policy]) |
3263 | CHECK_CONNTRACK() | |
3264 | CHECK_CONNTRACK_TIMEOUT() | |
3265 | OVS_TRAFFIC_VSWITCHD_START() | |
3266 | ||
3267 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3268 | ||
3269 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3270 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3271 | ||
3272 | AT_DATA([flows.txt], [dnl | |
3273 | priority=1,action=drop | |
3274 | priority=10,arp,action=normal | |
3275 | priority=100,in_port=1,ip,action=ct(zone=5, table=1) | |
3276 | priority=100,in_port=2,ip,action=ct(zone=5, table=1) | |
3277 | table=1,in_port=2,ip,ct_state=+trk+est,action=1 | |
3278 | table=1,in_port=1,ip,ct_state=+trk+new,action=ct(commit,zone=5),2 | |
3279 | table=1,in_port=1,ip,ct_state=+trk+est,action=2 | |
3280 | ]) | |
3281 | ||
3282 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3283 | ||
3284 | dnl Test with default timeout | |
3285 | dnl The default udp_single and icmp_first timeouts are 30 seconds in | |
3286 | dnl kernel DP, and 60 seconds in userspace DP. | |
3287 | ||
3288 | dnl Send ICMP and UDP traffic | |
3289 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3290 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3291 | ]) | |
3292 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
3293 | ||
3294 | sleep 4 | |
3295 | ||
3296 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sort], [0], [dnl | |
3297 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=5 | |
3298 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=5 | |
3299 | ]) | |
3300 | ||
3301 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3302 | ||
3303 | dnl Shorten the udp_single and icmp_first timeout in zone 5 | |
3304 | VSCTL_ADD_DATAPATH_TABLE() | |
3305 | AT_CHECK([ovs-vsctl add-zone-tp $DP_TYPE zone=5 udp_single=3 icmp_first=3]) | |
3306 | ||
3307 | dnl Send ICMP and UDP traffic | |
3308 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3309 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3310 | ]) | |
3311 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
3312 | ||
3313 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sort], [0], [dnl | |
3314 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=5 | |
3315 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=5 | |
47d76e9f YHW |
3316 | ]) |
3317 | ||
3318 | dnl Wait until the timeout expire. | |
3319 | dnl We intend to wait a bit longer, because conntrack does not recycle the entry right after it is expired. | |
3320 | sleep 4 | |
3321 | ||
3322 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3323 | ]) | |
3324 | ||
3325 | dnl Re-send ICMP and UDP traffic to test conntrack cache | |
3326 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3327 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3328 | ]) | |
3329 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
3330 | ||
3331 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sort], [0], [dnl | |
3332 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=5 | |
3333 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=5 | |
187bb41f YHW |
3334 | ]) |
3335 | ||
3336 | dnl Wait until the timeout expire. | |
3337 | dnl We intend to wait a bit longer, because conntrack does not recycle the entry right after it is expired. | |
3338 | sleep 4 | |
3339 | ||
3340 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3341 | ]) | |
3342 | ||
3343 | OVS_TRAFFIC_VSWITCHD_STOP | |
3344 | AT_CLEANUP | |
3345 | ||
ae05d681 GR |
3346 | dnl Check kernel datapath to make sure conntrack fills in L3 and L4 |
3347 | dnl protocol information | |
3348 | AT_SETUP([conntrack - fragment reassembly with L3 L4 protocol information]) | |
d7fd61ae | 3349 | CHECK_CONNTRACK() |
ae05d681 | 3350 | CHECK_L3L4_CONNTRACK_REASM() |
d7fd61ae GR |
3351 | OVS_TRAFFIC_VSWITCHD_START() |
3352 | ||
3353 | AT_DATA([flows.txt], [dnl | |
3354 | action=normal | |
3355 | ]) | |
3356 | ||
3357 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3358 | ||
3359 | AT_CHECK([ovs-ofctl packet-out br0 "packet=52540003287c525400444ab586dd6006f70605b02c4020010001000000000000000000000020200100010000000000000000000000101100000134e88deb13891389080803136161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616"dnl | |
3360 | "16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161"dnl | |
3361 | "61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616"dnl | |
3362 | "1616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161, actions=ct(table=1)"]) | |
3363 | ||
3364 | AT_CHECK([ovs-ofctl packet-out br0 "packet=52540003287c525400444ab586dd6006f70602682c402001000100000000000000000000002020010001000000000000000000000010110005a834e88deb6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616"dnl | |
3365 | "161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161, actions=ct(table=1)"]) | |
3366 | ||
3367 | AT_CHECK([ovs-ofctl packet-out br0 "packet=52540003287c525400444ab586dd6006f706033d1140200100010000000000000000000000202001000100000000000000000000001013891389033d923861616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616"dnl | |
3368 | "1616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161610a, actions=ct(table=1)"]) | |
3369 | ||
3370 | AT_CHECK([ovs-appctl dpctl/dump-flows | head -2 | tail -1 | grep -q -e ["]udp[(]src=5001["]]) | |
3371 | ||
3372 | OVS_TRAFFIC_VSWITCHD_STOP | |
3373 | AT_CLEANUP | |
3374 | ||
1d768544 JS |
3375 | AT_BANNER([conntrack - L7]) |
3376 | ||
3377 | AT_SETUP([conntrack - IPv4 HTTP]) | |
3378 | CHECK_CONNTRACK() | |
3379 | OVS_TRAFFIC_VSWITCHD_START() | |
3380 | ||
3381 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3382 | ||
3383 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3384 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3385 | ||
3386 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3387 | AT_DATA([flows.txt], [dnl | |
3388 | priority=1,action=drop | |
3389 | priority=10,arp,action=normal | |
3390 | priority=10,icmp,action=normal | |
3391 | priority=100,in_port=1,tcp,action=ct(commit),2 | |
3392 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
3393 | priority=100,in_port=2,ct_state=+trk+est,tcp,action=1 | |
3394 | ]) | |
3395 | ||
3396 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3397 | ||
3398 | OVS_START_L7([at_ns0], [http]) | |
3399 | OVS_START_L7([at_ns1], [http]) | |
3400 | ||
3401 | dnl HTTP requests from ns0->ns1 should work fine. | |
3402 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3403 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3404 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3405 | ]) | |
3406 | ||
3407 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
3408 | dnl Try 3 times, in 1 second intervals. | |
3409 | NS_CHECK_EXEC([at_ns1], [wget 10.1.1.1 -t 3 -T 1 --retry-connrefused -v -o wget1.log], [4]) | |
3410 | ||
3411 | OVS_TRAFFIC_VSWITCHD_STOP | |
3412 | AT_CLEANUP | |
3413 | ||
3414 | AT_SETUP([conntrack - IPv6 HTTP]) | |
3415 | CHECK_CONNTRACK() | |
3416 | OVS_TRAFFIC_VSWITCHD_START() | |
3417 | ||
3418 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3419 | ||
3420 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3421 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3422 | ||
3423 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3424 | AT_DATA([flows.txt], [dnl | |
3425 | priority=1,action=drop | |
3426 | priority=10,icmp6,action=normal | |
3427 | priority=100,in_port=1,tcp6,action=ct(commit),2 | |
3428 | priority=100,in_port=2,ct_state=-trk,tcp6,action=ct(table=0) | |
3429 | priority=100,in_port=2,ct_state=+trk+est,tcp6,action=1 | |
3430 | ]) | |
3431 | ||
3432 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3433 | ||
3434 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
3435 | dnl waiting, we get occasional failures due to the following error: | |
3436 | dnl "connect: Cannot assign requested address" | |
3437 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
3438 | ||
3439 | OVS_START_L7([at_ns0], [http6]) | |
3440 | OVS_START_L7([at_ns1], [http6]) | |
3441 | ||
3442 | dnl HTTP requests from ns0->ns1 should work fine. | |
3443 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3444 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3445 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3446 | ]) | |
3447 | ||
3448 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
3449 | dnl Try 3 times, in 1 second intervals. | |
3450 | NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 --retry-connrefused -v -o wget1.log], [4]) | |
3451 | ||
3452 | OVS_TRAFFIC_VSWITCHD_STOP | |
3453 | AT_CLEANUP | |
3454 | ||
3455 | AT_SETUP([conntrack - commit, recirc]) | |
3456 | CHECK_CONNTRACK() | |
3457 | OVS_TRAFFIC_VSWITCHD_START() | |
3458 | ||
3459 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
3460 | ||
3461 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3462 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3463 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
3464 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
3465 | ||
3466 | dnl Allow any traffic from ns0->ns1, ns2->ns3. | |
3467 | AT_DATA([flows.txt], [dnl | |
3468 | priority=1,action=drop | |
3469 | priority=10,arp,action=normal | |
3470 | priority=10,icmp,action=normal | |
3471 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,table=0) | |
3472 | priority=100,in_port=1,tcp,ct_state=+trk,action=2 | |
3473 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0) | |
3474 | priority=100,in_port=2,tcp,ct_state=+trk,action=1 | |
3475 | priority=100,in_port=3,tcp,ct_state=-trk,action=set_field:0->metadata,ct(table=0) | |
3476 | priority=100,in_port=3,tcp,ct_state=+trk,metadata=0,action=set_field:1->metadata,ct(commit,table=0) | |
3477 | priority=100,in_port=3,tcp,ct_state=+trk,metadata=1,action=4 | |
3478 | priority=100,in_port=4,tcp,ct_state=-trk,action=ct(commit,table=0) | |
3479 | priority=100,in_port=4,tcp,ct_state=+trk,action=3 | |
3480 | ]) | |
3481 | ||
3482 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3483 | ||
3484 | OVS_START_L7([at_ns1], [http]) | |
3485 | OVS_START_L7([at_ns3], [http]) | |
3486 | ||
3487 | dnl HTTP requests from p0->p1 should work fine. | |
3488 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3489 | ||
3490 | dnl HTTP requests from p2->p3 should work fine. | |
3491 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) | |
3492 | ||
3493 | OVS_TRAFFIC_VSWITCHD_STOP | |
3494 | AT_CLEANUP | |
3495 | ||
3496 | AT_SETUP([conntrack - multiple zones, local]) | |
3497 | CHECK_CONNTRACK() | |
3498 | CHECK_CONNTRACK_LOCAL_STACK() | |
3499 | OVS_TRAFFIC_VSWITCHD_START() | |
3500 | ||
3501 | ADD_NAMESPACES(at_ns0) | |
3502 | ||
3503 | AT_CHECK([ip addr add dev br0 "10.1.1.1/24"]) | |
3504 | AT_CHECK([ip link set dev br0 up]) | |
3505 | on_exit 'ip addr del dev br0 "10.1.1.1/24"' | |
3506 | ADD_VETH(p0, at_ns0, br0, "10.1.1.2/24") | |
3507 | ||
3508 | dnl Allow traffic from local stack to ns0. Only allow neighbour discovery, | |
3509 | dnl return traffic from ns0 back to the local stack. | |
3510 | AT_DATA([flows.txt], [dnl | |
3511 | priority=1,action=drop | |
3512 | priority=10,arp,action=normal | |
3513 | priority=100,in_port=LOCAL,ip,ct_state=-trk,action=drop | |
3514 | priority=100,in_port=LOCAL,ip,ct_state=+trk+new,action=ct(commit,zone=1),ct(commit,zone=2),1 | |
3515 | priority=100,in_port=LOCAL,ip,ct_state=+trk+est,action=ct(commit,zone=1),ct(commit,zone=2),1 | |
3516 | priority=100,in_port=1,ip,ct_state=-trk,action=ct(table=1,zone=1) | |
3517 | table=1,in_port=1,ip,ct_state=+trk+est,ct_zone=1,action=ct(table=2,zone=2) | |
3518 | table=2,in_port=1,ip,ct_state=+trk+est,ct_zone=2,action=LOCAL | |
3519 | ]) | |
3520 | ||
3521 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3522 | ||
3523 | AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3524 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3525 | ]) | |
3526 | ||
3527 | OVS_START_L7([at_ns0], [http]) | |
3528 | ||
3529 | dnl HTTP requests from root namespace to p0 should work fine. | |
3530 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3531 | ||
3532 | dnl (again) HTTP requests from root namespace to p0 should work fine. | |
3533 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3534 | ||
3535 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | grep "zone"], [0], [dnl | |
3536 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=1 | |
3537 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=2 | |
3538 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
3539 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) | |
3540 | ]) | |
3541 | ||
3542 | OVS_TRAFFIC_VSWITCHD_STOP | |
3543 | AT_CLEANUP | |
3544 | ||
3545 | AT_SETUP([conntrack - multi-stage pipeline, local]) | |
3546 | CHECK_CONNTRACK() | |
3547 | CHECK_CONNTRACK_LOCAL_STACK() | |
3548 | OVS_TRAFFIC_VSWITCHD_START() | |
3549 | ||
3550 | ADD_NAMESPACES(at_ns0) | |
3551 | ||
3552 | AT_CHECK([ip addr add dev br0 "10.1.1.1/24"]) | |
3553 | AT_CHECK([ip link set dev br0 up]) | |
3554 | on_exit 'ip addr del dev br0 "10.1.1.1/24"' | |
3555 | ADD_VETH(p0, at_ns0, br0, "10.1.1.2/24") | |
3556 | ||
3557 | dnl Allow traffic from local stack to ns0. Only allow neighbour discovery, | |
3558 | dnl return traffic from ns0 back to the local stack. | |
3559 | AT_DATA([flows.txt], [dnl | |
3560 | dnl default | |
3561 | table=0,priority=1,action=drop | |
3562 | table=0,priority=10,arp,action=normal | |
3563 | ||
3564 | dnl Load the output port to REG0 | |
3565 | table=0,priority=100,ip,in_port=LOCAL,action=load:1->NXM_NX_REG0[[0..15]],goto_table:1 | |
3566 | table=0,priority=100,ip,in_port=1,action=load:65534->NXM_NX_REG0[[0..15]],goto_table:1 | |
3567 | ||
3568 | dnl Ingress pipeline | |
3569 | dnl - Allow all connections from LOCAL port (commit and proceed to egress) | |
3570 | dnl - All other connections go through conntracker using the input port as | |
3571 | dnl a connection tracking zone. | |
f6fabcc6 | 3572 | table=1,priority=150,in_port=LOCAL,ip,ct_state=+trk+new,action=ct(commit,table=2,zone=OXM_OF_IN_PORT[[0..15]]) |
1d768544 JS |
3573 | table=1,priority=100,ip,action=ct(table=2,zone=OXM_OF_IN_PORT[[0..15]]) |
3574 | table=1,priority=1,action=drop | |
3575 | ||
3576 | dnl Egress pipeline | |
3577 | dnl - Allow all connections from LOCAL port (commit and skip to output) | |
3578 | dnl - Allow other established connections to go through conntracker using | |
3579 | dnl output port as a connection tracking zone. | |
f6fabcc6 | 3580 | table=2,priority=150,in_port=LOCAL,ip,ct_state=+trk+new,action=ct(commit,table=4,zone=NXM_NX_REG0[[0..15]]) |
1d768544 JS |
3581 | table=2,priority=100,ip,ct_state=+trk+est,action=ct(table=3,zone=NXM_NX_REG0[[0..15]]) |
3582 | table=2,priority=1,action=drop | |
3583 | ||
3584 | dnl Only allow established traffic from egress ct lookup | |
3585 | table=3,priority=100,ip,ct_state=+trk+est,action=goto_table:4 | |
3586 | table=3,priority=1,action=drop | |
3587 | ||
3588 | dnl output table | |
3589 | table=4,priority=100,ip,action=output:NXM_NX_REG0[[]] | |
3590 | ]) | |
3591 | ||
3592 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3593 | ||
3594 | AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3595 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3596 | ]) | |
3597 | ||
3598 | OVS_START_L7([at_ns0], [http]) | |
3599 | ||
3600 | dnl HTTP requests from root namespace to p0 should work fine. | |
3601 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3602 | ||
3603 | dnl (again) HTTP requests from root namespace to p0 should work fine. | |
3604 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3605 | ||
3606 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | grep "zone"], [0], [dnl | |
3607 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=1 | |
3608 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.1,id=<cleared>,type=0,code=0),zone=65534 | |
3609 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
3610 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=65534,protoinfo=(state=<cleared>) | |
3611 | ]) | |
3612 | ||
3613 | OVS_TRAFFIC_VSWITCHD_STOP | |
3614 | AT_CLEANUP | |
3615 | ||
3f1087c7 YHW |
3616 | AT_SETUP([conntrack - limit by zone]) |
3617 | CHECK_CONNTRACK() | |
3f1087c7 YHW |
3618 | OVS_TRAFFIC_VSWITCHD_START() |
3619 | ||
3620 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3621 | ||
3622 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3623 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3624 | ||
3625 | AT_DATA([flows.txt], [dnl | |
3626 | priority=1,action=drop | |
3627 | priority=10,arp,action=normal | |
3628 | priority=100,in_port=1,udp,action=ct(commit),2 | |
3629 | priority=100,in_port=2,udp,action=ct(zone=3,commit),1 | |
3630 | ]) | |
3631 | ||
3632 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3633 | ||
3634 | AT_CHECK([ovs-appctl dpctl/ct-set-limits default=10 zone=0,limit=5 zone=1,limit=15 zone=2,limit=3 zone=3,limit=3]) | |
3635 | AT_CHECK([ovs-appctl dpctl/ct-del-limits zone=1,2,4]) | |
3636 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,1,2,3], [],[dnl | |
3637 | default limit=10 | |
3638 | zone=0,limit=5,count=0 | |
3639 | zone=1,limit=10,count=0 | |
3640 | zone=2,limit=10,count=0 | |
3641 | zone=3,limit=3,count=0 | |
3642 | ]) | |
3643 | ||
3644 | dnl Test UDP from port 1 | |
3645 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
3646 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000300080000 actions=resubmit(,0)"]) | |
3647 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)"]) | |
3648 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000500080000 actions=resubmit(,0)"]) | |
3649 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000600080000 actions=resubmit(,0)"]) | |
3650 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000700080000 actions=resubmit(,0)"]) | |
3651 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000800080000 actions=resubmit(,0)"]) | |
3652 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000900080000 actions=resubmit(,0)"]) | |
3653 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000a00080000 actions=resubmit(,0)"]) | |
3654 | ||
3655 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,1,2,3,4,5], [0], [dnl | |
3656 | default limit=10 | |
3657 | zone=0,limit=5,count=5 | |
3658 | zone=1,limit=10,count=0 | |
3659 | zone=2,limit=10,count=0 | |
3660 | zone=3,limit=3,count=0 | |
3661 | zone=4,limit=10,count=0 | |
3662 | zone=5,limit=10,count=0 | |
3663 | ]) | |
3664 | ||
3665 | dnl Test ct-get-limits for all zoens | |
3666 | AT_CHECK([ovs-appctl dpctl/ct-get-limits], [0], [dnl | |
3667 | default limit=10 | |
3668 | zone=0,limit=5,count=5 | |
3669 | zone=3,limit=3,count=0 | |
3670 | ]) | |
3671 | ||
3672 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1," | sort ], [0], [dnl | |
3673 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2),reply=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1) | |
3674 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=3),reply=(src=10.1.1.2,dst=10.1.1.1,sport=3,dport=1) | |
3675 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=4),reply=(src=10.1.1.2,dst=10.1.1.1,sport=4,dport=1) | |
3676 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=5),reply=(src=10.1.1.2,dst=10.1.1.1,sport=5,dport=1) | |
3677 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=6),reply=(src=10.1.1.2,dst=10.1.1.1,sport=6,dport=1) | |
3678 | ]) | |
3679 | ||
3680 | dnl Test UDP from port 2 | |
e2603f61 DB |
3681 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4c90a0101030a0101040001000200080000 actions=resubmit(,0)"]) |
3682 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4c90a0101030a0101040001000300080000 actions=resubmit(,0)"]) | |
3683 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4c90a0101030a0101040001000400080000 actions=resubmit(,0)"]) | |
3684 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4c90a0101030a0101040001000500080000 actions=resubmit(,0)"]) | |
3685 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4c90a0101030a0101040001000600080000 actions=resubmit(,0)"]) | |
3f1087c7 YHW |
3686 | |
3687 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,3], [0], [dnl | |
3688 | default limit=10 | |
3689 | zone=0,limit=5,count=5 | |
3690 | zone=3,limit=3,count=3 | |
3691 | ]) | |
3692 | ||
3693 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.3," | sort ], [0], [dnl | |
3694 | udp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=1,dport=2),reply=(src=10.1.1.4,dst=10.1.1.3,sport=2,dport=1),zone=3 | |
3695 | udp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=1,dport=3),reply=(src=10.1.1.4,dst=10.1.1.3,sport=3,dport=1),zone=3 | |
3696 | udp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=1,dport=4),reply=(src=10.1.1.4,dst=10.1.1.3,sport=4,dport=1),zone=3 | |
3697 | ]) | |
3698 | ||
3699 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
3700 | /could not create datapath/d | |
3701 | /(Cannot allocate memory) on packet/d"]) | |
3702 | AT_CLEANUP | |
3703 | ||
9d3e0e5c JR |
3704 | AT_SETUP([FTP - no conntrack]) |
3705 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
3706 | OVS_TRAFFIC_VSWITCHD_START() | |
3707 | ||
3708 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3709 | ||
3710 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3711 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3712 | ||
3713 | AT_DATA([flows.txt], [dnl | |
3714 | table=0,action=normal | |
3715 | ]) | |
3716 | ||
3717 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows.txt]) | |
3718 | ||
1ca0323e BP |
3719 | NETNS_DAEMONIZE([at_ns0], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp1.pid]) |
3720 | NETNS_DAEMONIZE([at_ns1], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp0.pid]) | |
9d3e0e5c JR |
3721 | OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) |
3722 | ||
3723 | dnl FTP requests from p0->p1 should work fine. | |
3724 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3725 | ||
3726 | AT_CHECK([find -name index.html], [0], [dnl | |
3727 | ./index.html | |
3728 | ]) | |
3729 | ||
3730 | OVS_TRAFFIC_VSWITCHD_STOP | |
3731 | AT_CLEANUP | |
3732 | ||
1d768544 | 3733 | AT_SETUP([conntrack - FTP]) |
40c7b2fc | 3734 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3735 | CHECK_CONNTRACK() |
3736 | CHECK_CONNTRACK_ALG() | |
3737 | OVS_TRAFFIC_VSWITCHD_START() | |
3738 | ||
3739 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3740 | ||
3741 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3742 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3743 | ||
3744 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3745 | AT_DATA([flows1.txt], [dnl | |
3746 | table=0,priority=1,action=drop | |
3747 | table=0,priority=10,arp,action=normal | |
3748 | table=0,priority=10,icmp,action=normal | |
3749 | table=0,priority=100,in_port=1,tcp,action=ct(alg=ftp,commit),2 | |
3750 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3751 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3752 | table=1,in_port=2,tcp,ct_state=+trk+rel,action=1 | |
3753 | ]) | |
3754 | ||
3755 | dnl Similar policy but without allowing all traffic from ns0->ns1. | |
3756 | AT_DATA([flows2.txt], [dnl | |
3757 | table=0,priority=1,action=drop | |
3758 | table=0,priority=10,arp,action=normal | |
3759 | table=0,priority=10,icmp,action=normal | |
3760 | ||
3761 | dnl Allow outgoing TCP connections, and treat them as FTP | |
3762 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
3763 | table=1,in_port=1,tcp,ct_state=+trk+new,action=ct(commit,alg=ftp),2 | |
3764 | table=1,in_port=1,tcp,ct_state=+trk+est,action=2 | |
3765 | ||
3766 | dnl Allow incoming FTP data connections and responses to existing connections | |
3767 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3768 | table=1,in_port=2,tcp,ct_state=+trk+new+rel,action=ct(commit),1 | |
3769 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3770 | table=1,in_port=2,tcp,ct_state=+trk-new+rel,action=1 | |
3771 | ]) | |
3772 | ||
3a2a425b DB |
3773 | dnl flows3 is same as flows1, except no ALG is specified. |
3774 | AT_DATA([flows3.txt], [dnl | |
3775 | table=0,priority=1,action=drop | |
3776 | table=0,priority=10,arp,action=normal | |
3777 | table=0,priority=10,icmp,action=normal | |
3778 | table=0,priority=100,in_port=1,tcp,action=ct(commit),2 | |
3779 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3780 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3781 | table=1,in_port=2,tcp,ct_state=+trk+rel,action=1 | |
3782 | ]) | |
3783 | ||
1d768544 JS |
3784 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt]) |
3785 | ||
3786 | OVS_START_L7([at_ns0], [ftp]) | |
3787 | OVS_START_L7([at_ns1], [ftp]) | |
3788 | ||
3789 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3790 | dnl Try 3 times, in 1 second intervals. | |
3791 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3792 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3793 | ]) | |
3794 | ||
3795 | dnl FTP requests from p0->p1 should work fine. | |
3796 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3797 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3798 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
3799 | ]) | |
3800 | ||
3801 | dnl Try the second set of flows. | |
3802 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows2.txt]) | |
3803 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3804 | ||
3805 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3806 | dnl Try 3 times, in 1 second intervals. | |
3807 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3808 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3809 | ]) | |
3810 | ||
3811 | dnl Active FTP requests from p0->p1 should work fine. | |
3812 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0-1.log]) | |
3813 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3814 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
3815 | tcp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3816 | ]) | |
3817 | ||
3818 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3819 | ||
3820 | dnl Passive FTP requests from p0->p1 should work fine. | |
3821 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0-2.log]) | |
3822 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3823 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
3824 | ]) | |
3825 | ||
3a2a425b DB |
3826 | dnl Try the third set of flows, without alg specifier. |
3827 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows3.txt]) | |
3828 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3829 | ||
3830 | dnl FTP control requests from p0->p1 should work fine, but helper will not be assigned. | |
3831 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0-3.log], [4]) | |
3832 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3833 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3834 | ]) | |
3835 | ||
1d768544 JS |
3836 | OVS_TRAFFIC_VSWITCHD_STOP |
3837 | AT_CLEANUP | |
3838 | ||
3839 | AT_SETUP([conntrack - FTP over IPv6]) | |
40c7b2fc | 3840 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3841 | CHECK_CONNTRACK() |
3842 | CHECK_CONNTRACK_ALG() | |
3843 | OVS_TRAFFIC_VSWITCHD_START() | |
3844 | ||
3845 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3846 | ||
3847 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3848 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3849 | ||
3850 | dnl Allow any traffic from ns0->ns1. | |
3851 | dnl Only allow nd, return traffic from ns1->ns0. | |
3852 | AT_DATA([flows.txt], [dnl | |
3853 | dnl Track all IPv6 traffic and drop the rest. | |
3854 | dnl Allow ICMPv6 both ways. No commit, so pings will not be tracked. | |
3855 | table=0 priority=100 in_port=1 icmp6, action=2 | |
3856 | table=0 priority=100 in_port=2 icmp6, action=1 | |
3857 | table=0 priority=10 ip6, action=ct(table=1) | |
3858 | table=0 priority=0 action=drop | |
3859 | dnl | |
3860 | dnl Table 1 | |
3861 | dnl | |
3862 | dnl Allow new TCPv6 FTP control connections from port 1. | |
3863 | table=1 in_port=1 ct_state=+new, tcp6, tp_dst=21, action=ct(alg=ftp,commit),2 | |
3864 | dnl Allow related TCPv6 connections from port 2. | |
3865 | table=1 in_port=2 ct_state=+new+rel, tcp6, action=ct(commit),1 | |
3866 | dnl Allow established TCPv6 connections both ways. | |
3867 | table=1 in_port=1 ct_state=+est, tcp6, action=2 | |
3868 | table=1 in_port=2 ct_state=+est, tcp6, action=1 | |
3869 | dnl Drop everything else. | |
3870 | table=1 priority=0, action=drop | |
3871 | ]) | |
3872 | ||
3873 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3874 | ||
3875 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
3876 | dnl waiting, we get occasional failures due to the following error: | |
3877 | dnl "connect: Cannot assign requested address" | |
3878 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
3879 | ||
3880 | OVS_START_L7([at_ns1], [ftp]) | |
3881 | ||
3882 | dnl FTP requests from p0->p1 should work fine. | |
3883 | NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) | |
3884 | ||
3885 | dnl Discards CLOSE_WAIT and CLOSING | |
3886 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3887 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
3888 | tcp,orig=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),reply=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3889 | ]) | |
3890 | ||
3891 | OVS_TRAFFIC_VSWITCHD_STOP | |
3892 | AT_CLEANUP | |
3893 | ||
200a9af9 DB |
3894 | AT_SETUP([conntrack - IPv6 FTP Passive]) |
3895 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
3896 | CHECK_CONNTRACK() | |
3897 | CHECK_CONNTRACK_ALG() | |
3898 | OVS_TRAFFIC_VSWITCHD_START() | |
3899 | ||
3900 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3901 | ||
3902 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3903 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
3904 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3905 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:99]) | |
3906 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:99 dev p0]) | |
3907 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:88 dev p1]) | |
3908 | ||
3909 | dnl Allow any traffic from ns0->ns1. | |
3910 | dnl Only allow nd, return traffic from ns1->ns0. | |
3911 | AT_DATA([flows.txt], [dnl | |
3912 | dnl Track all IPv6 traffic and drop the rest. | |
3913 | dnl Allow ICMPv6 both ways. No commit, so pings will not be tracked. | |
3914 | table=0 priority=100 in_port=1 icmp6, action=2 | |
3915 | table=0 priority=100 in_port=2 icmp6, action=1 | |
3916 | table=0 priority=10 ip6, action=ct(table=1) | |
3917 | table=0 priority=0 action=drop | |
3918 | dnl | |
3919 | dnl Table 1 | |
3920 | dnl | |
3921 | dnl Allow new TCPv6 FTP control connections from port 1. | |
3922 | table=1 in_port=1 ct_state=+new, tcp6, tp_dst=21, action=ct(alg=ftp,commit),2 | |
3923 | dnl Allow related TCPv6 connections from port 1. | |
3924 | table=1 in_port=1 ct_state=+new+rel, tcp6, action=ct(commit),2 | |
3925 | dnl Allow established TCPv6 connections both ways. | |
3926 | table=1 in_port=1 ct_state=+est, tcp6, action=2 | |
3927 | table=1 in_port=2 ct_state=+est, tcp6, action=1 | |
3928 | dnl Drop everything else. | |
3929 | table=1 priority=0, action=drop | |
3930 | ]) | |
3931 | ||
3932 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3933 | ||
3934 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
3935 | dnl waiting, we get occasional failures due to the following error: | |
3936 | dnl "connect: Cannot assign requested address" | |
3937 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
3938 | ||
3939 | OVS_START_L7([at_ns1], [ftp]) | |
3940 | ||
3941 | dnl FTP passive requests from p0->p1 should work fine. | |
3942 | NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) | |
3943 | ||
3944 | dnl Discards CLOSE_WAIT and CLOSING | |
3945 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3946 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
3947 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
3948 | ]) | |
3949 | ||
3950 | OVS_TRAFFIC_VSWITCHD_STOP | |
3951 | AT_CLEANUP | |
3952 | ||
1d768544 | 3953 | AT_SETUP([conntrack - FTP with multiple expectations]) |
40c7b2fc | 3954 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3955 | CHECK_CONNTRACK() |
3956 | CHECK_CONNTRACK_ALG() | |
3957 | OVS_TRAFFIC_VSWITCHD_START() | |
3958 | ||
3959 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3960 | ||
3961 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3962 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3963 | ||
3964 | dnl Dual-firewall, allow all from ns1->ns2, allow established and ftp ns2->ns1. | |
3965 | AT_DATA([flows.txt], [dnl | |
3966 | table=0,priority=1,action=drop | |
3967 | table=0,priority=10,arp,action=normal | |
3968 | table=0,priority=10,icmp,action=normal | |
3969 | ||
3970 | dnl Traffic from ns1 | |
3971 | table=0,priority=100,in_port=1,tcp,action=ct(table=1,zone=1) | |
3972 | table=1,in_port=1,tcp,ct_zone=1,ct_state=+trk+new-rel,action=ct(commit,alg=ftp,zone=1),ct(commit,alg=ftp,zone=2),2 | |
3973 | table=1,in_port=1,tcp,ct_zone=1,ct_state=+trk+new+rel,action=ct(commit,zone=1),ct(commit,zone=2),2 | |
3974 | table=1,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,action=ct(table=2,zone=2) | |
3975 | table=2,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,action=2 | |
3976 | ||
3977 | dnl Traffic from ns2 | |
3978 | table=0,priority=100,in_port=2,tcp,action=ct(table=1,zone=2) | |
3979 | table=1,in_port=2,tcp,ct_zone=2,ct_state=+trk+rel,action=ct(commit,zone=2),ct(commit,zone=1),1 | |
3980 | table=1,in_port=2,tcp,ct_zone=2,ct_state=+trk+est,action=ct(table=2,zone=1) | |
3981 | table=2,in_port=2,tcp,ct_zone=1,ct_state=+trk+rel,action=ct(commit,zone=2),ct(commit,zone=1),1 | |
3982 | table=2,in_port=2,tcp,ct_zone=1,ct_state=+trk+est,action=1 | |
3983 | ]) | |
3984 | ||
3985 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3986 | ||
3987 | OVS_START_L7([at_ns0], [ftp]) | |
3988 | OVS_START_L7([at_ns1], [ftp]) | |
3989 | ||
3990 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3991 | dnl Try 3 times, in 1 second intervals. | |
3992 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3993 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3994 | ]) | |
3995 | ||
3996 | dnl Active FTP requests from p0->p1 should work fine. | |
3997 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3998 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3999 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>),helper=ftp | |
4000 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>),helper=ftp | |
4001 | tcp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
4002 | tcp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) | |
4003 | ]) | |
4004 | ||
4005 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
4006 | ||
4007 | dnl Passive FTP requests from p0->p1 should work fine. | |
4008 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4009 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4010 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
4011 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>),helper=ftp | |
4012 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>) | |
4013 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=2,protoinfo=(state=<cleared>),helper=ftp | |
4014 | ]) | |
4015 | ||
4016 | OVS_TRAFFIC_VSWITCHD_STOP | |
4017 | AT_CLEANUP | |
4018 | ||
40c7b2fc JS |
4019 | AT_SETUP([conntrack - TFTP]) |
4020 | AT_SKIP_IF([test $HAVE_TFTP = no]) | |
4021 | CHECK_CONNTRACK() | |
4022 | CHECK_CONNTRACK_ALG() | |
4023 | OVS_TRAFFIC_VSWITCHD_START() | |
4024 | ||
4025 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4026 | ||
4027 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4028 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4029 | ||
4030 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4031 | AT_DATA([flows1.txt], [dnl | |
4032 | table=0,priority=1,action=drop | |
4033 | table=0,priority=10,arp,action=normal | |
4034 | table=0,priority=10,icmp,action=normal | |
4035 | table=0,priority=100,in_port=1,udp,action=ct(alg=tftp,commit),2 | |
4036 | table=0,priority=100,in_port=2,udp,action=ct(table=1) | |
4037 | table=1,in_port=2,udp,ct_state=+trk+est,action=1 | |
4038 | table=1,in_port=2,udp,ct_state=+trk+rel,action=1 | |
4039 | ]) | |
4040 | ||
4041 | dnl Similar policy but without allowing all traffic from ns0->ns1. | |
4042 | AT_DATA([flows2.txt], [dnl | |
4043 | table=0,priority=1,action=drop | |
4044 | table=0,priority=10,arp,action=normal | |
4045 | table=0,priority=10,icmp,action=normal | |
4046 | ||
4047 | dnl Allow outgoing UDP connections, and treat them as TFTP | |
4048 | table=0,priority=100,in_port=1,udp,action=ct(table=1) | |
4049 | table=1,in_port=1,udp,ct_state=+trk+new-rel,action=ct(commit,alg=tftp),2 | |
4050 | table=1,in_port=1,udp,ct_state=+trk+new+rel,action=ct(commit),2 | |
4051 | table=1,in_port=1,udp,ct_state=+trk+est,action=2 | |
4052 | ||
4053 | dnl Allow incoming TFTP data connections and responses to existing connections | |
4054 | table=0,priority=100,in_port=2,udp,action=ct(table=1) | |
4055 | table=1,in_port=2,udp,ct_state=+trk+est,action=1 | |
4056 | table=1,in_port=2,udp,ct_state=+trk+new+rel,action=1 | |
4057 | ]) | |
4058 | ||
4059 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt]) | |
4060 | ||
4061 | OVS_START_L7([at_ns0], [tftp]) | |
4062 | OVS_START_L7([at_ns1], [tftp]) | |
4063 | ||
4064 | dnl TFTP requests from p1->p0 should fail due to network failure. | |
4065 | NS_CHECK_EXEC([at_ns1], [[curl $CURL_OPT tftp://10.1.1.1/flows1.txt -o foo 2>curl0.log]], [28]) | |
4066 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
4067 | ]) | |
4068 | ||
4069 | dnl TFTP requests from p0->p1 should work fine. | |
4070 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows1.txt -o foo 2>curl1.log]]) | |
4071 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4072 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),helper=tftp | |
4073 | ]) | |
4074 | ||
4075 | dnl Try the second set of flows. | |
4076 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows2.txt]) | |
4077 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
4078 | ||
4079 | dnl TFTP requests from p1->p0 should fail due to network failure. | |
4080 | NS_CHECK_EXEC([at_ns1], [[curl $CURL_OPT tftp://10.1.1.1/flows1.txt -o foo 2>curl2.log]], [28]) | |
4081 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
4082 | ]) | |
4083 | ||
4084 | dnl TFTP requests from p0->p1 should work fine. | |
4085 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows1.txt -o foo 2>curl3.log]]) | |
4086 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4087 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),helper=tftp | |
4088 | ]) | |
4089 | ||
4090 | OVS_TRAFFIC_VSWITCHD_STOP | |
4091 | AT_CLEANUP | |
4092 | ||
ee8941ab | 4093 | AT_BANNER([conntrack - NAT]) |
9ac0aada JR |
4094 | |
4095 | AT_SETUP([conntrack - simple SNAT]) | |
4096 | CHECK_CONNTRACK() | |
4573c42e | 4097 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4098 | OVS_TRAFFIC_VSWITCHD_START() |
4099 | ||
4100 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4101 | ||
4102 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4103 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4104 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4105 | ||
4106 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4107 | AT_DATA([flows.txt], [dnl | |
4108 | in_port=1,ip,action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255)),2 | |
4109 | in_port=2,ct_state=-trk,ip,action=ct(table=0,zone=1,nat) | |
4110 | in_port=2,ct_state=+trk,ct_zone=1,ip,action=1 | |
4111 | dnl | |
4112 | dnl ARP | |
4113 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4114 | priority=10 arp action=normal | |
4115 | priority=0,action=drop | |
4116 | dnl | |
4117 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4118 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4119 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4120 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4121 | dnl TPA IP in reg2. | |
4122 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4123 | table=10 priority=100 arp xreg0=0 action=normal | |
4124 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4125 | table=10 priority=0 action=drop | |
4126 | ]) | |
4127 | ||
4128 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4129 | ||
4130 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 4131 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4132 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4133 | ||
13c10e56 | 4134 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/' | uniq], [0], [dnl |
420c73b2 | 4135 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.2XX,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
9ac0aada JR |
4136 | ]) |
4137 | ||
4138 | OVS_TRAFFIC_VSWITCHD_STOP | |
4139 | AT_CLEANUP | |
4140 | ||
c0324e37 JR |
4141 | AT_SETUP([conntrack - SNAT with ct_mark change on reply]) |
4142 | CHECK_CONNTRACK() | |
4143 | CHECK_CONNTRACK_NAT() | |
4144 | OVS_TRAFFIC_VSWITCHD_START() | |
4145 | ||
4146 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4147 | ||
4148 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
ed307567 DB |
4149 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) |
4150 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4151 | ||
c0324e37 | 4152 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") |
ed307567 DB |
4153 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) |
4154 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
c0324e37 JR |
4155 | |
4156 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4157 | AT_DATA([flows.txt], [dnl | |
ed307567 | 4158 | in_port=1,ip,action=ct(commit,zone=1,nat(src=10.1.1.240)),2 |
c0324e37 JR |
4159 | in_port=2,ct_state=-trk,ip,action=ct(table=0,zone=1,nat) |
4160 | dnl | |
4161 | dnl Setting the mark fails if the datapath can't find the existing conntrack | |
4162 | dnl entry after NAT has been reversed and the skb was lost due to an upcall. | |
4163 | dnl | |
4164 | in_port=2,ct_state=+trk,ct_zone=1,ip,action=ct(table=1,commit,zone=1,exec(set_field:1->ct_mark)),1 | |
4165 | table=1,in_port=2,ct_mark=1,ct_state=+rpl,ct_zone=1,ip,action=1 | |
4166 | dnl | |
c0324e37 | 4167 | priority=0,action=drop |
c0324e37 JR |
4168 | ]) |
4169 | ||
4170 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4171 | ||
aeae4330 | 4172 | dnl ICMP requests from p0->p1 should work fine. |
c0324e37 JR |
4173 | NS_CHECK_EXEC([at_ns0], [ping -c 1 10.1.1.2 | FORMAT_PING], [0], [dnl |
4174 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms | |
4175 | ]) | |
4176 | ||
4177 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl | |
4178 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.2XX,id=<cleared>,type=0,code=0),zone=1,mark=1 | |
4179 | ]) | |
4180 | ||
4181 | OVS_TRAFFIC_VSWITCHD_STOP | |
4182 | AT_CLEANUP | |
9ac0aada JR |
4183 | |
4184 | AT_SETUP([conntrack - SNAT with port range]) | |
4185 | CHECK_CONNTRACK() | |
4573c42e | 4186 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4187 | OVS_TRAFFIC_VSWITCHD_START() |
4188 | ||
4189 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4190 | ||
4191 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4192 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4193 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4194 | ||
4195 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4196 | AT_DATA([flows.txt], [dnl | |
4197 | in_port=1,tcp,action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255:34567-34568,random)),2 | |
4198 | in_port=2,ct_state=-trk,tcp,tp_dst=34567,action=ct(table=0,zone=1,nat) | |
4199 | in_port=2,ct_state=-trk,tcp,tp_dst=34568,action=ct(table=0,zone=1,nat) | |
4200 | in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
4201 | dnl | |
4202 | dnl ARP | |
4203 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4204 | priority=10 arp action=normal | |
4205 | priority=0,action=drop | |
4206 | dnl | |
4207 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4208 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4209 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4210 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4211 | dnl TPA IP in reg2. | |
4212 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4213 | table=10 priority=100 arp xreg0=0 action=normal | |
4214 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4215 | table=10 priority=0 action=drop | |
4216 | ]) | |
4217 | ||
4218 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4219 | ||
4220 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 4221 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4222 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4223 | ||
13c10e56 | 4224 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/' | uniq], [0], [dnl |
420c73b2 | 4225 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.2XX,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
9ac0aada JR |
4226 | ]) |
4227 | ||
4228 | OVS_TRAFFIC_VSWITCHD_STOP | |
4229 | AT_CLEANUP | |
4230 | ||
e32cd4c6 | 4231 | AT_SETUP([conntrack - SNAT with port range using ICMP]) |
4232 | dnl Check PAT is not attempted on ICMP packets causing corrupted packets. | |
4233 | CHECK_CONNTRACK() | |
4234 | CHECK_CONNTRACK_NAT() | |
4235 | OVS_TRAFFIC_VSWITCHD_START() | |
4236 | ||
4237 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4238 | ||
4239 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4240 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4241 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4242 | ||
4243 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4244 | AT_DATA([flows.txt], [dnl | |
4245 | in_port=1,ip,action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255:20000)),2 | |
4246 | in_port=2,ct_state=-trk,ip,action=ct(table=0,zone=1,nat) | |
4247 | in_port=2,ct_state=+trk,ct_zone=1,action=1 | |
4248 | dnl | |
4249 | dnl ARP | |
4250 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4251 | priority=10 arp action=normal | |
4252 | priority=0,action=drop | |
4253 | dnl | |
4254 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4255 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4256 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4257 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4258 | dnl TPA IP in reg2. | |
4259 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4260 | table=10 priority=100 arp xreg0=0 action=normal | |
4261 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4262 | table=10 priority=0 action=drop | |
4263 | ]) | |
4264 | ||
4265 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4266 | ||
4267 | dnl ICMP requests from p0->p1 should work fine. | |
4268 | NS_CHECK_EXEC([at_ns0], [ping -c 1 10.1.1.2 | FORMAT_PING], [0], [dnl | |
4269 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms | |
4270 | ]) | |
4271 | ||
4272 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl | |
4273 | icmp,orig=(src=10.1.1.1,dst=10.1.1.2,id=<cleared>,type=8,code=0),reply=(src=10.1.1.2,dst=10.1.1.2XX,id=<cleared>,type=0,code=0),zone=1 | |
4274 | ]) | |
4275 | ||
4276 | OVS_TRAFFIC_VSWITCHD_STOP | |
4277 | AT_CLEANUP | |
4278 | ||
32b2c81f DB |
4279 | AT_SETUP([conntrack - SNAT with port range with exhaustion]) |
4280 | CHECK_CONNTRACK() | |
4281 | CHECK_CONNTRACK_NAT() | |
4282 | OVS_TRAFFIC_VSWITCHD_START() | |
4283 | ||
4284 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4285 | ||
4286 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4287 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4288 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4289 | ||
4290 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4291 | AT_DATA([flows.txt], [dnl | |
4292 | in_port=1,tcp,action=ct(commit,zone=1,nat(src=10.1.1.240:34568,random)),2 | |
4293 | in_port=2,ct_state=-trk,tcp,tp_dst=34567,action=ct(table=0,zone=1,nat) | |
4294 | in_port=2,ct_state=-trk,tcp,tp_dst=34568,action=ct(table=0,zone=1,nat) | |
4295 | in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
4296 | dnl | |
4297 | dnl ARP | |
4298 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4299 | priority=10 arp action=normal | |
4300 | priority=0,action=drop | |
4301 | dnl | |
4302 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4303 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4304 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4305 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4306 | dnl TPA IP in reg2. | |
4307 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4308 | table=10 priority=100 arp xreg0=0 action=normal | |
4309 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4310 | table=10 priority=0 action=drop | |
4311 | ]) | |
4312 | ||
4313 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4314 | ||
4315 | dnl HTTP requests from p0->p1 should work fine. | |
4316 | OVS_START_L7([at_ns1], [http]) | |
4317 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 1 -T 1 --retry-connrefused -v -o wget0.log]) | |
4318 | ||
4319 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 1 -T 1 --retry-connrefused -v -o wget0.log], [4]) | |
4320 | ||
4321 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/' | uniq], [0], [dnl | |
4322 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.2XX,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
4323 | ]) | |
4324 | ||
4325 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
4326 | /Unable to NAT due to tuple space exhaustion - if DoS attack, use firewalling and\/or zone partitioning./d | |
4327 | /Dropped .* log messages in last .* seconds \(most recently, .* seconds ago\) due to excessive rate/d"]) | |
4328 | AT_CLEANUP | |
9ac0aada JR |
4329 | |
4330 | AT_SETUP([conntrack - more complex SNAT]) | |
4331 | CHECK_CONNTRACK() | |
4573c42e | 4332 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4333 | OVS_TRAFFIC_VSWITCHD_START() |
4334 | ||
4335 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4336 | ||
4337 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4338 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4339 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4340 | ||
4341 | AT_DATA([flows.txt], [dnl | |
4342 | dnl Track all IP traffic, NAT existing connections. | |
4343 | priority=100 ip action=ct(table=1,zone=1,nat) | |
4344 | dnl | |
4345 | dnl Allow ARP, but generate responses for NATed addresses | |
4346 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4347 | priority=10 arp action=normal | |
4348 | priority=0 action=drop | |
4349 | dnl | |
4350 | dnl Allow any traffic from ns0->ns1. SNAT ns0 to 10.1.1.240-10.1.1.255 | |
4351 | table=1 priority=100 in_port=1 ip ct_state=+trk+new-est action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255)),2 | |
4352 | table=1 priority=100 in_port=1 ip ct_state=+trk-new+est action=2 | |
4353 | dnl Only allow established traffic from ns1->ns0. | |
4354 | table=1 priority=100 in_port=2 ip ct_state=+trk-new+est action=1 | |
4355 | table=1 priority=0 action=drop | |
4356 | dnl | |
4357 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4358 | table=8 priority=100 reg2=0x0a0101f0/0xfffffff0 action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4359 | dnl Zero result means not found. | |
4360 | table=8 priority=0 action=load:0->OXM_OF_PKT_REG0[[]] | |
4361 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4362 | dnl ARP TPA IP in reg2. | |
4363 | table=10 priority=100 arp xreg0=0 action=normal | |
4364 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4365 | table=10 priority=10 arp arp_op=1 action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4366 | table=10 priority=0 action=drop | |
4367 | ]) | |
4368 | ||
4369 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4370 | ||
4371 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 4372 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4373 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4374 | ||
13c10e56 | 4375 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/' | uniq], [0], [dnl |
420c73b2 | 4376 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.2XX,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) |
9ac0aada JR |
4377 | ]) |
4378 | ||
4379 | OVS_TRAFFIC_VSWITCHD_STOP | |
4380 | AT_CLEANUP | |
4381 | ||
4382 | AT_SETUP([conntrack - simple DNAT]) | |
4383 | CHECK_CONNTRACK() | |
4573c42e | 4384 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4385 | OVS_TRAFFIC_VSWITCHD_START() |
4386 | ||
4387 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4388 | ||
4389 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4390 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4391 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:88]) | |
4392 | ||
4393 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4394 | AT_DATA([flows.txt], [dnl | |
4395 | priority=100 in_port=1,ip,nw_dst=10.1.1.64,action=ct(zone=1,nat(dst=10.1.1.2),commit),2 | |
4396 | priority=10 in_port=1,ip,action=ct(commit,zone=1),2 | |
4397 | priority=100 in_port=2,ct_state=-trk,ip,action=ct(table=0,nat,zone=1) | |
4398 | priority=100 in_port=2,ct_state=+trk+est,ct_zone=1,ip,action=1 | |
4399 | dnl | |
4400 | dnl ARP | |
4401 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4402 | priority=10 arp action=normal | |
4403 | priority=0,action=drop | |
4404 | dnl | |
4405 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4406 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4407 | dnl Zero result means not found. | |
4408 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4409 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4410 | dnl TPA IP in reg2. | |
4411 | table=10 priority=100 arp xreg0=0 action=normal | |
4412 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4413 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4414 | table=10 priority=0 action=drop | |
4415 | ]) | |
4416 | ||
4417 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4418 | ||
4419 | dnl Should work with the virtual IP address through NAT | |
7ed40afe | 4420 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4421 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4422 | ||
420c73b2 JR |
4423 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
4424 | tcp,orig=(src=10.1.1.1,dst=10.1.1.64,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
9ac0aada JR |
4425 | ]) |
4426 | ||
4427 | dnl Should work with the assigned IP address as well | |
4428 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4429 | ||
420c73b2 JR |
4430 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
4431 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
9ac0aada JR |
4432 | ]) |
4433 | ||
4434 | OVS_TRAFFIC_VSWITCHD_STOP | |
4435 | AT_CLEANUP | |
4436 | ||
4437 | AT_SETUP([conntrack - more complex DNAT]) | |
4438 | CHECK_CONNTRACK() | |
4573c42e | 4439 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4440 | OVS_TRAFFIC_VSWITCHD_START() |
4441 | ||
4442 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4443 | ||
4444 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4445 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4446 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:88]) | |
4447 | ||
4448 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4449 | AT_DATA([flows.txt], [dnl | |
4450 | dnl Track all IP traffic | |
4451 | table=0 priority=100 ip action=ct(table=1,zone=1,nat) | |
4452 | dnl | |
4453 | dnl Allow ARP, but generate responses for NATed addresses | |
4454 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4455 | table=0 priority=10 arp action=normal | |
4456 | table=0 priority=0 action=drop | |
4457 | dnl | |
4458 | dnl Allow any IP traffic from ns0->ns1. DNAT ns0 from 10.1.1.64 to 10.1.1.2 | |
4459 | table=1 priority=100 in_port=1 ct_state=+new ip nw_dst=10.1.1.64 action=ct(zone=1,nat(dst=10.1.1.2),commit),2 | |
4460 | table=1 priority=10 in_port=1 ct_state=+new ip action=ct(commit,zone=1),2 | |
4461 | table=1 priority=100 in_port=1 ct_state=+est ct_zone=1 action=2 | |
4462 | dnl Only allow established traffic from ns1->ns0. | |
4463 | table=1 priority=100 in_port=2 ct_state=+est ct_zone=1 action=1 | |
4464 | table=1 priority=0 action=drop | |
4465 | dnl | |
4466 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4467 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4468 | dnl Zero result means not found. | |
4469 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4470 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4471 | dnl TPA IP in reg2. | |
4472 | table=10 priority=100 arp xreg0=0 action=normal | |
4473 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4474 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4475 | table=10 priority=0 action=drop | |
4476 | ]) | |
4477 | ||
4478 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4479 | ||
4480 | dnl Should work with the virtual IP address through NAT | |
7ed40afe | 4481 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4482 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4483 | ||
420c73b2 JR |
4484 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
4485 | tcp,orig=(src=10.1.1.1,dst=10.1.1.64,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
9ac0aada JR |
4486 | ]) |
4487 | ||
4488 | dnl Should work with the assigned IP address as well | |
4489 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4490 | ||
420c73b2 JR |
4491 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
4492 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
9ac0aada JR |
4493 | ]) |
4494 | ||
4495 | OVS_TRAFFIC_VSWITCHD_STOP | |
4496 | AT_CLEANUP | |
4497 | ||
4498 | AT_SETUP([conntrack - ICMP related with NAT]) | |
9c1ab985 | 4499 | AT_SKIP_IF([test $HAVE_NC = no]) |
b020a416 | 4500 | AT_SKIP_IF([test $HAVE_TCPDUMP = no]) |
9ac0aada | 4501 | CHECK_CONNTRACK() |
4573c42e | 4502 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4503 | OVS_TRAFFIC_VSWITCHD_START() |
4504 | ||
4505 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4506 | ||
4507 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4508 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4509 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4510 | ||
4511 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
4512 | dnl Make sure ICMP responses are reverse-NATted. | |
4513 | AT_DATA([flows.txt], [dnl | |
4514 | in_port=1,udp,action=ct(commit,nat(src=10.1.1.240-10.1.1.255),exec(set_field:1->ct_mark)),2 | |
4515 | in_port=2,icmp,ct_state=-trk,action=ct(table=0,nat) | |
4516 | in_port=2,icmp,nw_dst=10.1.1.1,ct_state=+trk+rel,ct_mark=1,action=1 | |
4517 | dnl | |
4518 | dnl ARP | |
4519 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4520 | priority=10 arp action=normal | |
4521 | priority=0,action=drop | |
4522 | dnl | |
4523 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4524 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4525 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4526 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4527 | dnl TPA IP in reg2. | |
4528 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4529 | table=10 priority=100 arp xreg0=0 action=normal | |
4530 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4531 | table=10 priority=0 action=drop | |
4532 | ]) | |
4533 | ||
4534 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4535 | ||
b020a416 DB |
4536 | rm p0.pcap |
4537 | tcpdump -U -i ovs-p0 -w p0.pcap & | |
4538 | sleep 1 | |
4539 | ||
9ac0aada | 4540 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. |
b54971f7 | 4541 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc $NC_EOF_OPT -u 10.1.1.2 10000"]) |
9ac0aada JR |
4542 | |
4543 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
4544 | AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
4545 | n_packets=1, n_bytes=42, priority=10,arp actions=NORMAL | |
4546 | n_packets=1, n_bytes=44, udp,in_port=1 actions=ct(commit,nat(src=10.1.1.240-10.1.1.255),exec(set_field:0x1->ct_mark)),output:2 | |
4547 | n_packets=1, n_bytes=72, ct_state=+rel+trk,ct_mark=0x1,icmp,in_port=2,nw_dst=10.1.1.1 actions=output:1 | |
4548 | n_packets=1, n_bytes=72, ct_state=-trk,icmp,in_port=2 actions=ct(table=0,nat) | |
4549 | n_packets=2, n_bytes=84, priority=100,arp,arp_op=1 actions=move:NXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4550 | table=10, n_packets=1, n_bytes=42, priority=10,arp,arp_op=1 actions=set_field:2->arp_op,move:NXM_NX_ARP_SHA[[]]->NXM_NX_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_NX_ARP_SHA[[]],move:NXM_OF_ARP_SPA[[]]->NXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->NXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],set_field:0->in_port,output:NXM_NX_REG3[[0..15]] | |
4551 | table=10, n_packets=1, n_bytes=42, priority=100,arp,reg0=0,reg1=0 actions=NORMAL | |
4552 | table=8, n_packets=1, n_bytes=42, priority=0 actions=set_field:0->xreg0 | |
4553 | table=8, n_packets=1, n_bytes=42, reg2=0xa0101f0/0xfffffff0 actions=set_field:0x808888888888->xreg0 | |
4554 | OFPST_FLOW reply (OF1.5): | |
4555 | ]) | |
4556 | ||
a857bb69 DDP |
4557 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl |
4558 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.2XX,sport=<cleared>,dport=<cleared>),mark=1 | |
9ac0aada JR |
4559 | ]) |
4560 | ||
b020a416 DB |
4561 | AT_CHECK([tcpdump -v "icmp" -r p0.pcap 2>/dev/null | egrep 'wrong|bad'], [1], [ignore-nolog]) |
4562 | ||
9ac0aada JR |
4563 | OVS_TRAFFIC_VSWITCHD_STOP |
4564 | AT_CLEANUP | |
4565 | ||
2cd20955 | 4566 | dnl CHECK_FTP_NAT(TITLE, IP_ADDR, FLOWS, CT_DUMP) |
019c73ac | 4567 | dnl |
74f205f6 JS |
4568 | dnl Checks the implementation of conntrack with FTP ALGs in combination with |
4569 | dnl NAT, using the provided flow table. | |
4570 | m4_define([CHECK_FTP_NAT], | |
efa29a89 | 4571 | [AT_SETUP([conntrack - FTP $1]) |
40c7b2fc | 4572 | AT_SKIP_IF([test $HAVE_FTP = no]) |
253e4dc0 | 4573 | AT_SKIP_IF([test $HAVE_LFTP = no]) |
74f205f6 JS |
4574 | CHECK_CONNTRACK() |
4575 | CHECK_CONNTRACK_NAT() | |
fc9a5ee1 | 4576 | CHECK_CONNTRACK_ALG() |
019c73ac | 4577 | |
74f205f6 | 4578 | OVS_TRAFFIC_VSWITCHD_START() |
019c73ac | 4579 | |
74f205f6 | 4580 | ADD_NAMESPACES(at_ns0, at_ns1) |
019c73ac | 4581 | |
74f205f6 JS |
4582 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") |
4583 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4584 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
019c73ac | 4585 | |
74f205f6 | 4586 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. |
2cd20955 | 4587 | AT_DATA([flows.txt], [$3]) |
019c73ac | 4588 | |
74f205f6 | 4589 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
019c73ac | 4590 | |
7ed40afe | 4591 | OVS_START_L7([at_ns1], [ftp]) |
019c73ac | 4592 | |
74f205f6 | 4593 | dnl FTP requests from p0->p1 should work fine. |
253e4dc0 DM |
4594 | AT_DATA([ftp.cmd], [dnl |
4595 | set net:max-retries 1 | |
4596 | set net:timeout 1 | |
4597 | set ftp:passive-mode off | |
4598 | cache off | |
4599 | connect ftp://anonymous:@10.1.1.2 | |
4600 | ls | |
4601 | ls | |
4602 | ls | |
4603 | ls | |
4604 | ]) | |
4605 | NS_CHECK_EXEC([at_ns0], [lftp -f ftp.cmd > lftp.log]) | |
019c73ac | 4606 | |
74f205f6 | 4607 | dnl Discards CLOSE_WAIT and CLOSING |
2cd20955 | 4608 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [$4]) |
019c73ac | 4609 | |
74f205f6 JS |
4610 | OVS_TRAFFIC_VSWITCHD_STOP |
4611 | AT_CLEANUP]) | |
019c73ac | 4612 | |
efa29a89 | 4613 | dnl CHECK_FTP_SNAT_PRE_RECIRC(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
74f205f6 JS |
4614 | dnl |
4615 | dnl Checks the implementation of conntrack with FTP ALGs in combination with | |
4616 | dnl NAT, with flow tables that implement the NATing as part of handling of | |
4617 | dnl initial incoming packets - ie, the first flow is ct(nat,table=foo). | |
4618 | dnl | |
4619 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4620 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4621 | m4_define([CHECK_FTP_SNAT_PRE_RECIRC], [dnl |
4622 | CHECK_FTP_NAT([SNAT prerecirc $1], [$2], [dnl | |
9ac0aada JR |
4623 | dnl track all IP traffic, de-mangle non-NEW connections |
4624 | table=0 in_port=1, ip, action=ct(table=1,nat) | |
4625 | table=0 in_port=2, ip, action=ct(table=2,nat) | |
4626 | dnl | |
4627 | dnl ARP | |
4628 | dnl | |
4629 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4630 | table=0 priority=10 arp action=normal | |
4631 | table=0 priority=0 action=drop | |
4632 | dnl | |
4633 | dnl Table 1: port 1 -> 2 | |
4634 | dnl | |
4635 | dnl Allow new FTP connections. These need to be commited. | |
74f205f6 | 4636 | table=1 ct_state=+new, tcp, tp_dst=21, nw_src=10.1.1.1, action=ct(alg=ftp,commit,nat(src=$2)),2 |
9ac0aada | 4637 | dnl Allow established TCP connections, make sure they are NATted already. |
74f205f6 | 4638 | table=1 ct_state=+est, tcp, nw_src=$2, action=2 |
9ac0aada JR |
4639 | dnl |
4640 | dnl Table 1: droppers | |
4641 | dnl | |
4642 | table=1 priority=10, tcp, action=drop | |
4643 | table=1 priority=0,action=drop | |
4644 | dnl | |
4645 | dnl Table 2: port 2 -> 1 | |
4646 | dnl | |
4647 | dnl Allow established TCP connections, make sure they are reverse NATted | |
4648 | table=2 ct_state=+est, tcp, nw_dst=10.1.1.1, action=1 | |
4649 | dnl Allow (new) related (data) connections. These need to be commited. | |
74f205f6 | 4650 | table=2 ct_state=+new+rel, tcp, nw_dst=$2, action=ct(commit,nat),1 |
9ac0aada JR |
4651 | dnl Allow related ICMP packets, make sure they are reverse NATted |
4652 | table=2 ct_state=+rel, icmp, nw_dst=10.1.1.1, action=1 | |
4653 | dnl | |
4654 | dnl Table 2: droppers | |
4655 | dnl | |
4656 | table=2 priority=10, tcp, action=drop | |
4657 | table=2 priority=0, action=drop | |
4658 | dnl | |
4659 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4660 | dnl | |
74f205f6 | 4661 | table=8,reg2=$3/0xffffffff,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
9ac0aada JR |
4662 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4663 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4664 | dnl TPA IP in reg2. | |
4665 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4666 | table=10 priority=100 arp xreg0=0 action=normal | |
4667 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4668 | table=10 priority=0 action=drop | |
2cd20955 JR |
4669 | ], [dnl |
4670 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
4671 | tcp,orig=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
4672 | ]) | |
9ac0aada JR |
4673 | ]) |
4674 | ||
74f205f6 | 4675 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment. |
efa29a89 | 4676 | CHECK_FTP_SNAT_PRE_RECIRC([], [10.1.1.9], [0x0a010109]) |
9ac0aada | 4677 | |
74f205f6 JS |
4678 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment. |
4679 | dnl | |
4680 | dnl The FTP PORT command includes the ASCII representation of the address, | |
4681 | dnl so when these messages need to be NATed between addresses that have | |
4682 | dnl different lengths when represented in ASCII (such as the original address | |
4683 | dnl of 10.1.1.1 used in the test and 10.1.1.240 here), the FTP NAT ALG must | |
4684 | dnl resize the packet and adjust TCP sequence numbers. This test is kept | |
4685 | dnl separate from the above to easier identify issues in this code on different | |
4686 | dnl kernels. | |
efa29a89 | 4687 | CHECK_FTP_SNAT_PRE_RECIRC([seqadj], [10.1.1.240], [0x0a0101f0]) |
74f205f6 | 4688 | |
efa29a89 | 4689 | dnl CHECK_FTP_SNAT_POST_RECIRC(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
74f205f6 JS |
4690 | dnl |
4691 | dnl Checks the implementation of conntrack with FTP ALGs in combination with | |
4692 | dnl NAT, with flow tables that implement the NATing after the first round | |
4693 | dnl of recirculation - that is, the first flow ct(table=foo) then a subsequent | |
4694 | dnl flow will implement the NATing with ct(nat..),output:foo. | |
4695 | dnl | |
4696 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4697 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4698 | m4_define([CHECK_FTP_SNAT_POST_RECIRC], [dnl |
4699 | CHECK_FTP_NAT([SNAT postrecirc $1], [$2], [dnl | |
9ac0aada JR |
4700 | dnl track all IP traffic (this includes a helper call to non-NEW packets.) |
4701 | table=0 ip, action=ct(table=1) | |
4702 | dnl | |
4703 | dnl ARP | |
4704 | dnl | |
4705 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4706 | table=0 priority=10 arp action=normal | |
4707 | table=0 priority=0 action=drop | |
4708 | dnl | |
4709 | dnl Table 1 | |
4710 | dnl | |
4711 | dnl Allow new FTP connections. These need to be commited. | |
4712 | dnl This does helper for new packets. | |
74f205f6 | 4713 | table=1 in_port=1 ct_state=+new, tcp, tp_dst=21, action=ct(alg=ftp,commit,nat(src=$2)),2 |
9ac0aada JR |
4714 | dnl Allow and NAT established TCP connections |
4715 | table=1 in_port=1 ct_state=+est, tcp, action=ct(nat),2 | |
4716 | table=1 in_port=2 ct_state=+est, tcp, action=ct(nat),1 | |
4717 | dnl Allow and NAT (new) related active (data) connections. | |
4718 | dnl These need to be commited. | |
4719 | table=1 in_port=2 ct_state=+new+rel, tcp, action=ct(commit,nat),1 | |
4720 | dnl Allow related ICMP packets. | |
4721 | table=1 in_port=2 ct_state=+rel, icmp, action=ct(nat),1 | |
4722 | dnl Drop everything else. | |
4723 | table=1 priority=0, action=drop | |
4724 | dnl | |
4725 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4726 | dnl | |
74f205f6 | 4727 | table=8,reg2=$3/0xffffffff,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
9ac0aada JR |
4728 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4729 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4730 | dnl TPA IP in reg2. | |
4731 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4732 | table=10 priority=100 arp xreg0=0 action=normal | |
4733 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4734 | table=10 priority=0 action=drop | |
2cd20955 JR |
4735 | ], [dnl |
4736 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
4737 | tcp,orig=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
4738 | ]) | |
9ac0aada JR |
4739 | ]) |
4740 | ||
74f205f6 | 4741 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment. |
efa29a89 | 4742 | CHECK_FTP_SNAT_POST_RECIRC([], [10.1.1.9], [0x0a010109]) |
9ac0aada | 4743 | |
74f205f6 JS |
4744 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment. |
4745 | dnl | |
4746 | dnl The FTP PORT command includes the ASCII representation of the address, | |
4747 | dnl so when these messages need to be NATed between addresses that have | |
4748 | dnl different lengths when represented in ASCII (such as the original address | |
4749 | dnl of 10.1.1.1 used in the test and 10.1.1.240 here), the FTP NAT ALG must | |
4750 | dnl resize the packet and adjust TCP sequence numbers. This test is kept | |
4751 | dnl separate from the above to easier identify issues in this code on different | |
4752 | dnl kernels. | |
efa29a89 | 4753 | CHECK_FTP_SNAT_POST_RECIRC([seqadj], [10.1.1.240], [0x0a0101f0]) |
9ac0aada | 4754 | |
daf4d3c1 | 4755 | |
efa29a89 | 4756 | dnl CHECK_FTP_SNAT_ORIG_TUPLE(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
daf4d3c1 JR |
4757 | dnl |
4758 | dnl Checks the implementation of conntrack original direction tuple matching | |
4759 | dnl with FTP ALGs in combination with NAT, with flow tables that implement | |
4760 | dnl the NATing before the first round of recirculation - that is, the first | |
4761 | dnl flow ct(nat, table=foo) then a subsequent flow will implement the | |
4762 | dnl commiting of NATed and other connections with ct(nat..),output:foo. | |
4763 | dnl | |
4764 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4765 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4766 | m4_define([CHECK_FTP_SNAT_ORIG_TUPLE], [dnl |
4767 | CHECK_FTP_NAT([SNAT orig tuple $1], [$2], [dnl | |
2cd20955 JR |
4768 | dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2). |
4769 | dnl NAT is only applied to OUT-direction packets, so that ACL | |
4770 | dnl processing can be done with non-NATted headers. | |
4771 | dnl | |
4772 | dnl Track all IP traffic in the IN-direction (IN from Port 1). | |
4773 | table=0 in_port=1, ip, action=set_field:1->reg4,set_field:1->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1) | |
4774 | dnl Track all IP traffic in the OUT-direction (OUT to the Port 1). | |
4775 | table=0 in_port=2, ip, action=set_field:1->reg4,set_field:2->reg3,ct(zone=NXM_NX_REG4[[0..15]],nat,table=1) | |
daf4d3c1 JR |
4776 | dnl |
4777 | dnl ARP | |
4778 | dnl | |
4779 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4780 | table=0 priority=10 arp action=normal | |
4781 | table=0 priority=0 action=drop | |
4782 | dnl | |
2cd20955 JR |
4783 | dnl Pass tracked traffic through ACL, drop everything else. |
4784 | dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers | |
4785 | dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets | |
4786 | dnl get the ACL lookup using the conntrack tuple and the inverted direction. | |
4787 | dnl RELATED packets get ACL lookup using the conntrack tuple in the direction | |
28033773 | 4788 | dnl of the master connection, as stored in ct_label[0]. |
2cd20955 JR |
4789 | dnl |
4790 | dnl Incoming non-related packet in the original direction (ACL IN) | |
4791 | table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5 | |
4792 | dnl Incoming non-related reply packet (CT ACL OUT) | |
4793 | table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4 | |
4794 | dnl Outgoing non-related packet (ACL OUT) | |
4795 | table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5 | |
4796 | dnl Outgoing non-related reply packet (CT ACL IN) | |
4797 | table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4 | |
daf4d3c1 | 4798 | dnl |
2cd20955 | 4799 | dnl Related packet (CT ACL in the direction of the master connection.) |
28033773 | 4800 | table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_LABEL[[0]]->NXM_NX_REG0[[0]],resubmit(,3,ct),goto_table:4 |
daf4d3c1 JR |
4801 | dnl Drop everything else. |
4802 | table=1 priority=0, action=drop | |
4803 | dnl | |
2cd20955 JR |
4804 | dnl "ACL table" |
4805 | dnl | |
4806 | dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with | |
4807 | dnl IP source address '10.1.1.1'. Store rule ID (1234) in reg1, verdict | |
4808 | dnl in reg2. | |
4809 | table=3 priority=10, reg0=1, ip, nw_src=10.1.1.1 action=set_field:1234->reg1,set_field:1->reg2 | |
4810 | dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235) | |
4811 | table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2 | |
4812 | dnl | |
4813 | dnl Re-process stateful traffic that was not accepted by a stateful rule as | |
4814 | dnl normal traffic in the current direction. This should also delete the | |
4815 | dnl now stale conntrack state, so that new state can be created in it's place. | |
4816 | dnl | |
4817 | dnl Stateful accepts go to next table. | |
4818 | table=4 priority=100 reg2=1, action=goto_table:5 | |
4819 | dnl Everything else is reprocessed disregarding the CT state, using the actual | |
4820 | dnl packet direction. | |
4821 | table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5 | |
4822 | dnl | |
4823 | dnl "ACL verdict processing table." | |
4824 | dnl | |
4825 | dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0) | |
4826 | dnl | |
4827 | dnl Drop all non-accepted packets. | |
4828 | table=5 reg2=0 priority=1000 action=drop | |
daf4d3c1 | 4829 | dnl |
2cd20955 JR |
4830 | dnl Commit new incoming FTP control connections with SNAT range. Must match on |
4831 | dnl 'tcp' when setting 'alg=ftp'. Store the directionality of non-related | |
28033773 JR |
4832 | dnl connections to ct_label[0] Store the rule ID to ct_label[96..127]. |
4833 | table=5 priority=100 reg2=1 reg3=1 ct_state=+new-rel, tcp, tp_dst=21, action=ct(zone=NXM_NX_REG4[[0..15]],alg=ftp,commit,nat(src=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 | |
2cd20955 | 4834 | dnl Commit other new incoming non-related IP connections with SNAT range. |
28033773 | 4835 | table=5 priority=10 reg2=1 reg3=1 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(src=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 |
2cd20955 JR |
4836 | dnl Commit non-related outgoing new IP connections with DNAT range. |
4837 | dnl (This should not get any packets in this test.) | |
28033773 | 4838 | table=5 priority=10 reg2=1 reg3=2 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(dst=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 |
2cd20955 | 4839 | dnl Commit new related connections in either direction, which need 'nat' |
28033773 | 4840 | dnl and which inherit the label (the direction of the original direction |
2cd20955 JR |
4841 | dnl master tuple) from the master connection. |
4842 | table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 | |
4843 | dnl | |
4844 | dnl NAT incoming non-NEW packets. Outgoing packets were NATted in table 0. | |
4845 | dnl | |
4846 | table=5 priority=10 ct_state=-new+trk-inv reg3=1 ip, action=ct(zone=NXM_NX_REG4[[0..15]],nat),goto_table:6 | |
4847 | dnl Forward everything else, including stateless accepts. | |
4848 | table=5 priority=0 action=goto_table:6 | |
4849 | dnl | |
4850 | dnl "Forwarding table" | |
4851 | dnl | |
4852 | table=6 in_port=1 action=2 | |
4853 | table=6 in_port=2 action=1 | |
daf4d3c1 JR |
4854 | dnl |
4855 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4856 | dnl | |
2cd20955 | 4857 | table=8,reg2=$3,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
daf4d3c1 JR |
4858 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4859 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4860 | dnl TPA IP in reg2. | |
4861 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4862 | table=10 priority=100 arp xreg0=0 action=normal | |
4863 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
4864 | table=10 priority=0 action=drop | |
2cd20955 | 4865 | ], [dnl |
28033773 JR |
4866 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),zone=1,labels=0x4d2000000000000000000000001,protoinfo=(state=<cleared>),helper=ftp |
4867 | tcp,orig=(src=10.1.1.2,dst=$2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),zone=1,labels=0x4d2000000000000000000000001,protoinfo=(state=<cleared>) | |
2cd20955 | 4868 | ]) |
daf4d3c1 JR |
4869 | ]) |
4870 | ||
4871 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment with | |
4872 | dnl an ACL table based on matching on conntrack original direction tuple only. | |
efa29a89 | 4873 | CHECK_FTP_SNAT_ORIG_TUPLE([], [10.1.1.9], [0x0a010109]) |
daf4d3c1 JR |
4874 | |
4875 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment with | |
4876 | dnl an ACL table based on matching on conntrack original direction tuple only. | |
efa29a89 | 4877 | CHECK_FTP_SNAT_ORIG_TUPLE([seqadj], [10.1.1.240], [0x0a0101f0]) |
daf4d3c1 | 4878 | |
efa29a89 | 4879 | AT_SETUP([conntrack - IPv4 FTP Passive with SNAT]) |
200a9af9 DB |
4880 | AT_SKIP_IF([test $HAVE_FTP = no]) |
4881 | CHECK_CONNTRACK() | |
4882 | CHECK_CONNTRACK_NAT() | |
4883 | CHECK_CONNTRACK_ALG() | |
4884 | ||
4885 | OVS_TRAFFIC_VSWITCHD_START() | |
4886 | ||
4887 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4888 | ||
4889 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4890 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4891 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4892 | ||
4893 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4894 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4895 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4896 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
4897 | ||
4898 | dnl Allow any traffic from ns0->ns1. | |
4899 | AT_DATA([flows.txt], [dnl | |
4900 | dnl track all IPv4 traffic and NAT any established traffic. | |
4901 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4902 | table=0 priority=0 action=drop | |
4903 | dnl | |
4904 | dnl Table 1 | |
4905 | dnl | |
4906 | dnl Allow new FTP control connections. | |
4907 | table=1 in_port=1 ct_state=+new tcp nw_src=10.1.1.1 tp_dst=21 action=ct(alg=ftp,commit,nat(src=10.1.1.240)),2 | |
4908 | dnl Allow related TCP connections from port 1. | |
4909 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
4910 | dnl Allow established TCP connections both ways, post-NAT match. | |
4911 | table=1 in_port=1 ct_state=+est tcp nw_src=10.1.1.240 action=2 | |
4912 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4913 | ||
4914 | dnl Allow ICMP both ways. | |
4915 | table=1 priority=100 in_port=1 icmp, action=2 | |
4916 | table=1 priority=100 in_port=2 icmp, action=1 | |
4917 | table=1 priority=0, action=drop | |
4918 | ]) | |
4919 | ||
4920 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4921 | ||
4922 | dnl Check that the stacks working to avoid races. | |
4923 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
4924 | ||
4925 | OVS_START_L7([at_ns1], [ftp]) | |
4926 | ||
4927 | dnl FTP requests from p0->p1 should work fine. | |
4928 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4929 | ||
4930 | dnl Discards CLOSE_WAIT and CLOSING | |
4931 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4932 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
4933 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
4934 | ]) | |
4935 | ||
4936 | OVS_TRAFFIC_VSWITCHD_STOP | |
4937 | AT_CLEANUP | |
4938 | ||
efa29a89 DM |
4939 | AT_SETUP([conntrack - IPv4 FTP Passive with DNAT]) |
4940 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
4941 | CHECK_CONNTRACK() | |
4942 | CHECK_CONNTRACK_NAT() | |
4943 | CHECK_CONNTRACK_ALG() | |
4944 | ||
4945 | OVS_TRAFFIC_VSWITCHD_START() | |
4946 | ||
4947 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4948 | ||
4949 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4950 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4951 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4952 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.240 e6:66:c1:22:22:22]) | |
4953 | ||
4954 | ADD_VETH(p1, at_ns1, br0, "10.1.1.240/24") | |
4955 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4956 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4957 | ||
4958 | dnl Allow any traffic from ns0->ns1. | |
4959 | AT_DATA([flows.txt], [dnl | |
4960 | dnl track all IPv4 traffic and NAT any established traffic. | |
4961 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4962 | table=0 priority=0 action=drop | |
4963 | dnl | |
4964 | dnl Table 1 | |
4965 | dnl | |
4966 | dnl Allow new FTP control connections. | |
4967 | table=1 in_port=1 ct_state=+new tcp nw_src=10.1.1.1 tp_dst=21 action=ct(alg=ftp,commit,nat(dst=10.1.1.240)),2 | |
4968 | dnl Allow related TCP connections from port 1. | |
4969 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
4970 | dnl Allow established TCP connections both ways, post-NAT match. | |
4971 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.240 action=2 | |
4972 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4973 | ||
4974 | dnl Allow ICMP both ways. | |
4975 | table=1 priority=100 in_port=1 icmp, action=2 | |
4976 | table=1 priority=100 in_port=2 icmp, action=1 | |
4977 | table=1 priority=0, action=drop | |
4978 | ]) | |
4979 | ||
4980 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4981 | ||
4982 | dnl Check that the stacks working to avoid races. | |
4983 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.240 >/dev/null]) | |
4984 | ||
4985 | OVS_START_L7([at_ns1], [ftp]) | |
4986 | ||
4987 | dnl FTP requests from p0->p1 should work fine. | |
4988 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4989 | ||
4990 | dnl Discards CLOSE_WAIT and CLOSING | |
4991 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4992 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.240,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
4993 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.240,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
4994 | ]) | |
4995 | ||
4996 | OVS_TRAFFIC_VSWITCHD_STOP | |
4997 | AT_CLEANUP | |
4998 | ||
cd7c99a6 DB |
4999 | AT_SETUP([conntrack - IPv4 FTP Passive with DNAT 2]) |
5000 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
5001 | CHECK_CONNTRACK() | |
5002 | CHECK_CONNTRACK_NAT() | |
5003 | CHECK_CONNTRACK_ALG() | |
5004 | ||
5005 | OVS_TRAFFIC_VSWITCHD_START() | |
5006 | ||
5007 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5008 | ||
5009 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/16") | |
5010 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
5011 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.200 e6:66:c1:22:22:22]) | |
5012 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.100.1 e6:66:c1:22:22:22]) | |
5013 | ||
5014 | ADD_VETH(p1, at_ns1, br0, "10.1.100.1/16") | |
5015 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
5016 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
5017 | ||
5018 | dnl Allow any traffic from ns0->ns1. | |
5019 | AT_DATA([flows.txt], [dnl | |
5020 | dnl track all IPv4 traffic and NAT any established traffic. | |
5021 | table=0 priority=10 ip, action=ct(nat,table=1) | |
5022 | table=0 priority=0 action=drop | |
5023 | dnl | |
5024 | dnl Table 1 | |
5025 | dnl | |
5026 | dnl Allow new FTP control connections. | |
5027 | table=1 in_port=1 ct_state=+new tcp nw_src=10.1.1.1 tp_dst=21 action=ct(alg=ftp,commit,nat(dst=10.1.100.1)),2 | |
5028 | dnl Allow related TCP connections from port 1. | |
5029 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
5030 | dnl Allow established TCP connections both ways, post-NAT match. | |
5031 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.100.1 action=2 | |
5032 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
5033 | ||
5034 | dnl Allow ICMP both ways. | |
5035 | table=1 priority=100 in_port=1 icmp, action=2 | |
5036 | table=1 priority=100 in_port=2 icmp, action=1 | |
5037 | table=1 priority=0, action=drop | |
5038 | ]) | |
5039 | ||
5040 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5041 | ||
5042 | dnl Check that the stacks working to avoid races. | |
5043 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.100.1 >/dev/null]) | |
5044 | ||
5045 | OVS_START_L7([at_ns1], [ftp]) | |
5046 | ||
5047 | dnl FTP requests from p0->p1 should work fine. | |
5048 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.200 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
5049 | ||
5050 | dnl Discards CLOSE_WAIT and CLOSING | |
5051 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.200)], [0], [dnl | |
5052 | tcp,orig=(src=10.1.1.1,dst=10.1.1.200,sport=<cleared>,dport=<cleared>),reply=(src=10.1.100.1,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5053 | tcp,orig=(src=10.1.1.1,dst=10.1.1.200,sport=<cleared>,dport=<cleared>),reply=(src=10.1.100.1,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5054 | ]) | |
5055 | ||
5056 | OVS_TRAFFIC_VSWITCHD_STOP | |
5057 | AT_CLEANUP | |
5058 | ||
efa29a89 DM |
5059 | AT_SETUP([conntrack - IPv4 FTP Active with DNAT]) |
5060 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
5061 | CHECK_CONNTRACK() | |
5062 | CHECK_CONNTRACK_NAT() | |
5063 | CHECK_CONNTRACK_ALG() | |
5064 | ||
5065 | OVS_TRAFFIC_VSWITCHD_START() | |
5066 | ||
5067 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5068 | ||
5069 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5070 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
5071 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
5072 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.240 e6:66:c1:22:22:22]) | |
5073 | ||
5074 | ADD_VETH(p1, at_ns1, br0, "10.1.1.240/24") | |
5075 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
5076 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
5077 | ||
5078 | dnl Allow any traffic from ns0->ns1. | |
5079 | AT_DATA([flows.txt], [dnl | |
5080 | dnl track all IPv4 traffic and NAT any established traffic. | |
5081 | table=0 priority=10 ip, action=ct(nat,table=1) | |
5082 | table=0 priority=0 action=drop | |
5083 | dnl | |
5084 | dnl Table 1 | |
5085 | dnl | |
5086 | dnl Allow new FTP control connections. | |
5087 | table=1 in_port=1 ct_state=+new tcp nw_src=10.1.1.1 tp_dst=21 action=ct(alg=ftp,commit,nat(dst=10.1.1.240)),2 | |
5088 | dnl Allow related TCP connections from port 1. | |
5089 | table=1 in_port=2 ct_state=+new+rel tcp nw_src=10.1.1.240 action=ct(commit,nat),1 | |
5090 | dnl Allow established TCP connections both ways, post-NAT match. | |
5091 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.240 action=2 | |
5092 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
5093 | ||
5094 | dnl Allow ICMP both ways. | |
5095 | table=1 priority=100 in_port=1 icmp, action=2 | |
5096 | table=1 priority=100 in_port=2 icmp, action=1 | |
5097 | table=1 priority=0, action=drop | |
5098 | ]) | |
5099 | ||
5100 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5101 | ||
5102 | dnl Check that the stacks working to avoid races. | |
5103 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.240 >/dev/null]) | |
5104 | ||
5105 | OVS_START_L7([at_ns1], [ftp]) | |
5106 | ||
5107 | dnl FTP requests from p0->p1 should work fine. | |
5108 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
5109 | ||
5110 | dnl Discards CLOSE_WAIT and CLOSING | |
5111 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
5112 | tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.240,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5113 | tcp,orig=(src=10.1.1.240,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5114 | ]) | |
5115 | ||
5116 | OVS_TRAFFIC_VSWITCHD_STOP | |
5117 | AT_CLEANUP | |
5118 | ||
5119 | AT_SETUP([conntrack - IPv4 FTP Active with DNAT with reverse skew]) | |
5120 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
5121 | CHECK_CONNTRACK() | |
5122 | CHECK_CONNTRACK_NAT() | |
5123 | CHECK_CONNTRACK_ALG() | |
5124 | ||
5125 | OVS_TRAFFIC_VSWITCHD_START() | |
5126 | ||
5127 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5128 | ||
cd7c99a6 | 5129 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/16") |
efa29a89 DM |
5130 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) |
5131 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
cd7c99a6 | 5132 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.120.240 e6:66:c1:22:22:22]) |
efa29a89 | 5133 | |
cd7c99a6 | 5134 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/16") |
efa29a89 DM |
5135 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) |
5136 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
5137 | ||
5138 | dnl Allow any traffic from ns0->ns1. | |
5139 | AT_DATA([flows.txt], [dnl | |
5140 | dnl track all IPv4 traffic and NAT any established traffic. | |
5141 | table=0 priority=10 ip, action=ct(nat,table=1) | |
5142 | table=0 priority=0 action=drop | |
5143 | dnl | |
5144 | dnl Table 1 | |
5145 | dnl | |
5146 | dnl Allow new FTP control connections. | |
5147 | table=1 in_port=1 ct_state=+new tcp nw_src=10.1.1.1 tp_dst=21 action=ct(alg=ftp,commit,nat(dst=10.1.1.2)),2 | |
5148 | dnl Allow related TCP connections from port 1. | |
5149 | table=1 in_port=2 ct_state=+new+rel tcp nw_src=10.1.1.2 action=ct(commit,nat),1 | |
5150 | dnl Allow established TCP connections both ways, post-NAT match. | |
5151 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.2 action=2 | |
5152 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
5153 | ||
5154 | dnl Allow ICMP both ways. | |
5155 | table=1 priority=100 in_port=1 icmp, action=2 | |
5156 | table=1 priority=100 in_port=2 icmp, action=1 | |
5157 | table=1 priority=0, action=drop | |
5158 | ]) | |
5159 | ||
5160 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5161 | ||
5162 | dnl Check that the stacks working to avoid races. | |
5163 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
5164 | ||
5165 | OVS_START_L7([at_ns1], [ftp]) | |
5166 | ||
5167 | dnl FTP requests from p0->p1 should work fine. | |
cd7c99a6 | 5168 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.120.240 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
efa29a89 DM |
5169 | |
5170 | dnl Discards CLOSE_WAIT and CLOSING | |
cd7c99a6 DB |
5171 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.120.240)], [0], [dnl |
5172 | tcp,orig=(src=10.1.1.1,dst=10.1.120.240,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5173 | tcp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.120.240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
efa29a89 DM |
5174 | ]) |
5175 | ||
5176 | OVS_TRAFFIC_VSWITCHD_STOP | |
5177 | AT_CLEANUP | |
5178 | ||
b020a416 | 5179 | AT_SETUP([conntrack - IPv6 HTTP with SNAT]) |
9ac0aada | 5180 | CHECK_CONNTRACK() |
4573c42e | 5181 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
5182 | OVS_TRAFFIC_VSWITCHD_START() |
5183 | ||
5184 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5185 | ||
5186 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5187 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5188 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5189 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
b020a416 | 5190 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::241 lladdr 80:88:88:88:88:88 dev p1]) |
9ac0aada JR |
5191 | |
5192 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
5193 | AT_DATA([flows.txt], [dnl | |
5194 | priority=1,action=drop | |
5195 | priority=10,icmp6,action=normal | |
b020a416 | 5196 | priority=100,in_port=1,ip6,action=ct(commit,nat(src=fc00::240-fc00::241)),2 |
9ac0aada JR |
5197 | priority=100,in_port=2,ct_state=-trk,ip6,action=ct(nat,table=0) |
5198 | priority=100,in_port=2,ct_state=+trk+est,ip6,action=1 | |
5199 | priority=200,in_port=2,ct_state=+trk+new,icmp6,icmpv6_code=0,icmpv6_type=135,nd_target=fc00::240,action=ct(commit,nat(dst=fc00::1)),1 | |
b020a416 | 5200 | priority=200,in_port=2,ct_state=+trk+new,icmp6,icmpv6_code=0,icmpv6_type=135,nd_target=fc00::241,action=ct(commit,nat(dst=fc00::1)),1 |
9ac0aada JR |
5201 | ]) |
5202 | ||
5203 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5204 | ||
c10840ff JS |
5205 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
5206 | dnl waiting, we get occasional failures due to the following error: | |
9ac0aada | 5207 | dnl "connect: Cannot assign requested address" |
c10840ff | 5208 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
9ac0aada JR |
5209 | |
5210 | dnl HTTP requests from ns0->ns1 should work fine. | |
7ed40afe | 5211 | OVS_START_L7([at_ns1], [http6]) |
9ac0aada JR |
5212 | |
5213 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
5214 | ||
5215 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
5216 | dnl Try 3 times, in 1 second intervals. | |
7ed40afe | 5217 | OVS_START_L7([at_ns0], [http6]) |
9ac0aada JR |
5218 | NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 -v -o wget1.log], [4]) |
5219 | ||
5220 | OVS_TRAFFIC_VSWITCHD_STOP | |
5221 | AT_CLEANUP | |
5222 | ||
b020a416 DB |
5223 | AT_SETUP([conntrack - IPv6 HTTP with DNAT]) |
5224 | CHECK_CONNTRACK() | |
5225 | CHECK_CONNTRACK_NAT() | |
5226 | OVS_TRAFFIC_VSWITCHD_START() | |
5227 | ||
5228 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5229 | ||
5230 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5231 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5232 | NS_CHECK_EXEC([at_ns0], [ip -6 link set dev p0 address 80:88:88:88:88:77]) | |
5233 | NS_CHECK_EXEC([at_ns1], [ip -6 link set dev p1 address 80:88:88:88:88:88]) | |
5234 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p0]) | |
5235 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:77 dev p1]) | |
5236 | ||
5237 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
5238 | AT_DATA([flows.txt], [dnl | |
5239 | priority=100 in_port=1,ip6,ipv6_dst=fc00::240,action=ct(zone=1,nat(dst=fc00::2),commit),2 | |
5240 | priority=100 in_port=2,ct_state=-trk,ip6,action=ct(table=0,nat,zone=1) | |
5241 | priority=100 in_port=2,ct_state=+trk+est,ct_zone=1,ip6,action=1 | |
5242 | ]) | |
5243 | ||
5244 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5245 | ||
5246 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5247 | dnl waiting, we get occasional failures due to the following error: | |
5248 | dnl "connect: Cannot assign requested address" | |
5249 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::240]) | |
5250 | ||
5251 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::240 | FORMAT_PING], [0], [dnl | |
5252 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5253 | ]) | |
5254 | ||
5255 | dnl Should work with the virtual IP address through NAT | |
5256 | OVS_START_L7([at_ns1], [http6]) | |
5257 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::240]] -t 5 -T 1 --retry-connrefused -v -o wget0.log]) | |
5258 | ||
5259 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::1)], [0], [dnl | |
5260 | icmpv6,orig=(src=fc00::1,dst=fc00::240,id=<cleared>,type=128,code=0),reply=(src=fc00::2,dst=fc00::1,id=<cleared>,type=129,code=0),zone=1 | |
5261 | tcp,orig=(src=fc00::1,dst=fc00::240,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),zone=1,protoinfo=(state=<cleared>) | |
5262 | ]) | |
5263 | ||
5264 | OVS_TRAFFIC_VSWITCHD_STOP | |
5265 | AT_CLEANUP | |
5266 | ||
5267 | AT_SETUP([conntrack - IPv6 ICMP6 Related with SNAT]) | |
5268 | AT_SKIP_IF([test $HAVE_TCPDUMP = no]) | |
5269 | CHECK_CONNTRACK() | |
5270 | CHECK_CONNTRACK_NAT() | |
5271 | OVS_TRAFFIC_VSWITCHD_START() | |
5272 | ||
5273 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5274 | ||
5275 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5276 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5277 | NS_CHECK_EXEC([at_ns0], [ip -6 link set dev p0 address 80:88:88:88:88:77]) | |
5278 | NS_CHECK_EXEC([at_ns1], [ip -6 link set dev p1 address 80:88:88:88:88:88]) | |
5279 | ||
5280 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:88 dev p0]) | |
5281 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::3 lladdr 80:88:88:88:88:88 dev p0]) | |
5282 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:77 dev p1]) | |
5283 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:77 dev p1]) | |
5284 | ||
5285 | NS_CHECK_EXEC([at_ns0], [ip -6 route add default via fc00::2]) | |
5286 | ||
5287 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
5288 | AT_DATA([flows.txt], [dnl | |
5289 | priority=100 in_port=1,ip6,action=ct(nat(src=fc00::240),commit),2 | |
5290 | priority=100 in_port=2,ct_state=-trk,ip6,action=ct(table=0,nat) | |
5291 | priority=100 in_port=2,ct_state=+trk+est,ip6,action=1 | |
5292 | priority=100 in_port=2,ct_state=+trk+rel,ip6,action=1 | |
5293 | ]) | |
5294 | ||
5295 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5296 | ||
5297 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5298 | dnl waiting, we get occasional failures due to the following error: | |
5299 | dnl "connect: Cannot assign requested address" | |
5300 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
5301 | ||
5302 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
5303 | ||
5304 | rm p0.pcap | |
5305 | tcpdump -U -i ovs-p0 -w p0.pcap & | |
5306 | sleep 1 | |
5307 | ||
5308 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. | |
5309 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc -6 $NC_EOF_OPT -u fc00::2 1"]) | |
5310 | ||
5311 | AT_CHECK([tcpdump -v "icmp6" -r p0.pcap 2>/dev/null | egrep 'wrong|bad'], [1], [ignore-nolog]) | |
5312 | ||
5313 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5314 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>) | |
5315 | ]) | |
5316 | ||
5317 | OVS_TRAFFIC_VSWITCHD_STOP | |
5318 | AT_CLEANUP | |
9ac0aada | 5319 | |
efa29a89 | 5320 | AT_SETUP([conntrack - IPv6 FTP with SNAT]) |
40c7b2fc | 5321 | AT_SKIP_IF([test $HAVE_FTP = no]) |
9ac0aada | 5322 | CHECK_CONNTRACK() |
4573c42e | 5323 | CHECK_CONNTRACK_NAT() |
fc9a5ee1 DB |
5324 | CHECK_CONNTRACK_ALG() |
5325 | ||
9ac0aada JR |
5326 | OVS_TRAFFIC_VSWITCHD_START() |
5327 | ||
5328 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5329 | ||
5330 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5331 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5332 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5333 | dnl Would be nice if NAT could translate neighbor discovery messages, too. | |
5334 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5335 | ||
5336 | dnl Allow any traffic from ns0->ns1. | |
5337 | dnl Only allow nd, return traffic from ns1->ns0. | |
5338 | AT_DATA([flows.txt], [dnl | |
9ac0aada JR |
5339 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) |
5340 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5341 | table=0 priority=0 action=drop | |
5342 | dnl | |
5343 | dnl Table 1 | |
5344 | dnl | |
5345 | dnl Allow new TCPv6 FTP control connections. | |
5346 | table=1 in_port=1 ct_state=+new tcp6 ipv6_src=fc00::1 tp_dst=21 action=ct(alg=ftp,commit,nat(src=fc00::240)),2 | |
5347 | dnl Allow related TCPv6 connections from port 2 to the NATted address. | |
5348 | table=1 in_port=2 ct_state=+new+rel tcp6 ipv6_dst=fc00::240 action=ct(commit,nat),1 | |
5349 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5350 | table=1 in_port=1 ct_state=+est tcp6 ipv6_src=fc00::240 action=2 | |
5351 | table=1 in_port=2 ct_state=+est tcp6 ipv6_dst=fc00::1 action=1 | |
daf4d3c1 JR |
5352 | dnl Allow other ICMPv6 both ways (without commit). |
5353 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5354 | table=1 priority=100 in_port=2 icmp6, action=1 | |
9ac0aada JR |
5355 | dnl Drop everything else. |
5356 | table=1 priority=0, action=drop | |
5357 | ]) | |
5358 | ||
5359 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5360 | ||
c10840ff JS |
5361 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
5362 | dnl waiting, we get occasional failures due to the following error: | |
5363 | dnl "connect: Cannot assign requested address" | |
5364 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5365 | ||
7ed40afe | 5366 | OVS_START_L7([at_ns1], [ftp]) |
9ac0aada JR |
5367 | |
5368 | dnl FTP requests from p0->p1 should work fine. | |
4fee8b13 | 5369 | NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) |
9ac0aada | 5370 | |
a857bb69 | 5371 | dnl Discards CLOSE_WAIT and CLOSING |
420c73b2 JR |
5372 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl |
5373 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5374 | tcp,orig=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),reply=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
9ac0aada JR |
5375 | ]) |
5376 | ||
5377 | OVS_TRAFFIC_VSWITCHD_STOP | |
5378 | AT_CLEANUP | |
2c66ebe4 | 5379 | |
efa29a89 | 5380 | AT_SETUP([conntrack - IPv6 FTP Passive with SNAT]) |
200a9af9 DB |
5381 | AT_SKIP_IF([test $HAVE_FTP = no]) |
5382 | CHECK_CONNTRACK() | |
5383 | CHECK_CONNTRACK_NAT() | |
5384 | CHECK_CONNTRACK_ALG() | |
5385 | ||
5386 | OVS_TRAFFIC_VSWITCHD_START() | |
5387 | ||
5388 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5389 | ||
5390 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5391 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5392 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5393 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:99]) | |
5394 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:99 dev p0]) | |
5395 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5396 | ||
5397 | dnl Allow any traffic from ns0->ns1. | |
5398 | dnl Only allow nd, return traffic from ns1->ns0. | |
5399 | AT_DATA([flows.txt], [dnl | |
5400 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) | |
5401 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5402 | table=0 priority=0 action=drop | |
5403 | dnl | |
5404 | dnl Table 1 | |
5405 | dnl | |
5406 | dnl Allow new TCPv6 FTP control connections. | |
5407 | table=1 in_port=1 ct_state=+new tcp6 ipv6_src=fc00::1 tp_dst=21 action=ct(alg=ftp,commit,nat(src=fc00::240)),2 | |
5408 | dnl Allow related TCPv6 connections from port 1. | |
5409 | table=1 in_port=1 ct_state=+new+rel tcp6 ipv6_dst=fc00::2 action=ct(commit,nat),2 | |
5410 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5411 | table=1 in_port=1 ct_state=+est tcp6 ipv6_src=fc00::240 action=2 | |
5412 | table=1 in_port=2 ct_state=+est tcp6 ipv6_dst=fc00::1 action=1 | |
5413 | dnl Allow other ICMPv6 both ways (without commit). | |
5414 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5415 | table=1 priority=100 in_port=2 icmp6, action=1 | |
5416 | dnl Drop everything else. | |
5417 | table=1 priority=0, action=drop | |
5418 | ]) | |
5419 | ||
5420 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5421 | ||
5422 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5423 | dnl waiting, we get occasional failures due to the following error: | |
5424 | dnl "connect: Cannot assign requested address" | |
5425 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5426 | ||
5427 | OVS_START_L7([at_ns1], [ftp]) | |
5428 | ||
5429 | dnl FTP requests from p0->p1 should work fine. | |
5430 | NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) | |
5431 | ||
5432 | dnl Discards CLOSE_WAIT and CLOSING | |
5433 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5434 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5435 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5436 | ]) | |
5437 | ||
5438 | OVS_TRAFFIC_VSWITCHD_STOP | |
5439 | AT_CLEANUP | |
daf4d3c1 | 5440 | |
efa29a89 | 5441 | AT_SETUP([conntrack - IPv6 FTP with SNAT - orig tuple]) |
daf4d3c1 JR |
5442 | AT_SKIP_IF([test $HAVE_FTP = no]) |
5443 | CHECK_CONNTRACK() | |
5444 | CHECK_CONNTRACK_NAT() | |
aeae4330 | 5445 | CHECK_CONNTRACK_ALG() |
daf4d3c1 JR |
5446 | OVS_TRAFFIC_VSWITCHD_START() |
5447 | ||
5448 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5449 | ||
5450 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5451 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5452 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5453 | dnl Would be nice if NAT could translate neighbor discovery messages, too. | |
5454 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5455 | ||
5456 | dnl Allow any traffic from ns0->ns1. | |
5457 | dnl Only allow nd, return traffic from ns1->ns0. | |
5458 | AT_DATA([flows.txt], [dnl | |
5459 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) | |
5460 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5461 | table=0 priority=0 action=drop | |
5462 | dnl | |
5463 | dnl Table 1 | |
5464 | dnl | |
5465 | dnl Allow other ICMPv6 both ways (without commit). | |
5466 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5467 | table=1 priority=100 in_port=2 icmp6, action=1 | |
5468 | dnl Allow new TCPv6 FTP control connections. | |
5469 | table=1 priority=10 in_port=1 ct_state=+new+trk-inv tcp6 ct_nw_proto=6 ct_ipv6_src=fc00::1 ct_tp_dst=21 action=ct(alg=ftp,commit,nat(src=fc00::240)),2 | |
5470 | dnl Allow related TCPv6 connections from port 2 to the NATted address. | |
5471 | table=1 priority=10 in_port=2 ct_state=+new+rel+trk-inv ipv6 ct_nw_proto=6 ct_ipv6_src=fc00::1 ct_tp_dst=21 action=ct(commit,nat),1 | |
5472 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5473 | table=1 priority=10 in_port=1 ct_state=+est+trk-inv ipv6 ct_nw_proto=6 ct_ipv6_src=fc00::1 ct_tp_dst=21 action=2 | |
5474 | table=1 priority=10 in_port=2 ct_state=+est+trk-inv ipv6 ct_nw_proto=6 ct_ipv6_src=fc00::1 ct_tp_dst=21 action=1 | |
5475 | dnl Drop everything else. | |
5476 | table=1 priority=0, action=drop | |
5477 | ]) | |
5478 | ||
5479 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5480 | ||
5481 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5482 | dnl waiting, we get occasional failures due to the following error: | |
5483 | dnl "connect: Cannot assign requested address" | |
5484 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5485 | ||
1ca0323e | 5486 | NETNS_DAEMONIZE([at_ns1], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp0.pid]) |
daf4d3c1 JR |
5487 | OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) |
5488 | ||
5489 | dnl FTP requests from p0->p1 should work fine. | |
5490 | NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) | |
5491 | ||
5492 | dnl Discards CLOSE_WAIT and CLOSING | |
5493 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5494 | tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>),helper=ftp | |
5495 | tcp,orig=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>),reply=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5496 | ]) | |
5497 | ||
5498 | OVS_TRAFFIC_VSWITCHD_STOP | |
5499 | AT_CLEANUP | |
5500 | ||
efa29a89 | 5501 | AT_SETUP([conntrack - IPv4 TFTP with SNAT]) |
8fc6257b | 5502 | AT_SKIP_IF([test $HAVE_TFTP = no]) |
200a9af9 DB |
5503 | CHECK_CONNTRACK() |
5504 | CHECK_CONNTRACK_NAT() | |
5505 | CHECK_CONNTRACK_ALG() | |
5506 | ||
5507 | OVS_TRAFFIC_VSWITCHD_START() | |
5508 | ||
5509 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5510 | ||
5511 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5512 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
5513 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
5514 | ||
5515 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
5516 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
5517 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
5518 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
5519 | ||
5520 | dnl Allow any traffic from ns0->ns1. | |
5521 | AT_DATA([flows.txt], [dnl | |
5522 | dnl track all IPv4 traffic. | |
5523 | table=0 priority=10 ip, action=ct(table=1) | |
5524 | dnl drop everything else. | |
5525 | table=0 priority=0 action=drop | |
5526 | dnl | |
5527 | dnl Table 1 | |
5528 | dnl Allow ICMP both ways. | |
5529 | table=1 priority=100 in_port=1 icmp, action=2 | |
5530 | table=1 priority=100 in_port=2 icmp, action=1 | |
5531 | dnl | |
5532 | dnl Allow new TFTP control connections. | |
5533 | table=1 in_port=1 ct_state=+new udp nw_src=10.1.1.1 tp_dst=69 action=ct(alg=tftp,commit,nat(src=10.1.1.240)),2 | |
5534 | dnl Allow related UDP connections from port 1. | |
5535 | table=1 in_port=2 ct_state=+new+rel udp nw_src=10.1.1.2 action=ct(commit,nat),1 | |
5536 | dnl Allow established and NAT them. | |
5537 | table=1 in_port=1 ct_state=+est udp nw_src=10.1.1.1 action=ct(nat,table=2) | |
5538 | table=1 in_port=2 ct_state=+est udp nw_src=10.1.1.2 action=ct(nat,table=2) | |
5539 | dnl | |
5540 | table=1 priority=0, action=drop | |
5541 | dnl | |
5542 | table=2 in_port=1 ct_state=+est udp nw_src=10.1.1.240 action=2 | |
5543 | table=2 in_port=2 ct_state=+est udp nw_dst=10.1.1.1 action=1 | |
5544 | ]) | |
5545 | ||
5546 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5547 | ||
5548 | dnl Check that the stacks working to avoid races. | |
5549 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
5550 | ||
5551 | OVS_START_L7([at_ns0], [tftp]) | |
5552 | OVS_START_L7([at_ns1], [tftp]) | |
5553 | ||
5554 | dnl TFTP requests from p0->p1 should work fine. | |
5555 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows.txt -o foo 2>curl0.log]]) | |
5556 | ||
5557 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
5558 | udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.240,sport=<cleared>,dport=<cleared>),helper=tftp | |
5559 | udp,orig=(src=10.1.1.2,dst=10.1.1.240,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>) | |
5560 | ]) | |
5561 | ||
5562 | OVS_TRAFFIC_VSWITCHD_STOP | |
5563 | AT_CLEANUP | |
daf4d3c1 | 5564 | |
2c66ebe4 JR |
5565 | AT_SETUP([conntrack - DNAT load balancing]) |
5566 | CHECK_CONNTRACK() | |
4573c42e | 5567 | CHECK_CONNTRACK_NAT() |
2c66ebe4 JR |
5568 | OVS_TRAFFIC_VSWITCHD_START() |
5569 | ||
5570 | ADD_NAMESPACES(at_ns1, at_ns2, at_ns3, at_ns4) | |
5571 | ||
5572 | ADD_VETH(p1, at_ns1, br0, "10.1.1.1/24") | |
5573 | ADD_VETH(p2, at_ns2, br0, "10.1.1.2/24") | |
5574 | ADD_VETH(p3, at_ns3, br0, "10.1.1.3/24") | |
5575 | ADD_VETH(p4, at_ns4, br0, "10.1.1.4/24") | |
5576 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:11]) | |
5577 | NS_CHECK_EXEC([at_ns2], [ip link set dev p2 address 80:88:88:88:88:22]) | |
5578 | NS_CHECK_EXEC([at_ns3], [ip link set dev p3 address 80:88:88:88:88:33]) | |
5579 | NS_CHECK_EXEC([at_ns4], [ip link set dev p4 address 80:88:88:88:88:44]) | |
5580 | ||
5581 | dnl Select group for load balancing. One bucket per server. Each bucket | |
5582 | dnl tracks and NATs the connection and recirculates to table 4 for egress | |
5583 | dnl routing. Packets of existing connections are always NATted based on | |
5584 | dnl connection state, only new connections are NATted according to the | |
5585 | dnl specific NAT parameters in each bucket. | |
5586 | AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 "group_id=234,type=select,bucket=weight=100,ct(nat(dst=10.1.1.2),commit,table=4),bucket=weight=100,ct(nat(dst=10.1.1.3),commit,table=4),bucket=weight=100,ct(nat(dst=10.1.1.4),commit,table=4)"]) | |
5587 | ||
5588 | AT_DATA([flows.txt], [dnl | |
5589 | dnl Track connections to the virtual IP address. | |
5590 | table=0 priority=100 ip nw_dst=10.1.1.64 action=group:234 | |
5591 | dnl All other IP traffic is allowed but the connection state is no commited. | |
5592 | table=0 priority=90 ip action=ct(table=4,nat) | |
5593 | dnl | |
5594 | dnl Allow ARP, but generate responses for virtual addresses | |
5595 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
5596 | table=0 priority=10 arp action=normal | |
5597 | table=0 priority=0 action=drop | |
5598 | dnl | |
5599 | dnl Routing table | |
5600 | dnl | |
5601 | table=4,ip,nw_dst=10.1.1.1 action=mod_dl_dst:80:88:88:88:88:11,output:1 | |
5602 | table=4,ip,nw_dst=10.1.1.2 action=mod_dl_dst:80:88:88:88:88:22,output:2 | |
5603 | table=4,ip,nw_dst=10.1.1.3 action=mod_dl_dst:80:88:88:88:88:33,output:3 | |
5604 | table=4,ip,nw_dst=10.1.1.4 action=mod_dl_dst:80:88:88:88:88:44,output:4 | |
5605 | table=4 priority=0 action=drop | |
5606 | dnl | |
5607 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
5608 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
5609 | dnl Zero result means not found. | |
5610 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
5611 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
5612 | dnl TPA IP in reg2. | |
5613 | table=10 priority=100 arp xreg0=0 action=normal | |
5614 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
5615 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
5616 | table=10 priority=0 action=controller | |
5617 | ]) | |
5618 | ||
5619 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5620 | ||
5621 | dnl Start web servers | |
7ed40afe JS |
5622 | OVS_START_L7([at_ns2], [http]) |
5623 | OVS_START_L7([at_ns3], [http]) | |
5624 | OVS_START_L7([at_ns4], [http]) | |
2c66ebe4 JR |
5625 | |
5626 | on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0' | |
5627 | on_exit 'ovs-appctl revalidator/purge' | |
5628 | on_exit 'ovs-appctl dpif/dump-flows br0' | |
5629 | ||
5630 | dnl Should work with the virtual IP address through NAT | |
5631 | for i in 1 2 3 4 5 6 7 8 9 10 11 12; do | |
5632 | echo Request $i | |
5633 | NS_CHECK_EXEC([at_ns1], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget$i.log]) | |
5634 | done | |
5635 | ||
5636 | dnl Each server should have at least one connection. | |
420c73b2 JR |
5637 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
5638 | tcp,orig=(src=10.1.1.1,dst=10.1.1.64,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5639 | tcp,orig=(src=10.1.1.1,dst=10.1.1.64,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.3,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
5640 | tcp,orig=(src=10.1.1.1,dst=10.1.1.64,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>) | |
2c66ebe4 JR |
5641 | ]) |
5642 | ||
5643 | ovs-appctl dpif/dump-flows br0 | |
5644 | ovs-appctl revalidator/purge | |
5645 | ovs-ofctl -O OpenFlow15 dump-flows br0 | |
5646 | ovs-ofctl -O OpenFlow15 dump-group-stats br0 | |
5647 | ||
5648 | OVS_TRAFFIC_VSWITCHD_STOP | |
5649 | AT_CLEANUP | |
5650 | ||
5651 | ||
5652 | AT_SETUP([conntrack - DNAT load balancing with NC]) | |
9c1ab985 | 5653 | AT_SKIP_IF([test $HAVE_NC = no]) |
2c66ebe4 | 5654 | CHECK_CONNTRACK() |
4573c42e | 5655 | CHECK_CONNTRACK_NAT() |
2c66ebe4 JR |
5656 | OVS_TRAFFIC_VSWITCHD_START() |
5657 | ||
5658 | ADD_NAMESPACES(at_ns1, at_ns2, at_ns3, at_ns4, at_ns5) | |
5659 | ||
5660 | ADD_VETH(p1, at_ns1, br0, "10.1.1.1/24") | |
5661 | ADD_VETH(p2, at_ns2, br0, "10.1.1.2/24") | |
5662 | ADD_VETH(p3, at_ns3, br0, "10.1.1.3/24") | |
5663 | ADD_VETH(p4, at_ns4, br0, "10.1.1.4/24") | |
5664 | ADD_VETH(p5, at_ns5, br0, "10.1.1.5/24") | |
5665 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:11]) | |
5666 | NS_CHECK_EXEC([at_ns2], [ip link set dev p2 address 80:88:88:88:88:22]) | |
5667 | NS_CHECK_EXEC([at_ns3], [ip link set dev p3 address 80:88:88:88:88:33]) | |
5668 | NS_CHECK_EXEC([at_ns4], [ip link set dev p4 address 80:88:88:88:88:44]) | |
5669 | NS_CHECK_EXEC([at_ns5], [ip link set dev p5 address 80:88:88:88:88:55]) | |
5670 | ||
5671 | dnl Select group for load balancing. One bucket per server. Each bucket | |
5672 | dnl tracks and NATs the connection and recirculates to table 4 for egress | |
5673 | dnl routing. Packets of existing connections are always NATted based on | |
5674 | dnl connection state, only new connections are NATted according to the | |
5675 | dnl specific NAT parameters in each bucket. | |
5676 | AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 "group_id=234,type=select,bucket=weight=100,ct(nat(dst=10.1.1.2),commit,table=4),bucket=weight=100,ct(nat(dst=10.1.1.3),commit,table=4),bucket=weight=100,ct(nat(dst=10.1.1.4),commit,table=4)"]) | |
5677 | ||
5678 | AT_DATA([flows.txt], [dnl | |
5679 | dnl Track connections to the virtual IP address. | |
5680 | table=0 priority=100 ip nw_dst=10.1.1.64 action=group:234 | |
5681 | dnl All other IP traffic is allowed but the connection state is no commited. | |
5682 | table=0 priority=90 ip action=ct(table=4,nat) | |
5683 | dnl | |
5684 | dnl Allow ARP, but generate responses for virtual addresses | |
5685 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
5686 | table=0 priority=10 arp action=normal | |
5687 | table=0 priority=0 action=drop | |
5688 | dnl | |
5689 | dnl Routing table | |
5690 | dnl | |
5691 | table=4,ip,nw_dst=10.1.1.1 action=mod_dl_dst:80:88:88:88:88:11,output:1 | |
5692 | table=4,ip,nw_dst=10.1.1.2 action=mod_dl_dst:80:88:88:88:88:22,output:2 | |
5693 | table=4,ip,nw_dst=10.1.1.3 action=mod_dl_dst:80:88:88:88:88:33,output:3 | |
5694 | table=4,ip,nw_dst=10.1.1.4 action=mod_dl_dst:80:88:88:88:88:44,output:4 | |
5695 | table=4,ip,nw_dst=10.1.1.5 action=mod_dl_dst:80:88:88:88:88:55,output:5 | |
5696 | table=4 priority=0 action=drop | |
5697 | dnl | |
5698 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
5699 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
5700 | dnl Zero result means not found. | |
5701 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
5702 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
5703 | dnl TPA IP in reg2. | |
5704 | table=10 priority=100 arp xreg0=0 action=normal | |
5705 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
5706 | table=10 priority=10,arp,arp_op=1,action=load:2->OXM_OF_ARP_OP[[]],move:OXM_OF_ARP_SHA[[]]->OXM_OF_ARP_THA[[]],move:OXM_OF_PKT_REG0[[0..47]]->OXM_OF_ARP_SHA[[]],move:OXM_OF_ARP_SPA[[]]->OXM_OF_ARP_TPA[[]],move:NXM_NX_REG2[[]]->OXM_OF_ARP_SPA[[]],move:NXM_OF_ETH_SRC[[]]->NXM_OF_ETH_DST[[]],move:OXM_OF_PKT_REG0[[0..47]]->NXM_OF_ETH_SRC[[]],move:NXM_OF_IN_PORT[[]]->NXM_NX_REG3[[0..15]],load:0->NXM_OF_IN_PORT[[]],output:NXM_NX_REG3[[0..15]] | |
5707 | table=10 priority=0 action=controller | |
5708 | ]) | |
5709 | ||
5710 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5711 | ||
5712 | dnl Start web servers | |
7ed40afe JS |
5713 | OVS_START_L7([at_ns2], [http]) |
5714 | OVS_START_L7([at_ns3], [http]) | |
5715 | OVS_START_L7([at_ns4], [http]) | |
2c66ebe4 JR |
5716 | |
5717 | on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0' | |
5718 | on_exit 'ovs-appctl revalidator/purge' | |
5719 | on_exit 'ovs-appctl dpif/dump-flows br0' | |
5720 | ||
5721 | sleep 5 | |
5722 | ||
5723 | dnl Should work with the virtual IP address through NAT | |
5724 | for i in 1 2 3 4 5 6 7 8 9; do | |
5725 | echo Request $i | |
5726 | NS_CHECK_EXEC([at_ns1], [echo "TEST1" | nc -p 4100$i 10.1.1.64 80 > nc-1-$i.log]) | |
5727 | NS_CHECK_EXEC([at_ns5], [echo "TEST5" | nc -p 4100$i 10.1.1.64 80 > nc-5-$i.log]) | |
5728 | done | |
5729 | ||
5730 | conntrack -L 2>&1 | |
5731 | ||
5732 | ovs-appctl dpif/dump-flows br0 | |
5733 | ovs-appctl revalidator/purge | |
5734 | ovs-ofctl -O OpenFlow15 dump-flows br0 | |
5735 | ovs-ofctl -O OpenFlow15 dump-group-stats br0 | |
5736 | ||
5737 | OVS_TRAFFIC_VSWITCHD_STOP | |
5738 | AT_CLEANUP | |
b4fa814c | 5739 | |
8d48d5f3 EG |
5740 | AT_SETUP([conntrack - floating IP]) |
5741 | AT_SKIP_IF([test $HAVE_NC = no]) | |
5742 | CHECK_CONNTRACK() | |
5743 | OVS_TRAFFIC_VSWITCHD_START() | |
5744 | OVS_CHECK_CT_CLEAR() | |
5745 | ||
5746 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5747 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24", "f0:00:00:01:01:01") dnl FIP 10.254.254.1 | |
5748 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24", "f0:00:00:01:01:02") dnl FIP 10.254.254.2 | |
5749 | ||
5750 | dnl Static ARPs | |
5751 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.2 lladdr f0:00:00:01:01:02 dev p0]) | |
5752 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.1 lladdr f0:00:00:01:01:01 dev p1]) | |
5753 | ||
5754 | dnl Static ARP and route entries for the FIP "gateway" | |
5755 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p0]) | |
5756 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p1]) | |
5757 | NS_CHECK_EXEC([at_ns0], [ip route add default nexthop via 10.1.1.254]) | |
5758 | NS_CHECK_EXEC([at_ns1], [ip route add default nexthop via 10.1.1.254]) | |
5759 | ||
5760 | NETNS_DAEMONIZE([at_ns0], [nc -l -k 1234 > /dev/null], [nc0.pid]) | |
5761 | ||
5762 | AT_DATA([flows.txt], [dnl | |
5763 | table=0,priority=10 ip action=ct(table=1) | |
5764 | table=0,priority=1 action=drop | |
5765 | dnl dst FIP | |
5766 | table=1,priority=20 ip,ct_state=+trk+est,nw_dst=10.254.254.0/24 action=goto_table:10 | |
5767 | table=1,priority=20 ip,ct_state=+trk+new,nw_dst=10.254.254.0/24 action=ct(commit,table=10) | |
5768 | dnl dst local | |
5769 | table=1,priority=10 ip,ct_state=+trk+est action=goto_table:20 | |
5770 | table=1,priority=10 ip,ct_state=+trk+new action=ct(commit,table=20) | |
5771 | table=1,priority=1 ip,ct_state=+trk+inv action=drop | |
5772 | dnl | |
5773 | dnl FIP translation (dst FIP, src local) --> (dst local, src FIP) | |
5774 | table=10 ip,nw_dst=10.254.254.1 action=set_field:10.1.1.1->nw_dst,goto_table:11 | |
5775 | table=10 ip,nw_dst=10.254.254.2 action=set_field:10.1.1.2->nw_dst,goto_table:11 | |
5776 | table=11 ip,nw_src=10.1.1.1 action=set_field:10.254.254.1->nw_src,goto_table:12 | |
5777 | table=11 ip,nw_src=10.1.1.2 action=set_field:10.254.254.2->nw_src,goto_table:12 | |
5778 | dnl clear conntrack and do another lookup since we changed the tuple | |
5779 | table=12,priority=10 ip action=ct_clear,ct(table=13) | |
5780 | table=12,priority=1 action=drop | |
5781 | table=13 ip,ct_state=+trk+est action=goto_table:20 | |
5782 | table=13 ip,ct_state=+trk+new action=ct(commit,table=20) | |
5783 | table=13 ip,ct_state=+trk+inv action=drop | |
5784 | dnl | |
5785 | dnl Output | |
5786 | table=20 ip,nw_src=10.1.1.1 action=set_field:f0:00:00:01:01:01->eth_src,goto_table:21 | |
5787 | table=20 ip,nw_src=10.1.1.2 action=set_field:f0:00:00:01:01:02->eth_src,goto_table:21 | |
5788 | table=20 ip,nw_src=10.254.254.0/24 action=set_field:f0:00:00:01:01:FE->eth_src,goto_table:21 | |
5789 | table=21 ip,nw_dst=10.1.1.1 action=set_field:f0:00:00:01:01:01->eth_dst,output:ovs-p0 | |
5790 | table=21 ip,nw_dst=10.1.1.2 action=set_field:f0:00:00:01:01:02->eth_dst,output:ovs-p1 | |
5791 | ]) | |
5792 | ||
5793 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5794 | ||
5795 | dnl non-FIP case | |
5796 | NS_CHECK_EXEC([at_ns1], [echo "foobar" |nc $NC_EOF_OPT 10.1.1.1 1234]) | |
5797 | OVS_WAIT_UNTIL([[ovs-appctl dpctl/dump-conntrack | sed -e 's/port=[0-9]*/port=<cleared>/g' -e 's/id=[0-9]*/id=<cleared>/g' | | |
5798 | grep "tcp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=TIME_WAIT)" | |
5799 | ]]) | |
5800 | ||
5801 | dnl Check that the full session ends as expected (i.e. TIME_WAIT). Otherwise it | |
5802 | dnl means the datapath didn't process the ct_clear action. Ending in SYN_RECV | |
5803 | dnl (OVS maps to ESTABLISHED) means the initial frame was committed, but not a | |
5804 | dnl second time after the FIP translation (because ct_clear didn't occur). | |
5805 | NS_CHECK_EXEC([at_ns1], [echo "foobar" |nc $NC_EOF_OPT 10.254.254.1 1234]) | |
5806 | OVS_WAIT_UNTIL([[ovs-appctl dpctl/dump-conntrack | sed -e 's/port=[0-9]*/port=<cleared>/g' -e 's/id=[0-9]*/id=<cleared>/g' | | |
5807 | grep "tcp,orig=(src=10.254.254.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.254.254.2,sport=<cleared>,dport=<cleared>),protoinfo=(state=TIME_WAIT)" | |
5808 | ]]) | |
5809 | ||
5810 | OVS_TRAFFIC_VSWITCHD_STOP | |
5811 | AT_CLEANUP | |
5812 | ||
594570ea DB |
5813 | AT_SETUP([conntrack - negative test for recirculation optimization]) |
5814 | dnl This test will fail if 'conn' caching is being used, because the tuple | |
5815 | dnl has been changed outside of conntrack. | |
5816 | AT_SKIP_IF([test $HAVE_NC = no]) | |
5817 | CHECK_CONNTRACK() | |
5818 | OVS_TRAFFIC_VSWITCHD_START() | |
5819 | OVS_CHECK_CT_CLEAR() | |
5820 | ||
5821 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5822 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24", "f0:00:00:01:01:01") dnl FIP 10.254.254.1 | |
5823 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24", "f0:00:00:01:01:02") dnl FIP 10.254.254.2 | |
5824 | ||
5825 | dnl Static ARPs | |
5826 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.2 lladdr f0:00:00:01:01:02 dev p0]) | |
5827 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.1 lladdr f0:00:00:01:01:01 dev p1]) | |
5828 | ||
5829 | dnl Static ARP and route entries for the FIP "gateway" | |
5830 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p0]) | |
5831 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p1]) | |
5832 | NS_CHECK_EXEC([at_ns0], [ip route add default nexthop via 10.1.1.254]) | |
5833 | NS_CHECK_EXEC([at_ns1], [ip route add default nexthop via 10.1.1.254]) | |
5834 | ||
5835 | NETNS_DAEMONIZE([at_ns0], [nc -l -k 1234 > /dev/null], [nc0.pid]) | |
5836 | ||
5837 | AT_DATA([flows.txt], [dnl | |
5838 | table=0,priority=10 ip action=ct(table=1) | |
5839 | dnl dst FIP | |
5840 | table=1,priority=20 ip,ct_state=+trk+est,nw_dst=10.254.254.0/24 action=goto_table:2 | |
5841 | table=1,priority=20 ip,ct_state=+trk+new,nw_dst=10.254.254.0/24 action=ct(commit,exec(set_field:1->ct_mark),table=2) | |
5842 | dnl | |
5843 | dnl FIP translation (dst FIP, src local) --> (dst local, src FIP) | |
5844 | table=2 ip,nw_dst=10.254.254.1 action=set_field:10.1.1.1->nw_dst,goto_table:3 | |
5845 | table=2 ip,nw_dst=10.254.254.2 action=set_field:10.1.1.2->nw_dst,goto_table:3 | |
5846 | table=3 ip,nw_src=10.1.1.1 action=set_field:10.254.254.1->nw_src,goto_table:4 | |
5847 | table=3 ip,nw_src=10.1.1.2 action=set_field:10.254.254.2->nw_src,goto_table:4 | |
5848 | table=4 ip,nw_dst=10.1.1.1 action=set_field:f0:00:00:01:01:01->eth_dst,goto_table:5 | |
5849 | table=4 ip,nw_dst=10.1.1.2 action=set_field:f0:00:00:01:01:02->eth_dst,goto_table:5 | |
5850 | table=5 ip,nw_src=10.254.254.0/24 action=set_field:f0:00:00:01:01:FE->eth_src,goto_table:6 | |
5851 | dnl | |
5852 | dnl Tuple has been changed outside of conntrack | |
5853 | table=6,priority=10 ip action=ct(table=7) | |
5854 | dnl | |
5855 | table=7 ip,ct_state=+trk+est action=goto_table:8 | |
5856 | table=7 ip,ct_mark=0x0,ct_state=+trk+new action=ct(commit,exec(set_field:2->ct_mark),table=8) | |
5857 | dnl | |
5858 | table=8 ip,nw_dst=10.1.1.1 action=output:ovs-p0 | |
5859 | table=8 ip,nw_dst=10.1.1.2 action=output:ovs-p1 | |
5860 | ]) | |
5861 | ||
5862 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5863 | ||
5864 | NS_CHECK_EXEC([at_ns1], [echo "foobar" |nc $NC_EOF_OPT 10.254.254.1 1234]) | |
5865 | ||
5866 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.254.254)], [0], [dnl | |
5867 | tcp,orig=(src=10.1.1.2,dst=10.254.254.1,sport=<cleared>,dport=<cleared>),reply=(src=10.254.254.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),mark=1,protoinfo=(state=<cleared>) | |
5868 | tcp,orig=(src=10.254.254.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.1,dst=10.254.254.2,sport=<cleared>,dport=<cleared>),mark=2,protoinfo=(state=<cleared>) | |
5869 | ]) | |
5870 | ||
5871 | ovs-appctl dpif/dump-flows br0 | |
5872 | ||
5873 | OVS_TRAFFIC_VSWITCHD_STOP | |
5874 | AT_CLEANUP | |
5875 | ||
b4fa814c EG |
5876 | AT_BANNER([802.1ad]) |
5877 | ||
5878 | AT_SETUP([802.1ad - vlan_limit]) | |
5879 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5880 | OVS_CHECK_8021AD() | |
5881 | ||
5882 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5883 | ||
5884 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5885 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
5886 | ||
5887 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
5888 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
5889 | ||
5890 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
5891 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
5892 | ||
5893 | AT_CHECK([ovs-ofctl add-flow br0 "priority=1 action=normal"]) | |
5894 | ||
5895 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5896 | ||
5897 | dnl CVLAN traffic should match the flow and drop | |
5898 | AT_CHECK([ovs-appctl revalidator/purge]) | |
5899 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:vlan-limit=1]) | |
5900 | AT_CHECK([ovs-ofctl add-flow br0 "priority=100 dl_type=0x8100 action=drop"]) | |
5901 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 -w 3 10.2.2.2], [1], [ignore]) | |
5902 | ||
5903 | OVS_TRAFFIC_VSWITCHD_STOP | |
5904 | AT_CLEANUP | |
0147a20e EG |
5905 | |
5906 | ||
5907 | AT_SETUP([802.1ad - push/pop outer 802.1ad]) | |
5908 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5909 | OVS_CHECK_8021AD() | |
5910 | ||
5911 | ADD_BR([br1]) | |
5912 | ADD_BR([br2]) | |
5913 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5914 | ||
5915 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
5916 | AT_CHECK([ip link set dev ovs-p0 up]) | |
5917 | AT_CHECK([ip link set dev ovs-p1 up]) | |
5918 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
5919 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
5920 | on_exit 'ip link del ovs-p0' | |
5921 | ||
5922 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
5923 | AT_CHECK([ip link set dev ovs-p2 up]) | |
5924 | AT_CHECK([ip link set dev ovs-p3 up]) | |
5925 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
5926 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
5927 | on_exit 'ip link del ovs-p2' | |
5928 | ||
5929 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
5930 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
5931 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
5932 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
5933 | ||
5934 | AT_DATA([flows-br0.txt], [dnl | |
5935 | priority=1 action=drop | |
5936 | priority=100 in_port=1 action=push_vlan:0x88a8,mod_vlan_vid=4094,output:2 | |
5937 | priority=100 in_port=2 action=push_vlan:0x88a8,mod_vlan_vid=4094,output:1 | |
5938 | ]) | |
5939 | ||
5940 | AT_DATA([flows-customer-br.txt], [dnl | |
5941 | priority=1 action=normal | |
5942 | priority=100 in_port=1 vlan_tci=0x1000/0x1000 action=pop_vlan,normal | |
5943 | ]) | |
5944 | ||
5945 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
5946 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-customer-br.txt]) | |
5947 | AT_CHECK([ovs-ofctl --bundle add-flows br2 flows-customer-br.txt]) | |
5948 | ||
5949 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5950 | ||
5951 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5952 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5953 | ]) | |
5954 | ||
5955 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5956 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5957 | ]) | |
5958 | ||
5959 | OVS_TRAFFIC_VSWITCHD_STOP | |
5960 | AT_CLEANUP | |
5961 | ||
5962 | ||
5963 | AT_SETUP([802.1ad - push/pop outer 802.1q]) | |
5964 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5965 | OVS_CHECK_8021AD() | |
5966 | ||
5967 | ADD_BR([br1]) | |
5968 | ADD_BR([br2]) | |
5969 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5970 | ||
5971 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
5972 | AT_CHECK([ip link set dev ovs-p0 up]) | |
5973 | AT_CHECK([ip link set dev ovs-p1 up]) | |
5974 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
5975 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
5976 | on_exit 'ip link del ovs-p0' | |
5977 | ||
5978 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
5979 | AT_CHECK([ip link set dev ovs-p2 up]) | |
5980 | AT_CHECK([ip link set dev ovs-p3 up]) | |
5981 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
5982 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
5983 | on_exit 'ip link del ovs-p2' | |
5984 | ||
5985 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
5986 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
5987 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
5988 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
5989 | ||
5990 | AT_DATA([flows-br0.txt], [dnl | |
5991 | priority=1 action=drop | |
5992 | priority=100 in_port=1 action=push_vlan:0x8100,mod_vlan_vid=4094,output:2 | |
5993 | priority=100 in_port=2 action=push_vlan:0x8100,mod_vlan_vid=4094,output:1 | |
5994 | ]) | |
5995 | ||
5996 | AT_DATA([flows-customer-br.txt], [dnl | |
5997 | priority=1 action=normal | |
5998 | priority=100 in_port=1 vlan_tci=0x1000/0x1000 action=pop_vlan,normal | |
5999 | ]) | |
6000 | ||
6001 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
6002 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-customer-br.txt]) | |
6003 | AT_CHECK([ovs-ofctl --bundle add-flows br2 flows-customer-br.txt]) | |
6004 | ||
6005 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
6006 | ||
6007 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6008 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6009 | ]) | |
6010 | ||
6011 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6012 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6013 | ]) | |
6014 | ||
6015 | OVS_TRAFFIC_VSWITCHD_STOP | |
6016 | AT_CLEANUP | |
d4a814a8 EG |
6017 | |
6018 | ||
6019 | AT_SETUP([802.1ad - 802.1q tunnel]) | |
6020 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
6021 | OVS_CHECK_8021AD() | |
6022 | ||
6023 | ADD_BR([br1]) | |
6024 | ADD_BR([br2]) | |
6025 | ADD_NAMESPACES(at_ns0, at_ns1) | |
6026 | ||
6027 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
6028 | AT_CHECK([ip link set dev ovs-p0 up]) | |
6029 | AT_CHECK([ip link set dev ovs-p1 up]) | |
6030 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
6031 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
6032 | on_exit 'ip link del ovs-p0' | |
6033 | ||
6034 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
6035 | AT_CHECK([ip link set dev ovs-p2 up]) | |
6036 | AT_CHECK([ip link set dev ovs-p3 up]) | |
6037 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
6038 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
6039 | on_exit 'ip link del ovs-p2' | |
6040 | ||
6041 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
6042 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
6043 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
6044 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
6045 | ADD_CVLAN(p4, at_ns0, 200, "10.3.2.1/24") | |
6046 | ADD_CVLAN(p5, at_ns1, 200, "10.3.2.2/24") | |
6047 | ADD_CVLAN(p4, at_ns0, 300, "10.4.2.1/24") | |
6048 | ADD_CVLAN(p5, at_ns1, 300, "10.4.2.2/24") | |
6049 | ||
6050 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
6051 | AT_CHECK([ovs-ofctl add-flow br1 action=normal]) | |
6052 | AT_CHECK([ovs-ofctl add-flow br2 action=normal]) | |
6053 | AT_CHECK([ovs-vsctl set port ovs-p0 vlan_mode=dot1q-tunnel tag=4094 cvlans=100,200]) | |
6054 | AT_CHECK([ovs-vsctl set port ovs-p2 vlan_mode=dot1q-tunnel tag=4094 cvlans=100,200]) | |
6055 | ||
6056 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
6057 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.3.2.2]) | |
6058 | ||
6059 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6060 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6061 | ]) | |
6062 | ||
6063 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.3.2.2 | FORMAT_PING], [0], [dnl | |
6064 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6065 | ]) | |
6066 | ||
6067 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6068 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6069 | ]) | |
6070 | ||
6071 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.3.2.2 | FORMAT_PING], [0], [dnl | |
6072 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6073 | ]) | |
6074 | ||
6075 | dnl CVLAN 300 is not permitted by dot1q-tunnel | |
6076 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 -w 3 10.4.2.2], [1], [ignore]) | |
6077 | ||
6078 | OVS_TRAFFIC_VSWITCHD_STOP(["/dropping VLAN \(0\|300\) packet received on dot1q-tunnel port/d"]) | |
6079 | AT_CLEANUP | |
79d6e24f EG |
6080 | |
6081 | AT_SETUP([802.1ad - double vlan match]) | |
6082 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
6083 | OVS_CHECK_8021AD() | |
6084 | ||
6085 | ADD_NAMESPACES(at_ns0, at_ns1) | |
6086 | ||
6087 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
6088 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
6089 | ||
6090 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
6091 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
6092 | ||
6093 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
6094 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
6095 | ||
6096 | AT_DATA([flows-br0.txt], [dnl | |
6097 | table=0,priority=1 action=drop | |
6098 | table=0,priority=100 dl_vlan=4094 action=pop_vlan,goto_table:1 | |
6099 | table=1,priority=100 dl_vlan=100 action=push_vlan:0x88a8,mod_vlan_vid:4094,normal | |
6100 | ]) | |
6101 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
6102 | ||
6103 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
6104 | ||
6105 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6106 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6107 | ]) | |
6108 | ||
6109 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
6110 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
6111 | ]) | |
6112 | ||
296251ca AV |
6113 | OVS_TRAFFIC_VSWITCHD_STOP |
6114 | AT_CLEANUP | |
6115 | ||
6116 | ||
6117 | AT_BANNER([nsh-datapath]) | |
6118 | ||
6119 | AT_SETUP([nsh - encap header]) | |
6120 | OVS_TRAFFIC_VSWITCHD_START() | |
6121 | ||
6122 | ADD_NAMESPACES(at_ns0, at_ns1) | |
6123 | ||
6124 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
6125 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
6126 | ||
6127 | dnl The flow will encap a nsh header to the TCP syn packet | |
6128 | dnl eth/ip/tcp --> OVS --> eth/nsh/eth/ip/tcp | |
6129 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,ip,actions=encap(nsh(md_type=1)),set_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1,encap(ethernet),set_field:f2:ff:00:00:00:02->dl_dst,set_field:f2:ff:00:00:00:01->dl_src,ovs-p1"]) | |
6130 | ||
0c5a65f2 | 6131 | NS_CHECK_EXEC([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap &]) |
296251ca AV |
6132 | sleep 1 |
6133 | ||
6134 | dnl The hex dump is a TCP syn packet. pkt=eth/ip/tcp | |
6135 | dnl The packet is sent from p0(at_ns0) interface directed to | |
6136 | dnl p1(at_ns1) interface | |
1ca0323e | 6137 | NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null]) |
296251ca | 6138 | |
296251ca | 6139 | dnl Check the expected nsh encapsulated packet on the egress interface |
0c5a65f2 WT |
6140 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0fc6" 2>&1 1>/dev/null]) |
6141 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0010: *0103 *0012 *34ff *1122 *3344 *0000 *0000 *0000" 2>&1 1>/dev/null]) | |
6142 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0020: *0000 *0000 *0000 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
6143 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
6144 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
6145 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
296251ca AV |
6146 | |
6147 | OVS_TRAFFIC_VSWITCHD_STOP | |
6148 | AT_CLEANUP | |
6149 | ||
0c5a65f2 | 6150 | |
296251ca AV |
6151 | AT_SETUP([nsh - decap header]) |
6152 | OVS_TRAFFIC_VSWITCHD_START() | |
6153 | ||
6154 | ADD_NAMESPACES(at_ns0, at_ns1) | |
6155 | ||
6156 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
6157 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
6158 | ||
6159 | dnl The flow will decap a nsh header which in turn carries a TCP syn packet | |
6160 | dnl eth/nsh/eth/ip/tcp --> OVS --> eth/ip/tcp | |
6161 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,dl_type=0x894f, actions=decap(),decap(), ovs-p1"]) | |
6162 | ||
0c5a65f2 | 6163 | NS_CHECK_EXEC([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap &]) |
296251ca AV |
6164 | sleep 1 |
6165 | ||
6166 | dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp | |
6167 | dnl The packet is sent from p0(at_ns0) interface directed to | |
6168 | dnl p1(at_ns1) interface | |
1ca0323e | 6169 | NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 00 64 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null]) |
296251ca | 6170 | |
296251ca | 6171 | dnl Check the expected de-capsulated TCP packet on the egress interface |
0c5a65f2 WT |
6172 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f200 *0000 *0002 *f200 *0000 *0001 *0800 *4500" 2>&1 1>/dev/null]) |
6173 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0010: *0028 *0001 *0000 *4006 *b013 *c0a8 *000a *0a00" 2>&1 1>/dev/null]) | |
6174 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0020: *000a *0400 *0800 *0000 *00c8 *0000 *0000 *5002" 2>&1 1>/dev/null]) | |
6175 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0030: *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
296251ca AV |
6176 | |
6177 | OVS_TRAFFIC_VSWITCHD_STOP | |
6178 | AT_CLEANUP | |
6179 | ||
0c5a65f2 | 6180 | |
296251ca AV |
6181 | AT_SETUP([nsh - replace header]) |
6182 | OVS_TRAFFIC_VSWITCHD_START() | |
6183 | ||
6184 | ADD_NAMESPACES(at_ns0, at_ns1) | |
6185 | ||
6186 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
6187 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
6188 | ||
6189 | dnl The flow will decap a nsh header and encap a new nsh header | |
6190 | dnl eth/nsh-X/eth/ip/tcp --> OVS --> eth/nsh-Y/eth/ip/tcp | |
6191 | dnl The flow will add another NSH header with nsh_spi=0x101, nsh_si=4, | |
6192 | dnl nsh_ttl=7 and change the md1 context | |
6193 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x03,actions=decap(),decap(),encap(nsh(md_type=1)),set_field:0x07->nsh_ttl,set_field:0x0101->nsh_spi,set_field:0x04->nsh_si,set_field:0x100f0e0d->nsh_c1,set_field:0x0c0b0a09->nsh_c2,set_field:0x08070605->nsh_c3,set_field:0x04030201->nsh_c4,encap(ethernet),set_field:f2:ff:00:00:00:02->dl_dst,set_field:f2:ff:00:00:00:01->dl_src,ovs-p1"]) | |
6194 | ||
0c5a65f2 | 6195 | NS_CHECK_EXEC([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap &]) |
296251ca AV |
6196 | sleep 1 |
6197 | ||
6198 | dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp | |
6199 | dnl The nsh_ttl is 8, nsh_spi is 0x100 and nsh_si is 3 | |
6200 | dnl The packet is sent from p0(at_ns0) interface directed to | |
6201 | dnl p1(at_ns1) interface | |
1ca0323e | 6202 | NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null]) |
296251ca | 6203 | |
296251ca | 6204 | dnl Check the expected NSH packet with new fields in the header |
0c5a65f2 WT |
6205 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000* 0001 *894f *01c6" 2>&1 1>/dev/null]) |
6206 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0010: *0103 *0001 *0104 *100f *0e0d *0c0b *0a09 *0807" 2>&1 1>/dev/null]) | |
6207 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0020: *0605 *0403 *0201 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
6208 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
6209 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
6210 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
296251ca AV |
6211 | |
6212 | OVS_TRAFFIC_VSWITCHD_STOP | |
6213 | AT_CLEANUP | |
6214 | ||
6215 | ||
6216 | AT_SETUP([nsh - forward]) | |
6217 | OVS_TRAFFIC_VSWITCHD_START() | |
6218 | ||
6219 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2) | |
6220 | ||
6221 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
6222 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
6223 | ADD_VETH(p2, at_ns2, br0, "0.0.0.0") | |
6224 | ||
6225 | dnl Push two flows to OVS. #1 will check on SPI=0X100, SI=2 and send the | |
6226 | dnl packet to at_ns1. #2 will check on SPI=0X100, SI=1 and send the | |
6227 | dnl packet to to at_ns2. | |
6228 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x02,actions=ovs-p1"]) | |
6229 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x01,actions=ovs-p2"]) | |
6230 | ||
0c5a65f2 WT |
6231 | NS_CHECK_EXEC([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap &]) |
6232 | NS_CHECK_EXEC([at_ns2], [tcpdump -l -n -xx -U -i p2 > p2.pcap &]) | |
296251ca AV |
6233 | sleep 1 |
6234 | ||
6235 | dnl First send packet from at_ns0 --> OVS with SPI=0x100 and SI=2 | |
1ca0323e | 6236 | NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 02 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null]) |
296251ca | 6237 | |
0c5a65f2 WT |
6238 | dnl Check for the above packet on p1 interface |
6239 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0206" 2>&1 1>/dev/null]) | |
6240 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0010: *0103 *0001 *0002 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null]) | |
6241 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
6242 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
6243 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
6244 | OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
296251ca AV |
6245 | |
6246 | dnl Send the second packet from at_ns1 --> OVS with SPI=0x100 and SI=1 | |
1ca0323e | 6247 | NS_CHECK_EXEC([at_ns1], [$PYTHON3 $srcdir/sendpkt.py p1 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 01 c6 01 03 00 01 00 01 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null]) |
296251ca | 6248 | |
0c5a65f2 WT |
6249 | dnl Check for the above packet on p2 interface |
6250 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *01c6" 2>&1 1>/dev/null]) | |
6251 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0010: *0103 *0001 *0001 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null]) | |
6252 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
6253 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
6254 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
6255 | OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
296251ca | 6256 | |
79d6e24f EG |
6257 | OVS_TRAFFIC_VSWITCHD_STOP |
6258 | AT_CLEANUP |