]>
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() | |
74 | ||
75 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
76 | ||
77 | ADD_NAMESPACES(at_ns0, at_ns1) | |
78 | ||
79 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
80 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
81 | ||
82 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
83 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
84 | ||
85 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
86 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
87 | ||
88 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
89 | ||
90 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
91 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
92 | ]) | |
93 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
94 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
95 | ]) | |
96 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
97 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
98 | ]) | |
99 | ||
100 | OVS_TRAFFIC_VSWITCHD_STOP | |
101 | AT_CLEANUP | |
102 | ||
d7c5426b | 103 | AT_SETUP([datapath - ping6 between two ports]) |
cf7659b6 JR |
104 | OVS_TRAFFIC_VSWITCHD_START() |
105 | ||
106 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
cfe17b43 JS |
107 | |
108 | ADD_NAMESPACES(at_ns0, at_ns1) | |
109 | ||
110 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
111 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
112 | ||
c10840ff JS |
113 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
114 | dnl waiting, we get occasional failures due to the following error: | |
cfe17b43 | 115 | dnl "connect: Cannot assign requested address" |
c10840ff | 116 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
cfe17b43 | 117 | |
de22d08f | 118 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 119 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
120 | ]) |
121 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 122 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
123 | ]) |
124 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 JS |
125 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
126 | ]) | |
127 | ||
d7c5426b | 128 | OVS_TRAFFIC_VSWITCHD_STOP |
cfe17b43 JS |
129 | AT_CLEANUP |
130 | ||
d7c5426b | 131 | AT_SETUP([datapath - ping6 between two ports on vlan]) |
cf7659b6 JR |
132 | OVS_TRAFFIC_VSWITCHD_START() |
133 | ||
134 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
cfe17b43 JS |
135 | |
136 | ADD_NAMESPACES(at_ns0, at_ns1) | |
137 | ||
138 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
139 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
140 | ||
141 | ADD_VLAN(p0, at_ns0, 100, "fc00:1::1/96") | |
142 | ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96") | |
143 | ||
c10840ff JS |
144 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
145 | dnl waiting, we get occasional failures due to the following error: | |
cfe17b43 | 146 | dnl "connect: Cannot assign requested address" |
68ffb694 | 147 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2]) |
cfe17b43 | 148 | |
de22d08f | 149 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl |
cfe17b43 | 150 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
151 | ]) |
152 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
cfe17b43 | 153 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
de22d08f JS |
154 | ]) |
155 | 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 |
156 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
157 | ]) | |
158 | ||
d7c5426b | 159 | OVS_TRAFFIC_VSWITCHD_STOP |
69c2bdfe | 160 | AT_CLEANUP |
810e1785 | 161 | |
c5abeef4 EG |
162 | AT_SETUP([datapath - ping6 between two ports on cvlan]) |
163 | OVS_TRAFFIC_VSWITCHD_START() | |
164 | ||
165 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
166 | ||
167 | ADD_NAMESPACES(at_ns0, at_ns1) | |
168 | ||
169 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
170 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
171 | ||
172 | ADD_SVLAN(p0, at_ns0, 4094, "fc00:ffff::1/96") | |
173 | ADD_SVLAN(p1, at_ns1, 4094, "fc00:ffff::2/96") | |
174 | ||
175 | ADD_CVLAN(p0.4094, at_ns0, 100, "fc00:1::1/96") | |
176 | ADD_CVLAN(p1.4094, at_ns1, 100, "fc00:1::2/96") | |
177 | ||
178 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2]) | |
179 | ||
180 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
181 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
182 | ]) | |
183 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
184 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
185 | ]) | |
186 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl | |
187 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
188 | ]) | |
189 | ||
190 | OVS_TRAFFIC_VSWITCHD_STOP | |
191 | AT_CLEANUP | |
192 | ||
ddb5f937 LR |
193 | AT_SETUP([datapath - ping over bond]) |
194 | OVS_TRAFFIC_VSWITCHD_START() | |
195 | ||
196 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
197 | ||
198 | ADD_NAMESPACES(at_ns0, at_ns1) | |
199 | ||
200 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
201 | ADD_VETH_BOND(p1 p2, at_ns1, br0, bond0, lacp=active bond_mode=balance-tcp, "10.1.1.2/24") | |
202 | ||
203 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2]) | |
204 | ||
205 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
206 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
207 | ]) | |
208 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
209 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
210 | ]) | |
211 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
212 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
213 | ]) | |
214 | ||
215 | OVS_TRAFFIC_VSWITCHD_STOP | |
216 | AT_CLEANUP | |
217 | ||
810e1785 | 218 | AT_SETUP([datapath - ping over vxlan tunnel]) |
dfb21e96 | 219 | OVS_CHECK_VXLAN() |
810e1785 | 220 | |
cf7659b6 JR |
221 | OVS_TRAFFIC_VSWITCHD_START() |
222 | ADD_BR([br-underlay]) | |
223 | ||
224 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
225 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
226 | ||
810e1785 JS |
227 | ADD_NAMESPACES(at_ns0) |
228 | ||
229 | dnl Set up underlay link from host into the namespace using veth pair. | |
230 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
231 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
232 | AT_CHECK([ip link set dev br-underlay up]) | |
233 | ||
234 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
235 | dnl linux device inside the namespace. | |
236 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], [10.1.1.100/24]) | |
237 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
238 | [id 0 dstport 4789]) | |
239 | ||
240 | dnl First, check the underlay | |
241 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
242 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
243 | ]) | |
244 | ||
245 | dnl Okay, now check the overlay with different packet sizes | |
246 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
247 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
248 | ]) | |
249 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
250 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
251 | ]) | |
252 | 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 |
253 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
254 | ]) | |
255 | ||
256 | OVS_TRAFFIC_VSWITCHD_STOP | |
257 | AT_CLEANUP | |
258 | ||
259 | AT_SETUP([datapath - ping over vxlan6 tunnel]) | |
67e3ddf1 | 260 | OVS_CHECK_VXLAN_UDP6ZEROCSUM() |
d5f2dd0b EG |
261 | |
262 | OVS_TRAFFIC_VSWITCHD_START() | |
263 | ADD_BR([br-underlay]) | |
264 | ||
265 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
266 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
267 | ||
268 | ADD_NAMESPACES(at_ns0) | |
269 | ||
270 | dnl Set up underlay link from host into the namespace using veth pair. | |
271 | ADD_VETH(p0, at_ns0, br-underlay, "fc00::1/64", [], [], "nodad") | |
272 | AT_CHECK([ip addr add dev br-underlay "fc00::100/64" nodad]) | |
273 | AT_CHECK([ip link set dev br-underlay up]) | |
274 | ||
275 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
276 | dnl linux device inside the namespace. | |
277 | ADD_OVS_TUNNEL6([vxlan], [br0], [at_vxlan0], [fc00::1], [10.1.1.100/24]) | |
278 | ADD_NATIVE_TUNNEL6([vxlan], [at_vxlan1], [at_ns0], [fc00::100], [10.1.1.1/24], | |
279 | [id 0 dstport 4789 udp6zerocsumtx udp6zerocsumrx]) | |
280 | ||
281 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100]) | |
282 | ||
283 | dnl First, check the underlay | |
284 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::100 | FORMAT_PING], [0], [dnl | |
285 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
286 | ]) | |
287 | ||
288 | dnl Okay, now check the overlay with different packet sizes | |
289 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
290 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
291 | ]) | |
292 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
293 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
294 | ]) | |
295 | 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 |
296 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
297 | ]) | |
298 | ||
299 | OVS_TRAFFIC_VSWITCHD_STOP | |
300 | AT_CLEANUP | |
301 | ||
302 | AT_SETUP([datapath - ping over gre tunnel]) | |
cae92b42 | 303 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
523256cc JS |
304 | OVS_CHECK_GRE() |
305 | ||
306 | OVS_TRAFFIC_VSWITCHD_START() | |
307 | ADD_BR([br-underlay]) | |
308 | ||
309 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
310 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
311 | ||
312 | ADD_NAMESPACES(at_ns0) | |
313 | ||
314 | dnl Set up underlay link from host into the namespace using veth pair. | |
315 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
316 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
317 | AT_CHECK([ip link set dev br-underlay up]) | |
318 | ||
319 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
320 | dnl linux device inside the namespace. | |
321 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
322 | ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24]) | |
323 | ||
324 | dnl First, check the underlay | |
325 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
326 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
327 | ]) | |
328 | ||
329 | dnl Okay, now check the overlay with different packet sizes | |
330 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
331 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
332 | ]) | |
333 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
334 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
335 | ]) | |
336 | 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 |
337 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
338 | ]) | |
339 | ||
340 | OVS_TRAFFIC_VSWITCHD_STOP | |
341 | AT_CLEANUP | |
342 | ||
98514eea | 343 | AT_SETUP([datapath - ping over erspan v1 tunnel]) |
cae92b42 | 344 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
345 | OVS_CHECK_GRE() |
346 | OVS_CHECK_ERSPAN() | |
347 | ||
348 | OVS_TRAFFIC_VSWITCHD_START() | |
349 | ADD_BR([br-underlay]) | |
350 | ||
351 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
352 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
353 | ||
354 | ADD_NAMESPACES(at_ns0) | |
355 | ||
356 | dnl Set up underlay link from host into the namespace using veth pair. | |
357 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
358 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
359 | AT_CHECK([ip link set dev br-underlay up]) | |
360 | ||
361 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
362 | dnl linux device inside the namespace. | |
363 | 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]) | |
364 | 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]) | |
365 | ||
366 | dnl First, check the underlay | |
367 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
368 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
369 | ]) | |
370 | ||
371 | dnl Okay, now check the overlay with different packet sizes | |
372 | dnl NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
373 | NS_CHECK_EXEC([at_ns0], [ping -s 1200 -i 0.3 -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl | |
374 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
375 | ]) | |
376 | OVS_TRAFFIC_VSWITCHD_STOP | |
377 | AT_CLEANUP | |
378 | ||
379 | AT_SETUP([datapath - ping over erspan v2 tunnel]) | |
cae92b42 | 380 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
381 | OVS_CHECK_GRE() |
382 | OVS_CHECK_ERSPAN() | |
383 | ||
384 | OVS_TRAFFIC_VSWITCHD_START() | |
385 | ADD_BR([br-underlay]) | |
386 | ||
387 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
388 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
389 | ||
390 | ADD_NAMESPACES(at_ns0) | |
391 | ||
392 | dnl Set up underlay link from host into the namespace using veth pair. | |
393 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
394 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
395 | AT_CHECK([ip link set dev br-underlay up]) | |
396 | ||
397 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
398 | dnl linux device inside the namespace. | |
399 | 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]) | |
400 | 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]) | |
401 | ||
402 | dnl First, check the underlay | |
403 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
404 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
405 | ]) | |
406 | ||
407 | dnl Okay, now check the overlay with different packet sizes | |
408 | dnl NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
409 | NS_CHECK_EXEC([at_ns0], [ping -s 1200 -i 0.3 -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl | |
410 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
411 | ]) | |
412 | OVS_TRAFFIC_VSWITCHD_STOP | |
413 | AT_CLEANUP | |
414 | ||
415 | AT_SETUP([datapath - ping over ip6erspan v1 tunnel]) | |
cae92b42 | 416 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
417 | OVS_CHECK_GRE() |
418 | OVS_CHECK_ERSPAN() | |
419 | ||
420 | OVS_TRAFFIC_VSWITCHD_START() | |
421 | ADD_BR([br-underlay]) | |
422 | ||
423 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
424 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
425 | ||
426 | ADD_NAMESPACES(at_ns0) | |
427 | ||
428 | dnl Set up underlay link from host into the namespace using veth pair. | |
429 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", [], [], nodad) | |
430 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
431 | AT_CHECK([ip link set dev br-underlay up]) | |
432 | ||
433 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
434 | dnl linux device inside the namespace. | |
435 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
436 | [options:key=123 options:erspan_ver=1 options:erspan_idx=0x7]) | |
437 | ADD_NATIVE_TUNNEL6([ip6erspan], [ns_erspan0], [at_ns0], [fc00:100::100], | |
438 | [10.1.1.1/24], [local fc00:100::1 seq key 123 erspan_ver 1 erspan 7]) | |
439 | ||
440 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
441 | ||
442 | dnl First, check the underlay | |
443 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
444 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
445 | ]) | |
446 | ||
447 | dnl Okay, now check the overlay with different packet sizes | |
448 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
449 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
450 | ]) | |
451 | OVS_TRAFFIC_VSWITCHD_STOP | |
452 | AT_CLEANUP | |
453 | ||
454 | AT_SETUP([datapath - ping over ip6erspan v2 tunnel]) | |
cae92b42 | 455 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
98514eea WT |
456 | OVS_CHECK_GRE() |
457 | OVS_CHECK_ERSPAN() | |
458 | ||
459 | OVS_TRAFFIC_VSWITCHD_START() | |
460 | ADD_BR([br-underlay]) | |
461 | ||
462 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
463 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
464 | ||
465 | ADD_NAMESPACES(at_ns0) | |
466 | ||
467 | dnl Set up underlay link from host into the namespace using veth pair. | |
468 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", [], [], nodad) | |
469 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
470 | AT_CHECK([ip link set dev br-underlay up]) | |
471 | ||
472 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
473 | dnl linux device inside the namespace. | |
474 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
475 | [options:key=121 options:erspan_ver=2 options:erspan_dir=0 options:erspan_hwid=0x7]) | |
476 | ADD_NATIVE_TUNNEL6([ip6erspan], [ns_erspan0], [at_ns0], [fc00:100::100], | |
477 | [10.1.1.1/24], | |
478 | [local fc00:100::1 seq key 121 erspan_ver 2 erspan_dir ingress erspan_hwid 0x7]) | |
479 | ||
480 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
481 | ||
482 | dnl First, check the underlay | |
483 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
484 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
485 | ]) | |
486 | ||
487 | dnl Okay, now check the overlay with different packet sizes | |
488 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
489 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
490 | ]) | |
491 | OVS_TRAFFIC_VSWITCHD_STOP | |
492 | AT_CLEANUP | |
493 | ||
92b8af2c JS |
494 | AT_SETUP([datapath - ping over geneve tunnel]) |
495 | OVS_CHECK_GENEVE() | |
496 | ||
497 | OVS_TRAFFIC_VSWITCHD_START() | |
498 | ADD_BR([br-underlay]) | |
499 | ||
500 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
501 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
502 | ||
503 | ADD_NAMESPACES(at_ns0) | |
504 | ||
505 | dnl Set up underlay link from host into the namespace using veth pair. | |
506 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
507 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
508 | AT_CHECK([ip link set dev br-underlay up]) | |
509 | ||
510 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
511 | dnl linux device inside the namespace. | |
512 | ADD_OVS_TUNNEL([geneve], [br0], [at_gnv0], [172.31.1.1], [10.1.1.100/24]) | |
513 | ADD_NATIVE_TUNNEL([geneve], [ns_gnv0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
514 | [vni 0]) | |
515 | ||
516 | dnl First, check the underlay | |
517 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
518 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
519 | ]) | |
520 | ||
521 | dnl Okay, now check the overlay with different packet sizes | |
522 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
523 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
524 | ]) | |
525 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
526 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
527 | ]) | |
528 | 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 |
529 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
530 | ]) | |
531 | ||
532 | OVS_TRAFFIC_VSWITCHD_STOP | |
533 | AT_CLEANUP | |
534 | ||
bed941ba YHW |
535 | AT_SETUP([datapath - flow resume with geneve tun_metadata]) |
536 | OVS_CHECK_GENEVE() | |
537 | ||
538 | OVS_TRAFFIC_VSWITCHD_START() | |
539 | ADD_BR([br-underlay]) | |
540 | ||
fcfd14ce YS |
541 | AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile 2> /dev/null]) |
542 | ||
bed941ba YHW |
543 | ADD_NAMESPACES(at_ns0) |
544 | ||
545 | dnl Set up underlay link from host into the namespace using veth pair. | |
546 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
547 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
548 | AT_CHECK([ip link set dev br-underlay up]) | |
549 | ||
550 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
551 | dnl linux device inside the namespace. | |
552 | ADD_OVS_TUNNEL([geneve], [br0], [at_gnv0], [172.31.1.1], [10.1.1.100/24]) | |
553 | ADD_NATIVE_TUNNEL([geneve], [ns_gnv0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
554 | [vni 0]) | |
555 | ||
556 | dnl Set up flows | |
557 | AT_DATA([flows.txt], [dnl | |
558 | table=0, arp action=NORMAL | |
559 | table=0, in_port=LOCAL icmp action=output:at_gnv0 | |
560 | table=0, in_port=at_gnv0 icmp action=set_field:0xa->tun_metadata0,resubmit(,1) | |
561 | table=1, icmp action=controller(pause), resubmit(,2) | |
562 | table=2, tun_metadata0=0xa, icmp action=output:LOCAL | |
563 | ]) | |
564 | AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"]) | |
565 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
566 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
567 | ||
bed941ba YHW |
568 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 10.1.1.100 | FORMAT_PING], [0], [dnl |
569 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
570 | ]) | |
571 | ||
fcfd14ce | 572 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
bed941ba YHW |
573 | OVS_TRAFFIC_VSWITCHD_STOP |
574 | AT_CLEANUP | |
575 | ||
b31f1b04 | 576 | AT_SETUP([datapath - ping over geneve6 tunnel]) |
67e3ddf1 | 577 | OVS_CHECK_GENEVE_UDP6ZEROCSUM() |
b31f1b04 EG |
578 | |
579 | OVS_TRAFFIC_VSWITCHD_START() | |
580 | ADD_BR([br-underlay]) | |
581 | ||
582 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
583 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
584 | ||
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, "fc00::1/64", [], [], "nodad") | |
589 | AT_CHECK([ip addr add dev br-underlay "fc00::100/64" nodad]) | |
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_TUNNEL6([geneve], [br0], [at_gnv0], [fc00::1], [10.1.1.100/24]) | |
595 | ADD_NATIVE_TUNNEL6([geneve], [ns_gnv0], [at_ns0], [fc00::100], [10.1.1.1/24], | |
596 | [vni 0 udp6zerocsumtx udp6zerocsumrx]) | |
597 | ||
598 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100]) | |
599 | ||
600 | dnl First, check the underlay | |
601 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::100 | FORMAT_PING], [0], [dnl | |
602 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
603 | ]) | |
604 | ||
605 | dnl Okay, now check the overlay with different packet sizes | |
606 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
607 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
608 | ]) | |
609 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
610 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
611 | ]) | |
612 | 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 |
613 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms |
614 | ]) | |
615 | ||
616 | OVS_TRAFFIC_VSWITCHD_STOP | |
617 | AT_CLEANUP | |
07659514 | 618 | |
eb27d96b | 619 | AT_SETUP([datapath - ping over gre tunnel by simulated packets]) |
7c84d7f4 | 620 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
eb27d96b YS |
621 | |
622 | OVS_TRAFFIC_VSWITCHD_START() | |
623 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
624 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
625 | ||
626 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
627 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
628 | ||
629 | ADD_NAMESPACES(at_ns0) | |
630 | ||
631 | dnl Set up underlay link from host into the namespace using veth pair. | |
632 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
633 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
634 | AT_CHECK([ip link set dev br-underlay up]) | |
635 | ||
636 | dnl Set up tunnel endpoints on OVS outside the namespace. | |
637 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
638 | ||
639 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
640 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
641 | dnl around it. | |
642 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
643 | on_exit 'iptables -D INPUT 1' | |
644 | ||
645 | ip netns exec at_ns0 tcpdump -n -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
646 | sleep 1 | |
647 | ||
648 | dnl First, check the underlay. | |
649 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
650 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
651 | ]) | |
652 | ||
653 | dnl We don't actually add gretap port as below, instead, we will | |
654 | dnl emulate one that sends packets. Suppose its mac address is f2:ff:00:00:00:04. | |
655 | dnl ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24]) | |
656 | ||
657 | dnl Now, check the overlay by sending out raw arp and icmp packets. | |
658 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff00000003080045000042ec2c4000402ff3bcac1f0101ac1f016400006558fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=NORMAL" | |
659 | ||
660 | 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]) | |
661 | ||
662 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500007aec8e4000402ff322ac1f0101ac1f016400006558f2ff00000001f2ff00000004080045000054548f40004001cfb30a0101010a0101640800e6e829270003e1a3435b00000000ff1a050000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=NORMAL" | |
663 | ||
664 | 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]) | |
665 | ||
666 | OVS_TRAFFIC_VSWITCHD_STOP | |
667 | AT_CLEANUP | |
668 | ||
669 | AT_SETUP([datapath - ping over erspan v1 tunnel by simulated packets]) | |
7c84d7f4 | 670 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
eb27d96b YS |
671 | |
672 | OVS_TRAFFIC_VSWITCHD_START() | |
673 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
674 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
675 | ||
676 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
677 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
678 | ||
679 | ADD_NAMESPACES(at_ns0) | |
680 | ||
681 | dnl Set up underlay link from host into the namespace using veth pair. | |
682 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
683 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
684 | AT_CHECK([ip link set dev br-underlay up]) | |
685 | ||
686 | dnl Set up tunnel endpoints on OVS outside the namespace and emulate a native | |
687 | dnl linux device inside the namespace. | |
688 | 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]) | |
689 | ||
690 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
691 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
692 | dnl around it. | |
693 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
694 | on_exit 'iptables -D INPUT 1' | |
695 | ||
696 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
697 | sleep 1 | |
698 | ||
699 | dnl First, check the underlay | |
700 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
701 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
702 | ]) | |
703 | ||
704 | dnl Okay, now send out an arp request from 10.1.1.1 for 10.1.1.100 in erspan. | |
705 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500004e151d4000402fcac0ac1f0101ac1f0164100088be000000061000000100000007fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
706 | ||
707 | dnl 0002 is arp reply, followed by mac address of 10.1.1.100. | |
708 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0030: 0806 0001 0800 0604 0002 f2ff 0000 0001" 2>&1 1>/dev/null]) | |
709 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0a01 0164 f2ff 0000 0004 0a01 0101" 2>&1 1>/dev/null]) | |
710 | ||
711 | dnl Okay, now check the overlay with raw icmp packets. | |
712 | AT_FAIL_IF([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 122" 2>&1 1>/dev/null]) | |
713 | ||
714 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500008e70cb4000402f6ed2ac1f0101ac1f0164100088be000000051000000100000007f2ff00000001f2ff0000000408004500005c4a3340004001da070a0101010a010164080084f238fb0001f36a6b5b0000000021870e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f actions=normal" | |
715 | ||
716 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 122" 2>&1 1>/dev/null]) | |
717 | ||
718 | OVS_TRAFFIC_VSWITCHD_STOP | |
719 | AT_CLEANUP | |
720 | ||
721 | AT_SETUP([datapath - ping over erspan v2 tunnel by simulated packets]) | |
7c84d7f4 | 722 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
eb27d96b YS |
723 | |
724 | OVS_TRAFFIC_VSWITCHD_START() | |
725 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
726 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
727 | ||
728 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
729 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
730 | ||
731 | ADD_NAMESPACES(at_ns0) | |
732 | ||
733 | dnl Set up underlay link from host into the namespace using veth pair. | |
734 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) | |
735 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
736 | AT_CHECK([ip link set dev br-underlay up]) | |
737 | ||
738 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
739 | dnl linux device inside the namespace. | |
740 | 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]) | |
741 | ||
742 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
743 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
744 | dnl around it. | |
745 | iptables -I INPUT 1 -i br-underlay -j ACCEPT | |
746 | on_exit 'iptables -D INPUT 1' | |
747 | ||
748 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host 172.31.1.1 -l > p0.pcap & | |
749 | sleep 1 | |
750 | ||
751 | dnl First, check the underlay. | |
752 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
753 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
754 | ]) | |
755 | ||
756 | dnl Okay, send raw arp request and icmp echo request. | |
757 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff00000003080045000052373d4000402fa89cac1f0101ac1f0164100088be00000006200000016f54b41700008078fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
758 | ||
759 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0030: 0000 0001 0806 0001 0800 0604 0002 f2ff" 2>&1 1>/dev/null]) | |
760 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0000 0001 0a01 0164 f2ff 0000 0004 0a01" 2>&1 1>/dev/null]) | |
761 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0101" 2>&1 1>/dev/null]) | |
762 | ||
763 | dnl Because tcpdump might not be able to parse erspan headers, we check icmp echo reply | |
764 | dnl by packet length. | |
765 | AT_FAIL_IF([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 126" 2>&1 1>/dev/null]) | |
766 | ||
767 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000308004500009287e14000402f57b8ac1f0101ac1f0164100088be0000000520000001144cd5a400008078f2ff00000001f2ff0000000408004500005c38d640004001eb640a0101010a01016408005e57585f0001df6c6b5b0000000045bc050000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f actions=normal" | |
768 | ||
769 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP 172.31.1.100 > 172.31.1.1: GREv0,.* length 126" 2>&1 1>/dev/null]) | |
770 | ||
771 | OVS_TRAFFIC_VSWITCHD_STOP | |
772 | AT_CLEANUP | |
773 | ||
774 | AT_SETUP([datapath - ping over ip6erspan v1 tunnel by simulated packets]) | |
7c84d7f4 | 775 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
eb27d96b YS |
776 | |
777 | OVS_TRAFFIC_VSWITCHD_START() | |
778 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
779 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
780 | ||
781 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
782 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
783 | ||
784 | ADD_NAMESPACES(at_ns0) | |
785 | ||
786 | dnl Set up underlay link from host into the namespace using veth pair. | |
787 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", f2:ff:00:00:00:03, [], nodad) | |
788 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
789 | AT_CHECK([ip link set dev br-underlay up]) | |
790 | ||
791 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
792 | dnl linux device inside the namespace. | |
793 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
794 | [options:key=123 options:erspan_ver=1 options:erspan_idx=0x7]) | |
795 | ||
796 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
797 | ||
798 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
799 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
800 | dnl around it. | |
801 | ip6tables -I INPUT 1 -i br-underlay -j ACCEPT | |
802 | on_exit 'ip6tables -D INPUT 1' | |
803 | ||
804 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host fc00:100::1 -l > p0.pcap & | |
805 | sleep 1 | |
806 | ||
807 | dnl First, check the underlay. | |
808 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
809 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
810 | ]) | |
811 | ||
812 | dnl Okay, now send raw arp request and icmp echo request. | |
813 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531003a2f40fc000100000000000000000000000001fc000100000000000000000000000100100088be000000051000007b00000007fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
814 | ||
815 | dnl Check arp reply. | |
816 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0000 0001 0806 0001 0800 0604 0002 f2ff" 2>&1 1>/dev/null]) | |
817 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0000 0001 0a01 0164 f2ff 0000 0004 0a01" 2>&1 1>/dev/null]) | |
818 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0060: 0101" 2>&1 1>/dev/null]) | |
819 | ||
820 | AT_FAIL_IF([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0,.* length 114" 2>&1 1>/dev/null]) | |
821 | ||
822 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531007a3c40fc000100000000000000000000000001fc0001000000000000000000000001002f00040104010100100088be000000061000407b00000007f2ff00000001f2ff0000000408004500005429b640004001fa8c0a0101010a01016408005c2c7526000118d3685b00000000e4aa020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=normal" | |
823 | ||
824 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0,.* length 114" 2>&1 1>/dev/null]) | |
825 | ||
826 | OVS_TRAFFIC_VSWITCHD_STOP | |
827 | AT_CLEANUP | |
828 | ||
829 | AT_SETUP([datapath - ping over ip6erspan v2 tunnel by simulated packets]) | |
7c84d7f4 | 830 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
eb27d96b YS |
831 | |
832 | OVS_TRAFFIC_VSWITCHD_START() | |
833 | AT_CHECK([ovs-vsctl -- set bridge br0 other-config:hwaddr=\"f2:ff:00:00:00:01\"]) | |
834 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"f2:ff:00:00:00:02\"]) | |
835 | ||
836 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
837 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
838 | ||
839 | ADD_NAMESPACES(at_ns0) | |
840 | ||
841 | dnl Set up underlay link from host into the namespace using veth pair. | |
842 | ADD_VETH(p0, at_ns0, br-underlay, "fc00:100::1/96", f2:ff:00:00:00:03, [], nodad) | |
843 | AT_CHECK([ip addr add dev br-underlay "fc00:100::100/96" nodad]) | |
844 | AT_CHECK([ip link set dev br-underlay up]) | |
845 | ||
846 | dnl Set up tunnel endpoints on OVS outside the namespace and simulate a native | |
847 | dnl linux device inside the namespace. | |
848 | ADD_OVS_TUNNEL6([ip6erspan], [br0], [at_erspan0], [fc00:100::1], [10.1.1.100/24], | |
849 | [options:key=121 options:erspan_ver=2 options:erspan_dir=0 options:erspan_hwid=0x7]) | |
850 | ||
851 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 2 fc00:100::100]) | |
852 | ||
853 | dnl Certain Linux distributions, like CentOS, have default iptable rules | |
854 | dnl to reject input traffic from br-underlay. Here we add a rule to walk | |
855 | dnl around it. | |
856 | ip6tables -I INPUT 1 -i br-underlay -j ACCEPT | |
857 | on_exit 'ip6tables -D INPUT 1' | |
858 | ||
859 | ip netns exec at_ns0 tcpdump -n -x -i p0 dst host fc00:100::1 -l > p0.pcap & | |
860 | sleep 1 | |
861 | ||
862 | dnl First, check the underlay. | |
863 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:100::100 | FORMAT_PING], [0], [dnl | |
864 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
865 | ]) | |
866 | ||
867 | dnl Okay, now send raw arp request and icmp echo request. | |
868 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531003e2f40fc000100000000000000000000000001fc000100000000000000000000000100100088be0000000620000079af514f9900008070fffffffffffff2ff0000000408060001080006040001f2ff000000040a0101010000000000000a010164 actions=normal" | |
869 | ||
870 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0040: 0004 f2ff 0000 0001 0806 0001 0800 0604" 2>&1 1>/dev/null]) | |
871 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0050: 0002 f2ff 0000 0001 0a01 0164 f2ff 0000" 2>&1 1>/dev/null]) | |
872 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "0x0060: 0004 0a01 0101" 2>&1 1>/dev/null]) | |
873 | ||
874 | AT_FAIL_IF([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0, .* length 118" 2>&1 1>/dev/null]) | |
875 | ||
876 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=f2ff00000002f2ff0000000386dd60008531007e3c40fc000100000000000000000000000001fc0001000000000000000000000001002f00040104010100100088be0000000720004079af514f9b00008070f2ff00000001f2ff00000004080045000054ffcb4000400124770a0101010a0101640800419e23ac000112d7685b000000004caf0c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 actions=normal" | |
877 | ||
878 | OVS_WAIT_UNTIL([cat p0.pcap | egrep "IP6 fc00:100::100 > fc00:100::1: GREv0, .* length 118" 2>&1 1>/dev/null]) | |
879 | ||
880 | OVS_TRAFFIC_VSWITCHD_STOP | |
881 | AT_CLEANUP | |
882 | ||
7ae62a67 WT |
883 | AT_SETUP([datapath - clone action]) |
884 | OVS_TRAFFIC_VSWITCHD_START() | |
885 | ||
886 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2) | |
887 | ||
888 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
889 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
7ae62a67 | 890 | |
88b5874e WT |
891 | AT_CHECK([ovs-vsctl -- set interface ovs-p0 ofport_request=1 \ |
892 | -- set interface ovs-p1 ofport_request=2]) | |
7ae62a67 | 893 | |
88b5874e WT |
894 | AT_DATA([flows.txt], [dnl |
895 | priority=1 actions=NORMAL | |
896 | 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 | |
897 | 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 | |
898 | ]) | |
899 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
7ae62a67 | 900 | |
88b5874e | 901 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) |
7ae62a67 WT |
902 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl |
903 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
904 | ]) | |
905 | ||
e8833217 DM |
906 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
907 | ||
88b5874e WT |
908 | AT_CHECK([cat ofctl_monitor.log | STRIP_MONITOR_CSUM], [0], [dnl |
909 | 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> | |
910 | 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> | |
911 | 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> | |
912 | ]) | |
7ae62a67 WT |
913 | |
914 | OVS_TRAFFIC_VSWITCHD_STOP | |
915 | AT_CLEANUP | |
916 | ||
457402dc YHW |
917 | AT_SETUP([datapath - mpls actions]) |
918 | OVS_TRAFFIC_VSWITCHD_START([_ADD_BR([br1])]) | |
919 | ||
920 | ADD_NAMESPACES(at_ns0, at_ns1) | |
921 | ||
922 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
923 | ADD_VETH(p1, at_ns1, br1, "10.1.1.2/24") | |
924 | ||
925 | AT_CHECK([ip link add patch0 type veth peer name patch1]) | |
926 | on_exit 'ip link del patch0' | |
927 | ||
928 | AT_CHECK([ip link set dev patch0 up]) | |
929 | AT_CHECK([ip link set dev patch1 up]) | |
930 | AT_CHECK([ovs-vsctl add-port br0 patch0]) | |
931 | AT_CHECK([ovs-vsctl add-port br1 patch1]) | |
932 | ||
933 | AT_DATA([flows.txt], [dnl | |
934 | table=0,priority=100,dl_type=0x0800 actions=push_mpls:0x8847,set_mpls_label:3,resubmit(,1) | |
935 | table=0,priority=100,dl_type=0x8847,mpls_label=3 actions=pop_mpls:0x0800,resubmit(,1) | |
936 | table=0,priority=10 actions=resubmit(,1) | |
937 | table=1,priority=10 actions=normal | |
938 | ]) | |
939 | ||
940 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
941 | AT_CHECK([ovs-ofctl add-flows br1 flows.txt]) | |
942 | ||
943 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
944 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
945 | ]) | |
946 | ||
947 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
948 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
949 | ]) | |
950 | ||
951 | OVS_TRAFFIC_VSWITCHD_STOP | |
952 | AT_CLEANUP | |
aaca4fe0 | 953 | AT_SETUP([datapath - basic truncate action]) |
9c1ab985 | 954 | AT_SKIP_IF([test $HAVE_NC = no]) |
aaca4fe0 WT |
955 | OVS_TRAFFIC_VSWITCHD_START() |
956 | AT_CHECK([ovs-ofctl del-flows br0]) | |
957 | ||
958 | dnl Create p0 and ovs-p0(1) | |
959 | ADD_NAMESPACES(at_ns0) | |
960 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
961 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
962 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
963 | ||
964 | dnl Create p1(3) and ovs-p1(2), packets received from ovs-p1 will appear in p1 | |
965 | AT_CHECK([ip link add p1 type veth peer name ovs-p1]) | |
966 | on_exit 'ip link del ovs-p1' | |
967 | AT_CHECK([ip link set dev ovs-p1 up]) | |
968 | AT_CHECK([ip link set dev p1 up]) | |
969 | AT_CHECK([ovs-vsctl add-port br0 ovs-p1 -- set interface ovs-p1 ofport_request=2]) | |
970 | dnl Use p1 to check the truncated packet | |
971 | AT_CHECK([ovs-vsctl add-port br0 p1 -- set interface p1 ofport_request=3]) | |
972 | ||
973 | dnl Create p2(5) and ovs-p2(4) | |
974 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
975 | on_exit 'ip link del ovs-p2' | |
976 | AT_CHECK([ip link set dev ovs-p2 up]) | |
977 | AT_CHECK([ip link set dev p2 up]) | |
978 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=4]) | |
979 | dnl Use p2 to check the truncated packet | |
980 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=5]) | |
981 | ||
982 | dnl basic test | |
983 | AT_CHECK([ovs-ofctl del-flows br0]) | |
984 | AT_DATA([flows.txt], [dnl | |
985 | in_port=3 dl_dst=e6:66:c1:22:22:22 actions=drop | |
986 | in_port=5 dl_dst=e6:66:c1:22:22:22 actions=drop | |
987 | in_port=1 dl_dst=e6:66:c1:22:22:22 actions=output(port=2,max_len=100),output:4 | |
988 | ]) | |
989 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
990 | ||
991 | dnl use this file as payload file for ncat | |
992 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
993 | on_exit 'rm -f payload200.bin' | |
a037f175 | 994 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
995 | |
996 | dnl packet with truncated size | |
997 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
998 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
999 | n_bytes=100 | |
1000 | ]) | |
1001 | dnl packet with original size | |
1002 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1003 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1004 | n_bytes=242 | |
1005 | ]) | |
1006 | ||
1007 | dnl more complicated output actions | |
1008 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1009 | AT_DATA([flows.txt], [dnl | |
1010 | in_port=3 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1011 | in_port=5 dl_dst=e6:66:c1:22:22:22 actions=drop | |
1012 | 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) | |
1013 | ]) | |
1014 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1015 | ||
a037f175 | 1016 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
1017 | |
1018 | dnl 100 + 100 + 242 + min(65535,242) = 684 | |
1019 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1020 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1021 | n_bytes=684 | |
1022 | ]) | |
1023 | dnl 242 + 100 + min(242,200) = 542 | |
1024 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1025 | n_bytes=542 | |
1026 | ]) | |
1027 | ||
1028 | dnl SLOW_ACTION: disable kernel datapath truncate support | |
1029 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
c7eca965 | 1030 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) |
aaca4fe0 WT |
1031 | |
1032 | dnl SLOW_ACTION test1: check datapatch actions | |
1033 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1034 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1035 | ||
3041e1fc | 1036 | 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 |
1037 | AT_CHECK([tail -3 stdout], [0], |
1038 | [Datapath actions: trunc(100),3,5,trunc(100),3,trunc(100),5,3,trunc(200),5,trunc(65535),3 | |
1039 | This flow is handled by the userspace slow path because it: | |
393e9f7c | 1040 | - Uses action(s) not supported by datapath. |
aaca4fe0 | 1041 | ]) |
aaca4fe0 WT |
1042 | |
1043 | dnl SLOW_ACTION test2: check actual packet truncate | |
1044 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1045 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a037f175 | 1046 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 < payload200.bin]) |
aaca4fe0 WT |
1047 | |
1048 | dnl 100 + 100 + 242 + min(65535,242) = 684 | |
1049 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1050 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1051 | n_bytes=684 | |
1052 | ]) | |
1053 | ||
1054 | dnl 242 + 100 + min(242,200) = 542 | |
1055 | AT_CHECK([ovs-ofctl dump-flows br0 table=0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1056 | n_bytes=542 | |
1057 | ]) | |
1058 | ||
1059 | OVS_TRAFFIC_VSWITCHD_STOP | |
1060 | AT_CLEANUP | |
1061 | ||
348f1f67 YS |
1062 | dnl Create 2 bridges and 2 namespaces to test truncate over |
1063 | dnl GRE tunnel: | |
1064 | dnl br0: overlay bridge | |
1065 | dnl ns1: connect to br0, with IP:10.1.1.2 | |
1066 | dnl br-underlay: with IP: 172.31.1.100 | |
1067 | dnl ns0: connect to br-underlay, with IP: 10.1.1.1 | |
1068 | AT_SETUP([datapath - truncate and output to gre tunnel by simulated packets]) | |
7c84d7f4 | 1069 | OVS_CHECK_KERNEL(3, 10, 4, 18) |
348f1f67 YS |
1070 | AT_SKIP_IF([test $HAVE_NC = no]) |
1071 | OVS_TRAFFIC_VSWITCHD_START() | |
1072 | ||
1073 | ADD_BR([br-underlay], [set bridge br-underlay other-config:hwaddr=\"02:90:8c:a8:a1:49\"]) | |
1074 | ADD_NAMESPACES(at_ns0) | |
1075 | ADD_NAMESPACES(at_ns1) | |
1076 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
1077 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
1078 | ||
1079 | dnl Set up underlay link from host into the namespace using veth pair. | |
1080 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", fa:ad:fa:25:05:60) | |
1081 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
1082 | AT_CHECK([ip link set dev br-underlay up]) | |
1083 | ||
1084 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
1085 | dnl linux device inside the namespace. | |
1086 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
1087 | ||
1088 | dnl The below native tunnel isn't actually added. We simulate it to send | |
1089 | dnl and receive packets. | |
1090 | dnl ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24], | |
1091 | dnl [], [address e6:66:c1:11:11:11]) | |
1092 | dnl AT_CHECK([ovs-vsctl -- set interface at_gre0 ofport_request=1]) | |
1093 | dnl NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
1094 | ||
1095 | dnl Set up (p1 and ovs-p1) at br0 | |
1096 | ADD_VETH(p1, at_ns1, br0, '10.1.1.2/24') | |
1097 | AT_CHECK([ovs-vsctl -- set interface ovs-p1 ofport_request=2]) | |
1098 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
1099 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
1100 | ||
1101 | dnl Set up (p2 and ovs-p2) as loopback for verifying packet size | |
1102 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
1103 | on_exit 'ip link del ovs-p2' | |
1104 | AT_CHECK([ip link set dev ovs-p2 up]) | |
1105 | AT_CHECK([ip link set dev p2 up]) | |
1106 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=3]) | |
1107 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=4]) | |
1108 | ||
1109 | dnl use this file as payload file for ncat | |
1110 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
1111 | on_exit 'rm -f payload200.bin' | |
1112 | ||
1113 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1114 | AT_DATA([flows.txt], [dnl | |
1115 | priority=99,in_port=1,actions=output(port=2,max_len=100),output(port=3,max_len=100) | |
1116 | priority=99,in_port=2,udp,actions=output(port=1,max_len=100) | |
1117 | priority=1,in_port=4,ip,actions=drop | |
1118 | priority=1,actions=drop | |
1119 | ]) | |
1120 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1121 | ||
1122 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1123 | AT_DATA([flows-underlay.txt], [dnl | |
1124 | priority=99,dl_type=0x0800,nw_proto=47,in_port=1,actions=LOCAL | |
1125 | priority=99,dl_type=0x0800,nw_proto=47,in_port=LOCAL,ip_dst=172.31.1.1/24,actions=1 | |
1126 | priority=1,actions=drop | |
1127 | ]) | |
1128 | ||
1129 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1130 | ||
1131 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
1132 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) | |
1133 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1134 | ||
1135 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1136 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1137 | n_bytes=242 | |
1138 | ]) | |
1139 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1140 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1141 | n_bytes=138 | |
1142 | ]) | |
1143 | ||
1144 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
1145 | dnl This 200-byte packet is simulated on behalf of ns_gre0 | |
1146 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=02908ca8a149faadfa25056008004500010a9e9d4000402f4084ac1f0101ac1f016400006558e666c1222222e666c11111110800450000e46f8e40004011b4760a0101010a010102e026162e00d016e6a366ebf904c74132c6fed42a9e9e46240b4d9fd13c9b47d9704a388e70a5e77db16934a6188dc01d86aa20007ace2cf9cdb111f208474b88ffc851c871f0e3fb4fff138c1d288d437efff487e2b86a9c99fbf4229a6485e133bcf3e16f6e345207fda0932d9eeb602740456fd077b4847d25481337bd716155cc245be129ccc11bf82b834767b3760b52fe913c0e24f31c0e1b27f88acf7bba6b985fb64ee2cd6fc6bba1a9c1f021e253e1728b046fd4d023307e3296361a37ea2617ebcb2537e0284a81050dd0ee actions=LOCAL" | |
1147 | ||
1148 | dnl After truncation = 100 byte at loopback device p2(4) | |
1149 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1150 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl | |
1151 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
1152 | ]) | |
1153 | ||
1154 | dnl SLOW_ACTION: disable datapath truncate support | |
1155 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
1156 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) | |
1157 | ||
1158 | dnl SLOW_ACTION test1: check datapatch actions | |
1159 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1160 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1161 | ||
1162 | dnl SLOW_ACTION test2: check actual packet truncate | |
1163 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1164 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1165 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1166 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1167 | ||
1168 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
1169 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) | |
1170 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1171 | ||
1172 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1173 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1174 | n_bytes=242 | |
1175 | ]) | |
1176 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1177 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1178 | n_bytes=138 | |
1179 | ]) | |
1180 | ||
1181 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
1182 | dnl This 200-byte packet is simulated on behalf of ns_gre0 | |
1183 | ovs-ofctl -O OpenFlow13 packet-out br-underlay "in_port=1 packet=02908ca8a149faadfa25056008004500010a9e9d4000402f4084ac1f0101ac1f016400006558e666c1222222e666c11111110800450000e46f8e40004011b4760a0101010a010102e026162e00d016e6a366ebf904c74132c6fed42a9e9e46240b4d9fd13c9b47d9704a388e70a5e77db16934a6188dc01d86aa20007ace2cf9cdb111f208474b88ffc851c871f0e3fb4fff138c1d288d437efff487e2b86a9c99fbf4229a6485e133bcf3e16f6e345207fda0932d9eeb602740456fd077b4847d25481337bd716155cc245be129ccc11bf82b834767b3760b52fe913c0e24f31c0e1b27f88acf7bba6b985fb64ee2cd6fc6bba1a9c1f021e253e1728b046fd4d023307e3296361a37ea2617ebcb2537e0284a81050dd0ee actions=LOCAL" | |
1184 | ||
1185 | dnl After truncation = 100 byte at loopback device p2(4) | |
1186 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1187 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl | |
1188 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
1189 | ]) | |
1190 | ||
1191 | OVS_TRAFFIC_VSWITCHD_STOP | |
1192 | AT_CLEANUP | |
1193 | ||
aaca4fe0 WT |
1194 | dnl Create 2 bridges and 2 namespaces to test truncate over |
1195 | dnl GRE tunnel: | |
1196 | dnl br0: overlay bridge | |
1197 | dnl ns1: connect to br0, with IP:10.1.1.2 | |
1198 | dnl br-underlay: with IP: 172.31.1.100 | |
1199 | dnl ns0: connect to br-underlay, with IP: 10.1.1.1 | |
1200 | AT_SETUP([datapath - truncate and output to gre tunnel]) | |
9c1ab985 | 1201 | AT_SKIP_IF([test $HAVE_NC = no]) |
348f1f67 | 1202 | OVS_CHECK_KERNEL_EXCL(3, 10, 4, 15) |
aaca4fe0 WT |
1203 | OVS_CHECK_GRE() |
1204 | OVS_TRAFFIC_VSWITCHD_START() | |
1205 | ||
1206 | ADD_BR([br-underlay]) | |
1207 | ADD_NAMESPACES(at_ns0) | |
1208 | ADD_NAMESPACES(at_ns1) | |
1209 | AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) | |
1210 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
1211 | ||
1212 | dnl Set up underlay link from host into the namespace using veth pair. | |
1213 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
1214 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
1215 | AT_CHECK([ip link set dev br-underlay up]) | |
1216 | ||
1217 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
1218 | dnl linux device inside the namespace. | |
1219 | ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) | |
2b9f3924 WT |
1220 | ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24], |
1221 | [], [address e6:66:c1:11:11:11]) | |
aaca4fe0 | 1222 | AT_CHECK([ovs-vsctl -- set interface at_gre0 ofport_request=1]) |
aaca4fe0 WT |
1223 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) |
1224 | ||
1225 | dnl Set up (p1 and ovs-p1) at br0 | |
1226 | ADD_VETH(p1, at_ns1, br0, '10.1.1.2/24') | |
1227 | AT_CHECK([ovs-vsctl -- set interface ovs-p1 ofport_request=2]) | |
1228 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
1229 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
1230 | ||
1231 | dnl Set up (p2 and ovs-p2) as loopback for verifying packet size | |
1232 | AT_CHECK([ip link add p2 type veth peer name ovs-p2]) | |
1233 | on_exit 'ip link del ovs-p2' | |
1234 | AT_CHECK([ip link set dev ovs-p2 up]) | |
1235 | AT_CHECK([ip link set dev p2 up]) | |
1236 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2 -- set interface ovs-p2 ofport_request=3]) | |
1237 | AT_CHECK([ovs-vsctl add-port br0 p2 -- set interface p2 ofport_request=4]) | |
1238 | ||
1239 | dnl use this file as payload file for ncat | |
1240 | AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2> /dev/null]) | |
1241 | on_exit 'rm -f payload200.bin' | |
1242 | ||
1243 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1244 | AT_DATA([flows.txt], [dnl | |
1245 | priority=99,in_port=1,actions=output(port=2,max_len=100),output(port=3,max_len=100) | |
1246 | priority=99,in_port=2,udp,actions=output(port=1,max_len=100) | |
1247 | priority=1,in_port=4,ip,actions=drop | |
1248 | priority=1,actions=drop | |
1249 | ]) | |
1250 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1251 | ||
1252 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1253 | AT_DATA([flows-underlay.txt], [dnl | |
1254 | priority=99,dl_type=0x0800,nw_proto=47,in_port=1,actions=LOCAL | |
1255 | priority=99,dl_type=0x0800,nw_proto=47,in_port=LOCAL,ip_dst=172.31.1.1/24,actions=1 | |
1256 | priority=1,actions=drop | |
1257 | ]) | |
1258 | ||
1259 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1260 | ||
1261 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
a037f175 | 1262 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) |
aaca4fe0 WT |
1263 | AT_CHECK([ovs-appctl revalidator/purge], [0]) |
1264 | ||
1265 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1266 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1267 | n_bytes=242 | |
1268 | ]) | |
1269 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1270 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1271 | n_bytes=138 | |
1272 | ]) | |
1273 | ||
1274 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
a037f175 | 1275 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 < payload200.bin]) |
aaca4fe0 WT |
1276 | dnl After truncation = 100 byte at loopback device p2(4) |
1277 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
32b0cc65 JS |
1278 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl |
1279 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
aaca4fe0 WT |
1280 | ]) |
1281 | ||
1282 | dnl SLOW_ACTION: disable datapath truncate support | |
1283 | dnl Repeat the test above, but exercise the SLOW_ACTION code path | |
c7eca965 | 1284 | AT_CHECK([ovs-appctl dpif/set-dp-features br0 trunc false], [0]) |
aaca4fe0 WT |
1285 | |
1286 | dnl SLOW_ACTION test1: check datapatch actions | |
1287 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1288 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1289 | ||
aaca4fe0 WT |
1290 | dnl SLOW_ACTION test2: check actual packet truncate |
1291 | AT_CHECK([ovs-ofctl del-flows br0]) | |
1292 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1293 | AT_CHECK([ovs-ofctl del-flows br-underlay]) | |
1294 | AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt]) | |
1295 | ||
1296 | dnl check tunnel push path, from at_ns1 to at_ns0 | |
a037f175 | 1297 | NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 < payload200.bin]) |
aaca4fe0 WT |
1298 | AT_CHECK([ovs-appctl revalidator/purge], [0]) |
1299 | ||
1300 | dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B | |
1301 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=2" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1302 | n_bytes=242 | |
1303 | ]) | |
1304 | dnl After truncation = outer ETH(14) + outer IP(20) + GRE(4) + 100 = 138B | |
1305 | AT_CHECK([ovs-ofctl dump-flows br-underlay | grep "in_port=LOCAL" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl | |
1306 | n_bytes=138 | |
1307 | ]) | |
1308 | ||
1309 | dnl check tunnel pop path, from at_ns0 to at_ns1 | |
a037f175 | 1310 | NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 < payload200.bin]) |
aaca4fe0 WT |
1311 | dnl After truncation = 100 byte at loopback device p2(4) |
1312 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
32b0cc65 JS |
1313 | AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | ofctl_strip], [0], [dnl |
1314 | n_packets=1, n_bytes=100, priority=1,ip,in_port=4 actions=drop | |
aaca4fe0 WT |
1315 | ]) |
1316 | ||
1317 | OVS_TRAFFIC_VSWITCHD_STOP | |
1318 | AT_CLEANUP | |
1319 | ||
ee8941ab JS |
1320 | AT_BANNER([conntrack]) |
1321 | ||
07659514 JS |
1322 | AT_SETUP([conntrack - controller]) |
1323 | CHECK_CONNTRACK() | |
cf7659b6 | 1324 | OVS_TRAFFIC_VSWITCHD_START() |
daf4d3c1 | 1325 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) |
07659514 JS |
1326 | |
1327 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1328 | ||
1329 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1330 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1331 | ||
1332 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1333 | AT_DATA([flows.txt], [dnl | |
1334 | priority=1,action=drop | |
1335 | priority=10,arp,action=normal | |
1336 | priority=100,in_port=1,udp,action=ct(commit),controller | |
1337 | priority=100,in_port=2,ct_state=-trk,udp,action=ct(table=0) | |
1338 | priority=100,in_port=2,ct_state=+trk+est,udp,action=controller | |
1339 | ]) | |
1340 | ||
6cfa8ec3 | 1341 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 JS |
1342 | |
1343 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
1344 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
1345 | ||
1346 | dnl Send an unsolicited reply from port 2. This should be dropped. | |
4573c42e | 1347 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=0\) '50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000']) |
07659514 JS |
1348 | |
1349 | dnl OK, now start a new connection from port 1. | |
4573c42e | 1350 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit\),controller '50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000']) |
07659514 JS |
1351 | |
1352 | dnl Now try a reply from port 2. | |
4573c42e | 1353 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=0\) '50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000']) |
07659514 | 1354 | |
e8833217 DM |
1355 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
1356 | ||
07659514 JS |
1357 | dnl Check this output. We only see the latter two packets, not the first. |
1358 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
f274a047 | 1359 | NXT_PACKET_IN2 (xid=0x0): total_len=42 in_port=1 (via action) data_len=42 (unbuffered) |
07659514 | 1360 | 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 | 1361 | 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 |
1362 | 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 |
1363 | ]) | |
1364 | ||
1365 | OVS_TRAFFIC_VSWITCHD_STOP | |
1366 | AT_CLEANUP | |
1367 | ||
a76a37ef JR |
1368 | AT_SETUP([conntrack - force commit]) |
1369 | CHECK_CONNTRACK() | |
1370 | OVS_TRAFFIC_VSWITCHD_START() | |
1371 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) | |
1372 | ||
1373 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1374 | ||
1375 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1376 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1377 | ||
1378 | AT_DATA([flows.txt], [dnl | |
1379 | priority=1,action=drop | |
1380 | priority=10,arp,action=normal | |
68c94b1a | 1381 | priority=100,in_port=1,udp,action=ct(force,commit),controller |
a76a37ef JR |
1382 | priority=100,in_port=2,ct_state=-trk,udp,action=ct(table=0) |
1383 | priority=100,in_port=2,ct_state=+trk+est,udp,action=ct(force,commit,table=1) | |
1384 | table=1,in_port=2,ct_state=+trk,udp,action=controller | |
1385 | ]) | |
1386 | ||
1387 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1388 | ||
1389 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
1390 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
1391 | ||
1392 | dnl Send an unsolicited reply from port 2. This should be dropped. | |
1393 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1394 | ||
1395 | dnl OK, now start a new connection from port 1. | |
1396 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1397 | ||
1398 | dnl Now try a reply from port 2. | |
1399 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1400 | ||
1401 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1402 | ||
e8833217 DM |
1403 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
1404 | ||
a76a37ef JR |
1405 | dnl Check this output. We only see the latter two packets, not the first. |
1406 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
1407 | NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered) | |
1408 | 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 | 1409 | 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 |
1410 | 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 |
1411 | ]) | |
1412 | ||
1413 | dnl | |
1414 | dnl Check that the directionality has been changed by force commit. | |
1415 | dnl | |
1416 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [], [dnl | |
1417 | 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) | |
1418 | ]) | |
1419 | ||
68c94b1a JS |
1420 | dnl OK, now send another packet from port 1 and see that it switches again |
1421 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1422 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
1423 | ||
1424 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [], [dnl | |
1425 | 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) | |
1426 | ]) | |
1427 | ||
a76a37ef JR |
1428 | OVS_TRAFFIC_VSWITCHD_STOP |
1429 | AT_CLEANUP | |
1430 | ||
c43a1331 YHW |
1431 | AT_SETUP([conntrack - ct flush by 5-tuple]) |
1432 | CHECK_CONNTRACK() | |
c43a1331 YHW |
1433 | OVS_TRAFFIC_VSWITCHD_START() |
1434 | ||
1435 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1436 | ||
1437 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1438 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1439 | ||
1440 | AT_DATA([flows.txt], [dnl | |
1441 | priority=1,action=drop | |
1442 | priority=10,arp,action=normal | |
1443 | priority=100,in_port=1,udp,action=ct(commit),2 | |
1444 | priority=100,in_port=2,udp,action=ct(zone=5,commit),1 | |
1445 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1446 | priority=100,in_port=2,icmp,action=ct(zone=5,commit),1 | |
1447 | ]) | |
1448 | ||
1449 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1450 | ||
1451 | dnl Test UDP from port 1 | |
1452 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
1453 | ||
1454 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [], [dnl | |
1455 | 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) | |
1456 | ]) | |
1457 | ||
1458 | 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']) | |
1459 | ||
1460 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1,"], [1], [dnl | |
1461 | ]) | |
1462 | ||
1463 | dnl Test UDP from port 2 | |
1464 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101020a0101010002000100080000 actions=resubmit(,0)"]) | |
1465 | ||
1466 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [0], [dnl | |
1467 | 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 | |
1468 | ]) | |
1469 | ||
1470 | 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']) | |
1471 | ||
1472 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1473 | ]) | |
1474 | ||
1475 | dnl Test ICMP traffic | |
1476 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
1477 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1478 | ]) | |
1479 | ||
1480 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [0], [stdout]) | |
1481 | AT_CHECK([cat stdout | FORMAT_CT(10.1.1.1)], [0],[dnl | |
1482 | 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 | |
1483 | ]) | |
1484 | ||
1485 | ICMP_ID=`cat stdout | cut -d ',' -f4 | cut -d '=' -f2` | |
1486 | 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 | |
1487 | AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=5 $ICMP_TUPLE]) | |
1488 | ||
1489 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.2,"], [1], [dnl | |
1490 | ]) | |
1491 | ||
ffdcd110 | 1492 | OVS_TRAFFIC_VSWITCHD_STOP |
c43a1331 YHW |
1493 | AT_CLEANUP |
1494 | ||
e5cf8cce DDP |
1495 | AT_SETUP([conntrack - IPv4 ping]) |
1496 | CHECK_CONNTRACK() | |
1497 | OVS_TRAFFIC_VSWITCHD_START() | |
1498 | ||
1499 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1500 | ||
1501 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1502 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1503 | ||
1504 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1505 | AT_DATA([flows.txt], [dnl | |
1506 | priority=1,action=drop | |
1507 | priority=10,arp,action=normal | |
1508 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1509 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
1510 | priority=100,in_port=2,icmp,ct_state=+trk+est,action=1 | |
1511 | ]) | |
1512 | ||
1513 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1514 | ||
1515 | dnl Pings from ns0->ns1 should work fine. | |
1516 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
1517 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1518 | ]) | |
1519 | ||
1520 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1521 | 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) | |
1522 | ]) | |
1523 | ||
1524 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1525 | ||
1526 | dnl Pings from ns1->ns0 should fail. | |
1527 | NS_CHECK_EXEC([at_ns1], [ping -q -c 3 -i 0.3 -w 2 10.1.1.1 | FORMAT_PING], [0], [dnl | |
1528 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
1529 | ]) | |
1530 | ||
1531 | OVS_TRAFFIC_VSWITCHD_STOP | |
1532 | AT_CLEANUP | |
1533 | ||
26509f88 DB |
1534 | AT_SETUP([conntrack - get_nconns and get/set_maxconns]) |
1535 | CHECK_CONNTRACK() | |
1536 | CHECK_CT_DPIF_SET_GET_MAXCONNS() | |
1537 | CHECK_CT_DPIF_GET_NCONNS() | |
1538 | OVS_TRAFFIC_VSWITCHD_START() | |
1539 | ||
1540 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1541 | ||
1542 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1543 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1544 | ||
1545 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1546 | AT_DATA([flows.txt], [dnl | |
1547 | priority=1,action=drop | |
1548 | priority=10,arp,action=normal | |
1549 | priority=100,in_port=1,icmp,action=ct(commit),2 | |
1550 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
1551 | priority=100,in_port=2,icmp,ct_state=+trk+est,action=1 | |
1552 | ]) | |
1553 | ||
1554 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1555 | ||
1556 | dnl Pings from ns0->ns1 should work fine. | |
1557 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | 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 | FORMAT_CT(10.1.1.2)], [0], [dnl | |
1562 | 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) | |
1563 | ]) | |
1564 | ||
1565 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns one-bad-dp], [2], [], [dnl | |
1566 | ovs-vswitchd: maxconns missing or malformed (Invalid argument) | |
1567 | ovs-appctl: ovs-vswitchd: server returned an error | |
1568 | ]) | |
1569 | ||
1570 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns a], [2], [], [dnl | |
1571 | ovs-vswitchd: maxconns missing or malformed (Invalid argument) | |
1572 | ovs-appctl: ovs-vswitchd: server returned an error | |
1573 | ]) | |
1574 | ||
1575 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns one-bad-dp 10], [2], [], [dnl | |
ffdcd110 | 1576 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1577 | ovs-appctl: ovs-vswitchd: server returned an error |
1578 | ]) | |
1579 | ||
1580 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns one-bad-dp], [2], [], [dnl | |
ffdcd110 | 1581 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1582 | ovs-appctl: ovs-vswitchd: server returned an error |
1583 | ]) | |
1584 | ||
1585 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns one-bad-dp], [2], [], [dnl | |
ffdcd110 | 1586 | ovs-vswitchd: datapath not found (Invalid argument) |
26509f88 DB |
1587 | ovs-appctl: ovs-vswitchd: server returned an error |
1588 | ]) | |
1589 | ||
1590 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns], [], [dnl | |
1591 | 1 | |
1592 | ]) | |
1593 | ||
1594 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1595 | 3000000 | |
1596 | ]) | |
1597 | ||
1598 | AT_CHECK([ovs-appctl dpctl/ct-set-maxconns 10], [], [dnl | |
1599 | setting maxconns successful | |
1600 | ]) | |
1601 | ||
1602 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1603 | 10 | |
1604 | ]) | |
1605 | ||
1606 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1607 | ||
1608 | AT_CHECK([ovs-appctl dpctl/ct-get-nconns], [], [dnl | |
1609 | 0 | |
1610 | ]) | |
1611 | ||
1612 | AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl | |
1613 | 10 | |
1614 | ]) | |
1615 | ||
ffdcd110 | 1616 | OVS_TRAFFIC_VSWITCHD_STOP |
26509f88 DB |
1617 | AT_CLEANUP |
1618 | ||
e5cf8cce DDP |
1619 | AT_SETUP([conntrack - IPv6 ping]) |
1620 | CHECK_CONNTRACK() | |
1621 | OVS_TRAFFIC_VSWITCHD_START() | |
1622 | ||
1623 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1624 | ||
1625 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
1626 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
1627 | ||
1628 | AT_DATA([flows.txt], [dnl | |
1629 | ||
1630 | dnl ICMPv6 echo request and reply go to table 1. The rest of the traffic goes | |
1631 | dnl through normal action. | |
1632 | table=0,priority=10,icmp6,icmp_type=128,action=goto_table:1 | |
1633 | table=0,priority=10,icmp6,icmp_type=129,action=goto_table:1 | |
1634 | table=0,priority=1,action=normal | |
1635 | ||
1636 | dnl Allow everything from ns0->ns1. Only allow return traffic from ns1->ns0. | |
1637 | table=1,priority=100,in_port=1,icmp6,action=ct(commit),2 | |
1638 | table=1,priority=100,in_port=2,icmp6,ct_state=-trk,action=ct(table=0) | |
1639 | table=1,priority=100,in_port=2,icmp6,ct_state=+trk+est,action=1 | |
1640 | table=1,priority=1,action=drop | |
1641 | ]) | |
1642 | ||
1643 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
1644 | ||
1645 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
1646 | ||
027f7e84 DDP |
1647 | dnl The above ping creates state in the connection tracker. We're not |
1648 | dnl interested in that state. | |
1649 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
1650 | ||
e5cf8cce DDP |
1651 | dnl Pings from ns1->ns0 should fail. |
1652 | NS_CHECK_EXEC([at_ns1], [ping6 -q -c 3 -i 0.3 -w 2 fc00::1 | FORMAT_PING], [0], [dnl | |
1653 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
1654 | ]) | |
1655 | ||
1656 | dnl Pings from ns0->ns1 should work fine. | |
1657 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
1658 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
1659 | ]) | |
1660 | ||
1661 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
1662 | 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) | |
1663 | ]) | |
1664 | ||
1665 | OVS_TRAFFIC_VSWITCHD_STOP | |
1666 | AT_CLEANUP | |
1667 | ||
07659514 JS |
1668 | AT_SETUP([conntrack - preserve registers]) |
1669 | CHECK_CONNTRACK() | |
cf7659b6 | 1670 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1671 | |
1672 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1673 | ||
1674 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1675 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1676 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1677 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1678 | ||
1679 | dnl Allow any traffic from ns0->ns1, ns2->ns3. | |
1680 | AT_DATA([flows.txt], [dnl | |
1681 | priority=1,action=drop | |
1682 | priority=10,arp,action=normal | |
1683 | priority=10,icmp,action=normal | |
1684 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,table=0) | |
1685 | priority=100,in_port=1,tcp,ct_state=+trk,action=2 | |
1686 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0) | |
1687 | priority=100,in_port=2,tcp,ct_state=+trk,action=1 | |
1688 | priority=100,in_port=3,tcp,ct_state=-trk,action=load:0->NXM_NX_REG0[[]],ct(table=0) | |
1689 | priority=100,in_port=3,tcp,ct_state=+trk,reg0=0,action=load:1->NXM_NX_REG0[[]],ct(commit,table=0) | |
1690 | priority=100,in_port=3,tcp,ct_state=+trk,reg0=1,action=4 | |
1691 | priority=100,in_port=4,tcp,ct_state=-trk,action=ct(commit,table=0) | |
1692 | priority=100,in_port=4,tcp,ct_state=+trk,action=3 | |
1693 | ]) | |
1694 | ||
6cfa8ec3 | 1695 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1696 | |
7ed40afe JS |
1697 | OVS_START_L7([at_ns1], [http]) |
1698 | OVS_START_L7([at_ns3], [http]) | |
1699 | ||
07659514 | 1700 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1701 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1702 | ||
1703 | dnl HTTP requests from p2->p3 should work fine. | |
07659514 JS |
1704 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) |
1705 | ||
1706 | OVS_TRAFFIC_VSWITCHD_STOP | |
1707 | AT_CLEANUP | |
1708 | ||
1709 | AT_SETUP([conntrack - invalid]) | |
1710 | CHECK_CONNTRACK() | |
cf7659b6 | 1711 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1712 | |
1713 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1714 | ||
1715 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1716 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1717 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1718 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1719 | ||
1720 | dnl Pass traffic from ns0->ns1 without committing, but attempt to track in | |
1721 | dnl the opposite direction. This should fail. | |
1722 | dnl Pass traffic from ns3->ns4 without committing, and this time match | |
1723 | dnl invalid traffic and allow it through. | |
1724 | AT_DATA([flows.txt], [dnl | |
1725 | priority=1,action=drop | |
1726 | priority=10,arp,action=normal | |
1727 | priority=10,icmp,action=normal | |
1728 | priority=100,in_port=1,tcp,action=ct(),2 | |
1729 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
1730 | priority=100,in_port=2,ct_state=+trk+new,tcp,action=1 | |
1731 | priority=100,in_port=3,tcp,action=ct(),4 | |
1732 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
1733 | priority=100,in_port=4,ct_state=+trk+inv,tcp,action=3 | |
1734 | priority=100,in_port=4,ct_state=+trk+new,tcp,action=3 | |
1735 | ]) | |
1736 | ||
6cfa8ec3 | 1737 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 JS |
1738 | |
1739 | dnl We set up our rules to allow the request without committing. The return | |
1740 | dnl traffic can't be identified, because the initial request wasn't committed. | |
1741 | dnl For the first pair of ports, this means that the connection fails. | |
7ed40afe JS |
1742 | OVS_START_L7([at_ns1], [http]) |
1743 | OVS_START_L7([at_ns3], [http]) | |
07659514 JS |
1744 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log], [4]) |
1745 | ||
1746 | dnl For the second pair, we allow packets from invalid connections, so it works. | |
07659514 JS |
1747 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) |
1748 | ||
1749 | OVS_TRAFFIC_VSWITCHD_STOP | |
1750 | AT_CLEANUP | |
1751 | ||
1752 | AT_SETUP([conntrack - zones]) | |
1753 | CHECK_CONNTRACK() | |
cf7659b6 | 1754 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1755 | |
1756 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1757 | ||
1758 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1759 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1760 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1761 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1762 | ||
1763 | dnl Allow any traffic from ns0->ns1. Allow return traffic, matching on zone. | |
1764 | dnl For ns2->ns3, use a different zone and see that the match fails. | |
1765 | AT_DATA([flows.txt], [dnl | |
1766 | priority=1,action=drop | |
1767 | priority=10,arp,action=normal | |
1768 | priority=10,icmp,action=normal | |
1769 | priority=100,in_port=1,tcp,action=ct(commit,zone=1),2 | |
1770 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=1) | |
1771 | priority=100,in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
1772 | priority=100,in_port=3,tcp,action=ct(commit,zone=2),4 | |
1773 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0,zone=2) | |
1774 | priority=100,in_port=4,ct_state=+trk,ct_zone=1,tcp,action=3 | |
1775 | ]) | |
1776 | ||
6cfa8ec3 | 1777 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1778 | |
7ed40afe JS |
1779 | OVS_START_L7([at_ns1], [http]) |
1780 | OVS_START_L7([at_ns3], [http]) | |
1781 | ||
07659514 | 1782 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1783 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1784 | ||
ec3aa16c | 1785 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 1786 | 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 |
1787 | ]) |
1788 | ||
1789 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
1790 | dnl Try 3 times, in 1 second intervals. | |
07659514 JS |
1791 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
1792 | ||
ec3aa16c | 1793 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 1794 | 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 |
1795 | ]) |
1796 | ||
1797 | OVS_TRAFFIC_VSWITCHD_STOP | |
1798 | AT_CLEANUP | |
1799 | ||
1800 | AT_SETUP([conntrack - zones from field]) | |
1801 | CHECK_CONNTRACK() | |
cf7659b6 | 1802 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1803 | |
1804 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1805 | ||
1806 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1807 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1808 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1809 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1810 | ||
1811 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1812 | AT_DATA([flows.txt], [dnl | |
1813 | priority=1,action=drop | |
1814 | priority=10,arp,action=normal | |
1815 | priority=10,icmp,action=normal | |
1816 | priority=100,in_port=1,tcp,action=load:0x1001->NXM_NX_REG0[[0..15]],ct(commit,zone=NXM_NX_REG0[[0..15]]),2 | |
1817 | 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]]) | |
1818 | priority=100,in_port=2,ct_state=+trk,ct_zone=0x1001,tcp,action=1 | |
1819 | priority=100,in_port=3,tcp,action=load:0x1002->NXM_NX_REG0[[0..15]],ct(commit,zone=NXM_NX_REG0[[0..15]]),4 | |
1820 | 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]]) | |
1821 | priority=100,in_port=4,ct_state=+trk,ct_zone=0x1001,tcp,action=3 | |
1822 | ]) | |
1823 | ||
6cfa8ec3 | 1824 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1825 | |
7ed40afe JS |
1826 | OVS_START_L7([at_ns1], [http]) |
1827 | OVS_START_L7([at_ns3], [http]) | |
1828 | ||
07659514 | 1829 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1830 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1831 | ||
ec3aa16c | 1832 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 1833 | 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 |
1834 | ]) |
1835 | ||
1836 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
1837 | dnl Try 3 times, in 1 second intervals. | |
07659514 JS |
1838 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
1839 | ||
ec3aa16c | 1840 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 1841 | 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 |
1842 | ]) |
1843 | ||
1844 | OVS_TRAFFIC_VSWITCHD_STOP | |
1845 | AT_CLEANUP | |
1846 | ||
1847 | AT_SETUP([conntrack - multiple bridges]) | |
1848 | CHECK_CONNTRACK() | |
1849 | OVS_TRAFFIC_VSWITCHD_START( | |
cf7659b6 | 1850 | [_ADD_BR([br1]) --\ |
07659514 JS |
1851 | add-port br0 patch+ -- set int patch+ type=patch options:peer=patch- --\ |
1852 | add-port br1 patch- -- set int patch- type=patch options:peer=patch+ --]) | |
1853 | ||
1854 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1855 | ||
1856 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1857 | ADD_VETH(p1, at_ns1, br1, "10.1.1.2/24") | |
1858 | ||
1859 | dnl Allow any traffic from ns0->br1, allow established in reverse. | |
1860 | AT_DATA([flows-br0.txt], [dnl | |
1861 | priority=1,action=drop | |
1862 | priority=10,arp,action=normal | |
1863 | priority=10,icmp,action=normal | |
1864 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(commit,zone=1),1 | |
1865 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(table=0,zone=1) | |
1866 | priority=100,in_port=1,tcp,ct_state=+trk+est,ct_zone=1,action=2 | |
1867 | ]) | |
1868 | ||
1869 | dnl Allow any traffic from br0->ns1, allow established in reverse. | |
1870 | AT_DATA([flows-br1.txt], [dnl | |
1871 | priority=1,action=drop | |
1872 | priority=10,arp,action=normal | |
1873 | priority=10,icmp,action=normal | |
1874 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(table=0,zone=2) | |
1875 | priority=100,in_port=1,tcp,ct_state=+trk+new,ct_zone=2,action=ct(commit,zone=2),2 | |
1876 | priority=100,in_port=1,tcp,ct_state=+trk+est,ct_zone=2,action=2 | |
1877 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0,zone=2) | |
1878 | priority=100,in_port=2,tcp,ct_state=+trk+est,ct_zone=2,action=ct(commit,zone=2),1 | |
1879 | ]) | |
1880 | ||
6cfa8ec3 JR |
1881 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) |
1882 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-br1.txt]) | |
07659514 JS |
1883 | |
1884 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 1885 | OVS_START_L7([at_ns1], [http]) |
07659514 JS |
1886 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1887 | ||
1888 | OVS_TRAFFIC_VSWITCHD_STOP | |
1889 | AT_CLEANUP | |
1890 | ||
1891 | AT_SETUP([conntrack - multiple zones]) | |
1892 | CHECK_CONNTRACK() | |
cf7659b6 | 1893 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
1894 | |
1895 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1896 | ||
1897 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1898 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1899 | ||
1900 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1901 | AT_DATA([flows.txt], [dnl | |
1902 | priority=1,action=drop | |
1903 | priority=10,arp,action=normal | |
1904 | priority=10,icmp,action=normal | |
1905 | priority=100,in_port=1,tcp,action=ct(commit,zone=1),ct(commit,zone=2),2 | |
1906 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=2) | |
1907 | priority=100,in_port=2,ct_state=+trk,ct_zone=2,tcp,action=1 | |
1908 | ]) | |
1909 | ||
6cfa8ec3 | 1910 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
07659514 | 1911 | |
7ed40afe JS |
1912 | OVS_START_L7([at_ns1], [http]) |
1913 | ||
07659514 | 1914 | dnl HTTP requests from p0->p1 should work fine. |
07659514 JS |
1915 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1916 | ||
1917 | dnl (again) HTTP requests from p0->p1 should work fine. | |
1918 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
1919 | ||
ec3aa16c | 1920 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 JR |
1921 | 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>) |
1922 | 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 |
1923 | ]) |
1924 | ||
1925 | OVS_TRAFFIC_VSWITCHD_STOP | |
1926 | AT_CLEANUP | |
1927 | ||
0e27c629 JS |
1928 | AT_SETUP([conntrack - multiple namespaces, internal ports]) |
1929 | CHECK_CONNTRACK() | |
4573c42e | 1930 | CHECK_CONNTRACK_LOCAL_STACK() |
0e27c629 JS |
1931 | OVS_TRAFFIC_VSWITCHD_START( |
1932 | [set-fail-mode br0 secure -- ]) | |
1933 | ||
1934 | ADD_NAMESPACES(at_ns0, at_ns1) | |
1935 | ||
1936 | ADD_INT(p0, at_ns0, br0, "10.1.1.1/24") | |
1937 | ADD_INT(p1, at_ns1, br0, "10.1.1.2/24") | |
1938 | ||
1939 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
1940 | dnl | |
1941 | dnl If skb->nfct is leaking from inside the namespace, this test will fail. | |
1942 | AT_DATA([flows.txt], [dnl | |
1943 | priority=1,action=drop | |
1944 | priority=10,arp,action=normal | |
1945 | priority=10,icmp,action=normal | |
1946 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,zone=1),2 | |
1947 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0,zone=1) | |
1948 | priority=100,in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
1949 | ]) | |
1950 | ||
1951 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
1952 | ||
7ed40afe JS |
1953 | OVS_START_L7([at_ns1], [http]) |
1954 | ||
0e27c629 | 1955 | dnl HTTP requests from p0->p1 should work fine. |
0e27c629 JS |
1956 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
1957 | ||
1958 | dnl (again) HTTP requests from p0->p1 should work fine. | |
1959 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
1960 | ||
ec3aa16c | 1961 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
420c73b2 | 1962 | 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 |
1963 | ]) |
1964 | ||
1965 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
1966 | /ioctl(SIOCGIFINDEX) on .* device failed: No such device/d | |
1967 | /removing policing failed: No such device/d"]) | |
1968 | AT_CLEANUP | |
1969 | ||
8e53fe8c JS |
1970 | AT_SETUP([conntrack - ct_mark]) |
1971 | CHECK_CONNTRACK() | |
cf7659b6 | 1972 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
1973 | |
1974 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
1975 | ||
1976 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
1977 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
1978 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
1979 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
1980 | ||
1981 | dnl Allow traffic between ns0<->ns1 using the ct_mark. | |
1982 | dnl Check that different marks do not match for traffic between ns2<->ns3. | |
1983 | AT_DATA([flows.txt], [dnl | |
1984 | priority=1,action=drop | |
1985 | priority=10,arp,action=normal | |
1986 | priority=10,icmp,action=normal | |
1987 | priority=100,in_port=1,tcp,action=ct(commit,exec(set_field:1->ct_mark)),2 | |
1988 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
1989 | priority=100,in_port=2,ct_state=+trk,ct_mark=1,tcp,action=1 | |
1990 | priority=100,in_port=3,tcp,action=ct(commit,exec(set_field:2->ct_mark)),4 | |
1991 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
1992 | priority=100,in_port=4,ct_state=+trk,ct_mark=1,tcp,action=3 | |
1993 | ]) | |
1994 | ||
6cfa8ec3 | 1995 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
8e53fe8c | 1996 | |
7ed40afe JS |
1997 | OVS_START_L7([at_ns1], [http]) |
1998 | OVS_START_L7([at_ns3], [http]) | |
1999 | ||
8e53fe8c | 2000 | dnl HTTP requests from p0->p1 should work fine. |
8e53fe8c | 2001 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
420c73b2 JR |
2002 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
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>),mark=1,protoinfo=(state=<cleared>) | |
8e53fe8c JS |
2004 | ]) |
2005 | ||
2006 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
2007 | dnl Try 3 times, in 1 second intervals. | |
8e53fe8c | 2008 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
ec3aa16c | 2009 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl |
420c73b2 | 2010 | 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 |
2011 | ]) |
2012 | ||
2013 | OVS_TRAFFIC_VSWITCHD_STOP | |
2014 | AT_CLEANUP | |
2015 | ||
4d182934 JS |
2016 | AT_SETUP([conntrack - ct_mark bit-fiddling]) |
2017 | CHECK_CONNTRACK() | |
2018 | OVS_TRAFFIC_VSWITCHD_START() | |
2019 | ||
2020 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2021 | ||
2022 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2023 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2024 | ||
2025 | dnl Allow traffic between ns0<->ns1 using the ct_mark. Return traffic should | |
2026 | dnl cause an additional bit to be set in the connection (and be allowed). | |
2027 | AT_DATA([flows.txt], [dnl | |
2028 | table=0,priority=1,action=drop | |
2029 | table=0,priority=10,arp,action=normal | |
2030 | table=0,priority=10,icmp,action=normal | |
2031 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
2032 | 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 |
2033 | table=1,in_port=1,ct_state=+new,tcp,action=ct(commit,exec(set_field:0x5/0x5->ct_mark)),2 |
2034 | table=1,in_port=1,ct_state=-new,tcp,action=2 | |
2035 | table=1,in_port=2,ct_state=+trk,ct_mark=3,tcp,action=1 | |
4d182934 JS |
2036 | ]) |
2037 | ||
2038 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2039 | ||
7ed40afe JS |
2040 | OVS_START_L7([at_ns1], [http]) |
2041 | ||
4d182934 | 2042 | dnl HTTP requests from p0->p1 should work fine. |
4d182934 JS |
2043 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2044 | ||
420c73b2 JR |
2045 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2046 | 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 |
2047 | ]) |
2048 | ||
2049 | OVS_TRAFFIC_VSWITCHD_STOP | |
2050 | AT_CLEANUP | |
2051 | ||
8e53fe8c JS |
2052 | AT_SETUP([conntrack - ct_mark from register]) |
2053 | CHECK_CONNTRACK() | |
cf7659b6 | 2054 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
2055 | |
2056 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2057 | ||
2058 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2059 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2060 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
2061 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
2062 | ||
2063 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
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=load:1->NXM_NX_REG0[[0..31]],ct(commit,exec(move:NXM_NX_REG0[[0..31]]->NXM_NX_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=load:2->NXM_NX_REG0[[0..31]],ct(commit,exec(move:NXM_NX_REG0[[0..31]]->NXM_NX_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 | ||
9daf2348 JS |
2097 | AT_SETUP([conntrack - ct_label]) |
2098 | CHECK_CONNTRACK() | |
cf7659b6 | 2099 | OVS_TRAFFIC_VSWITCHD_START() |
9daf2348 JS |
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 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
2106 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
2107 | ||
2108 | dnl Allow traffic between ns0<->ns1 using the ct_label. | |
2109 | dnl Check that different labels do not match for traffic between ns2<->ns3. | |
2110 | AT_DATA([flows.txt], [dnl | |
2111 | priority=1,action=drop | |
2112 | priority=10,arp,action=normal | |
2113 | priority=10,icmp,action=normal | |
2114 | priority=100,in_port=1,tcp,action=ct(commit,exec(set_field:0x0a000d000005000001->ct_label)),2 | |
2115 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
2116 | priority=100,in_port=2,ct_state=+trk,ct_label=0x0a000d000005000001,tcp,action=1 | |
2117 | priority=100,in_port=3,tcp,action=ct(commit,exec(set_field:0x2->ct_label)),4 | |
2118 | priority=100,in_port=4,ct_state=-trk,tcp,action=ct(table=0) | |
2119 | priority=100,in_port=4,ct_state=+trk,ct_label=0x0a000d000005000001,tcp,action=3 | |
2120 | ]) | |
2121 | ||
6cfa8ec3 | 2122 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
9daf2348 | 2123 | |
7ed40afe JS |
2124 | OVS_START_L7([at_ns1], [http]) |
2125 | OVS_START_L7([at_ns3], [http]) | |
2126 | ||
9daf2348 | 2127 | dnl HTTP requests from p0->p1 should work fine. |
9daf2348 JS |
2128 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2129 | ||
2130 | dnl HTTP requests from p2->p3 should fail due to network failure. | |
2131 | dnl Try 3 times, in 1 second intervals. | |
9daf2348 JS |
2132 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4]) |
2133 | ||
2134 | OVS_TRAFFIC_VSWITCHD_STOP | |
2135 | AT_CLEANUP | |
2136 | ||
4d182934 JS |
2137 | AT_SETUP([conntrack - ct_label bit-fiddling]) |
2138 | CHECK_CONNTRACK() | |
2139 | OVS_TRAFFIC_VSWITCHD_START() | |
2140 | ||
2141 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2142 | ||
2143 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2144 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2145 | ||
2146 | dnl Allow traffic between ns0<->ns1 using the ct_labels. Return traffic should | |
2147 | dnl cause an additional bit to be set in the connection labels (and be allowed) | |
2148 | AT_DATA([flows.txt], [dnl | |
2149 | table=0,priority=1,action=drop | |
2150 | table=0,priority=10,arp,action=normal | |
2151 | table=0,priority=10,icmp,action=normal | |
2152 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
2153 | 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 |
2154 | table=1,in_port=1,tcp,ct_state=+new,action=ct(commit,exec(set_field:0x5/0x5->ct_label)),2 |
2155 | table=1,in_port=1,tcp,ct_state=-new,action=2 | |
2156 | table=1,in_port=2,ct_state=+trk,ct_label=0x200000001,tcp,action=1 | |
4d182934 JS |
2157 | ]) |
2158 | ||
2159 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2160 | ||
7ed40afe JS |
2161 | OVS_START_L7([at_ns1], [http]) |
2162 | ||
4d182934 | 2163 | dnl HTTP requests from p0->p1 should work fine. |
4d182934 JS |
2164 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2165 | ||
420c73b2 JR |
2166 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2167 | 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 |
2168 | ]) |
2169 | ||
2170 | OVS_TRAFFIC_VSWITCHD_STOP | |
2171 | AT_CLEANUP | |
2172 | ||
f2d105b5 JS |
2173 | AT_SETUP([conntrack - ct metadata, multiple zones]) |
2174 | CHECK_CONNTRACK() | |
2175 | OVS_TRAFFIC_VSWITCHD_START() | |
2176 | ||
2177 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
2178 | ||
2179 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2180 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2181 | ||
2182 | dnl Allow traffic between ns0<->ns1 using the ct_mark and ct_labels in zone=1, | |
2183 | dnl but do *not* set any of these for the ct() in zone=2. Traffic should pass, | |
2184 | dnl and we should see that the conntrack entries only apply the ct_mark and | |
2185 | dnl ct_labels to the connection in zone=1. | |
2186 | AT_DATA([flows.txt], [dnl | |
2187 | table=0,priority=1,action=drop | |
2188 | table=0,priority=10,arp,action=normal | |
2189 | table=0,priority=10,icmp,action=normal | |
2190 | table=0,priority=100,in_port=1,tcp,action=ct(zone=1,table=1) | |
2191 | 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 |
2192 | 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 |
2193 | table=1,in_port=1,tcp,ct_state=-new,action=ct(zone=2),2 | |
2194 | table=1,in_port=2,tcp,action=ct(zone=2),1 | |
f2d105b5 JS |
2195 | ]) |
2196 | ||
2197 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2198 | ||
7ed40afe JS |
2199 | OVS_START_L7([at_ns1], [http]) |
2200 | ||
f2d105b5 | 2201 | dnl HTTP requests from p0->p1 should work fine. |
f2d105b5 JS |
2202 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) |
2203 | ||
420c73b2 JR |
2204 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
2205 | 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>) | |
2206 | 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 |
2207 | ]) |
2208 | ||
2209 | OVS_TRAFFIC_VSWITCHD_STOP | |
2210 | AT_CLEANUP | |
2211 | ||
8e53fe8c | 2212 | AT_SETUP([conntrack - ICMP related]) |
9c1ab985 | 2213 | AT_SKIP_IF([test $HAVE_NC = no]) |
8e53fe8c | 2214 | CHECK_CONNTRACK() |
cf7659b6 | 2215 | OVS_TRAFFIC_VSWITCHD_START() |
8e53fe8c JS |
2216 | |
2217 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2218 | ||
2219 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2220 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2221 | ||
2222 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
2223 | AT_DATA([flows.txt], [dnl | |
2224 | priority=1,action=drop | |
2225 | priority=10,arp,action=normal | |
2226 | priority=100,in_port=1,udp,action=ct(commit,exec(set_field:1->ct_mark)),2 | |
2227 | priority=100,in_port=2,icmp,ct_state=-trk,action=ct(table=0) | |
2228 | priority=100,in_port=2,icmp,ct_state=+trk+rel,ct_mark=1,action=1 | |
2229 | ]) | |
2230 | ||
6cfa8ec3 | 2231 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
8e53fe8c | 2232 | |
bde2e7b5 | 2233 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. |
b54971f7 | 2234 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc $NC_EOF_OPT -u 10.1.1.2 10000"]) |
8e53fe8c JS |
2235 | |
2236 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2237 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
2238 | n_packets=1, n_bytes=44, priority=100,udp,in_port=1 actions=ct(commit,exec(load:0x1->NXM_NX_CT_MARK[[]])),output:2 | |
2239 | n_packets=1, n_bytes=72, priority=100,ct_state=+rel+trk,ct_mark=0x1,icmp,in_port=2 actions=output:1 | |
2240 | n_packets=1, n_bytes=72, priority=100,ct_state=-trk,icmp,in_port=2 actions=ct(table=0) | |
bde2e7b5 | 2241 | n_packets=2, n_bytes=84, priority=10,arp actions=NORMAL |
8e53fe8c JS |
2242 | NXST_FLOW reply: |
2243 | ]) | |
2244 | ||
2245 | OVS_TRAFFIC_VSWITCHD_STOP | |
2246 | AT_CLEANUP | |
2247 | ||
d0e42062 JR |
2248 | AT_SETUP([conntrack - ICMP related to original direction]) |
2249 | AT_SKIP_IF([test $HAVE_NC = no]) | |
2250 | CHECK_CONNTRACK() | |
2251 | OVS_TRAFFIC_VSWITCHD_START() | |
2252 | ||
2253 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2254 | ||
2255 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2256 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2257 | ||
2258 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
2259 | AT_DATA([flows.txt], [dnl | |
2260 | priority=1000,arp,action=normal | |
2261 | priority=100,ip,action=ct(table=1) | |
2262 | priority=1,action=drop | |
2263 | table=1,ip,action=ct(zone=34673,table=2) | |
2264 | table=2,in_port=2,udp,action=ct(commit,zone=34673),1 | |
2265 | table=2,in_port=1,udp,action=ct(commit,zone=34673),2 | |
2266 | table=2,in_port=2,ct_state=+rel,icmp,action=1 | |
2267 | ]) | |
2268 | ||
2269 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2270 | ||
2271 | dnl 1. Send and UDP packet to port 53 (src=192.100.1.8,dst=192.100.2.5) | |
2272 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '00010200020400232211223308004500001c000100004011f6fac0640108c06402050035003500087b9e']) | |
2273 | ||
2274 | dnl 2. Send and UDP packet to port 53 (src=192.100.2.5,dst=192.100.1.8) | |
2275 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 resubmit\(,0\) '00232211223300010200020408004500001c000100004011f6fac0640205c06401080035003500087b9e']) | |
2276 | ||
2277 | dnl 3. Send an ICMP port unreach reply for port 53, related to the 2nd | |
2278 | dnl packet, but in the original direction of the conntrack entry created | |
2279 | dnl for the 1st packet. | |
2280 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '000102000204002322112233080045000038000100003f01f7eec0640108c0640205030a80e5ffffffff4500001c000100003f11f7fac0640205c06401080035003500087b9e']) | |
2281 | ||
2282 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2283 | ||
2284 | dnl 4. Repeat 3. | |
2285 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) '000102000204002322112233080045000038000100003f01f7eec0640108c0640205030a80e5ffffffff4500001c000100003f11f7fac0640205c06401080035003500087b9e']) | |
2286 | ||
2287 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
2288 | ||
2289 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
2290 | n_packets=4, n_bytes=224, priority=100,ip actions=ct(table=1) | |
2291 | priority=1000,arp actions=NORMAL | |
2292 | table=1, n_packets=4, n_bytes=224, ip actions=ct(table=2,zone=34673) | |
2293 | table=2, n_packets=1, n_bytes=42, udp,in_port=1 actions=ct(commit,zone=34673),output:2 | |
2294 | table=2, n_packets=1, n_bytes=42, udp,in_port=2 actions=ct(commit,zone=34673),output:1 | |
2295 | table=2, n_packets=2, n_bytes=140, ct_state=+rel,icmp,in_port=2 actions=output:1 | |
2296 | NXST_FLOW reply: | |
2297 | ]) | |
2298 | ||
2299 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(192.100.1.8)], [0], [dnl | |
2300 | 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 | |
2301 | ]) | |
2302 | ||
2303 | OVS_TRAFFIC_VSWITCHD_STOP | |
2304 | AT_CLEANUP | |
2305 | ||
07659514 JS |
2306 | AT_SETUP([conntrack - ICMP related 2]) |
2307 | CHECK_CONNTRACK() | |
cf7659b6 | 2308 | OVS_TRAFFIC_VSWITCHD_START() |
07659514 JS |
2309 | |
2310 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2311 | ||
2312 | ADD_VETH(p0, at_ns0, br0, "172.16.0.1/24") | |
2313 | ADD_VETH(p1, at_ns1, br0, "172.16.0.2/24") | |
2314 | ||
2315 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
2316 | AT_DATA([flows.txt], [dnl | |
5c2e106b DDP |
2317 | table=0,ip,action=ct(commit,table=1) |
2318 | table=1,ip,action=controller | |
07659514 JS |
2319 | ]) |
2320 | ||
6cfa8ec3 | 2321 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows.txt]) |
07659514 JS |
2322 | |
2323 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
2324 | AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log]) | |
2325 | ||
2326 | dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request | |
5c2e106b | 2327 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303da490000000045000021317040004011b138ac100003ac10000411112222000d20966369616f0a']) |
07659514 JS |
2328 | |
2329 | dnl 2. Send and UDP packet to port 5555 | |
5c2e106b | 2330 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 resubmit\(,0\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a']) |
07659514 | 2331 | |
a81da080 DB |
2332 | dnl 3. Send an ICMP port unreach reply from a path midpoint for port 5555, related to the first packet |
2333 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 resubmit\(,0\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f354ac100003ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a']) | |
07659514 | 2334 | |
e8833217 DM |
2335 | OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) |
2336 | ||
07659514 | 2337 | dnl Check this output. We only see the latter two packets, not the first. |
c2fcc6fc | 2338 | AT_CHECK([cat ofctl_monitor.log | grep -v ff02 | grep -v fe80 | grep -v no_match], [0], [dnl |
45e46e92 | 2339 | 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 | 2340 | 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 | 2341 | 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 | 2342 | 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 | 2343 | 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 | 2344 | 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 |
2345 | ]) |
2346 | ||
5c2e106b DDP |
2347 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(172.16.0.1)], [0], [dnl |
2348 | 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>) | |
2349 | ]) | |
2350 | ||
2351 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(172.16.0.3)], [0], [dnl | |
2352 | ]) | |
2353 | ||
07659514 JS |
2354 | OVS_TRAFFIC_VSWITCHD_STOP |
2355 | AT_CLEANUP | |
d787ad39 | 2356 | |
daf4d3c1 | 2357 | AT_SETUP([conntrack - IPv4 fragmentation]) |
d787ad39 | 2358 | CHECK_CONNTRACK() |
cf7659b6 | 2359 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2360 | |
2361 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2362 | ||
2363 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2364 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2365 | ||
2366 | dnl Sending ping through conntrack | |
2367 | AT_DATA([flows.txt], [dnl | |
2368 | priority=1,action=drop | |
2369 | priority=10,arp,action=normal | |
2370 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2371 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2372 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2373 | ]) | |
2374 | ||
6cfa8ec3 | 2375 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2376 | |
4ea96698 DB |
2377 | dnl Modify userspace conntrack fragmentation handling. |
2378 | DPCTL_MODIFY_FRAGMENTATION() | |
2379 | ||
27130224 AZ |
2380 | dnl Ipv4 fragmentation connectivity check. |
2381 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2382 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2383 | ]) | |
2384 | ||
2385 | dnl Ipv4 larger fragmentation connectivity check. | |
2386 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2387 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2388 | ]) | |
2389 | ||
4ea96698 DB |
2390 | dnl Check userspace conntrack fragmentation counters. |
2391 | DPCTL_CHECK_FRAGMENTATION_PASS() | |
2392 | ||
27130224 AZ |
2393 | OVS_TRAFFIC_VSWITCHD_STOP |
2394 | AT_CLEANUP | |
2395 | ||
0cf28088 JS |
2396 | AT_SETUP([conntrack - IPv4 fragmentation expiry]) |
2397 | CHECK_CONNTRACK() | |
2398 | OVS_TRAFFIC_VSWITCHD_START() | |
2399 | ||
2400 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2401 | ||
2402 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2403 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2404 | ||
2405 | AT_DATA([flows.txt], [dnl | |
2406 | priority=1,action=drop | |
2407 | priority=10,arp,action=normal | |
2408 | ||
2409 | dnl Only allow non-fragmented messages and 1st fragments of each message | |
2410 | priority=100,in_port=1,icmp,ip_frag=no,action=ct(commit,zone=9),2 | |
2411 | priority=100,in_port=1,icmp,ip_frag=firstaction=ct(commit,zone=9),2 | |
2412 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2413 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2414 | ]) | |
2415 | ||
2416 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2417 | ||
4ea96698 DB |
2418 | dnl Modify userspace conntrack fragmentation handling. |
2419 | DPCTL_MODIFY_FRAGMENTATION() | |
2420 | ||
0cf28088 JS |
2421 | dnl Ipv4 fragmentation connectivity check. |
2422 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 1 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
2423 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
2424 | ]) | |
2425 | ||
4ea96698 DB |
2426 | dnl Check userspace conntrack fragmentation counters. |
2427 | DPCTL_CHECK_FRAGMENTATION_FAIL() | |
2428 | ||
0cf28088 JS |
2429 | OVS_TRAFFIC_VSWITCHD_STOP |
2430 | AT_CLEANUP | |
2431 | ||
27130224 AZ |
2432 | AT_SETUP([conntrack - IPv4 fragmentation + vlan]) |
2433 | CHECK_CONNTRACK() | |
cf7659b6 | 2434 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2435 | |
2436 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2437 | ||
2438 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2439 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2440 | ADD_VLAN(p0, at_ns0, 100, "10.2.2.1/24") | |
2441 | ADD_VLAN(p1, at_ns1, 100, "10.2.2.2/24") | |
2442 | ||
2443 | dnl Sending ping through conntrack | |
2444 | AT_DATA([flows.txt], [dnl | |
2445 | priority=1,action=drop | |
2446 | priority=10,arp,action=normal | |
2447 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2448 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2449 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2450 | ]) | |
2451 | ||
6cfa8ec3 | 2452 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2453 | |
4ea96698 DB |
2454 | dnl Modify userspace conntrack fragmentation handling. |
2455 | DPCTL_MODIFY_FRAGMENTATION() | |
2456 | ||
27130224 AZ |
2457 | dnl Ipv4 fragmentation connectivity check. |
2458 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2459 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2460 | ]) | |
2461 | ||
2462 | dnl Ipv4 larger fragmentation connectivity check. | |
2463 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2464 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2465 | ]) | |
2466 | ||
4ea96698 DB |
2467 | dnl Check userspace conntrack fragmentation counters. |
2468 | DPCTL_CHECK_FRAGMENTATION_PASS() | |
2469 | ||
27130224 AZ |
2470 | OVS_TRAFFIC_VSWITCHD_STOP |
2471 | AT_CLEANUP | |
2472 | ||
2526a3dc EG |
2473 | AT_SETUP([conntrack - IPv4 fragmentation + cvlan]) |
2474 | CHECK_CONNTRACK() | |
2526a3dc EG |
2475 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) |
2476 | OVS_CHECK_8021AD() | |
2477 | ||
2478 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2479 | ||
2480 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2481 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2482 | ||
2483 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
2484 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
2485 | ||
2486 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
2487 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
2488 | ||
2489 | dnl Sending ping through conntrack | |
2490 | AT_DATA([flows.txt], [dnl | |
2491 | priority=1,action=drop | |
2492 | priority=10,arp,action=normal | |
2493 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),2 | |
2494 | priority=100,in_port=2,ct_state=-trk,icmp,action=ct(table=0,zone=9) | |
2495 | priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1 | |
2496 | ]) | |
2497 | ||
2498 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2499 | ||
2500 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
2501 | ||
2502 | dnl Ipv4 fragmentation connectivity check. | |
2503 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2504 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2505 | ]) | |
2506 | ||
2507 | dnl Ipv4 fragmentation connectivity check. (outer svlan) | |
2508 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.255.2.2 | FORMAT_PING], [0], [dnl | |
2509 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2510 | ]) | |
2511 | ||
2512 | dnl Ipv4 larger fragmentation connectivity check. | |
2513 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
2514 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2515 | ]) | |
2516 | ||
2517 | dnl Ipv4 larger fragmentation connectivity check. (outer svlan) | |
2518 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.255.2.2 | FORMAT_PING], [0], [dnl | |
2519 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2520 | ]) | |
2521 | ||
2522 | OVS_TRAFFIC_VSWITCHD_STOP | |
2523 | AT_CLEANUP | |
2524 | ||
e917d3ee DB |
2525 | AT_SETUP([conntrack - IPv4 fragmentation incomplete reassembled packet]) |
2526 | CHECK_CONNTRACK() | |
2527 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 DB |
2528 | DPCTL_SET_MIN_FRAG_SIZE() |
2529 | ||
e917d3ee DB |
2530 | |
2531 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2532 | ||
2533 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2534 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2535 | ||
2536 | AT_DATA([bundle.txt], [dnl | |
2537 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2538 | ]) | |
2539 | ||
2540 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2541 | ||
2542 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2543 | ]) | |
2544 | ||
2545 | OVS_TRAFFIC_VSWITCHD_STOP | |
2546 | AT_CLEANUP | |
2547 | ||
2548 | dnl Uses same first fragment as above 'incomplete reassembled packet' test. | |
2549 | AT_SETUP([conntrack - IPv4 fragmentation with fragments specified]) | |
2550 | CHECK_CONNTRACK() | |
e917d3ee | 2551 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2552 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2553 | |
2554 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2555 | ||
2556 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2557 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2558 | ||
2559 | AT_DATA([bundle.txt], [dnl | |
2560 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2561 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100320011a4860a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2562 | ]) | |
2563 | ||
2564 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2565 | ||
2566 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2567 | 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>) | |
2568 | ]) | |
2569 | ||
2570 | OVS_TRAFFIC_VSWITCHD_STOP | |
2571 | AT_CLEANUP | |
2572 | ||
b21ac618 DB |
2573 | AT_SETUP([conntrack - IPv4 fragmentation out of order]) |
2574 | CHECK_CONNTRACK() | |
b21ac618 | 2575 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2576 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2577 | |
2578 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2579 | ||
2580 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2581 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2582 | ||
2583 | AT_DATA([bundle.txt], [dnl | |
2584 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100320011a4860a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2585 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2586 | ]) | |
2587 | ||
2588 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2589 | ||
2590 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2591 | 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>) | |
2592 | ]) | |
2593 | ||
2594 | OVS_TRAFFIC_VSWITCHD_STOP | |
2595 | AT_CLEANUP | |
2596 | ||
2597 | AT_SETUP([conntrack - IPv4 fragmentation overlapping fragments by 1 octet]) | |
2598 | CHECK_CONNTRACK() | |
b21ac618 DB |
2599 | CHECK_CONNTRACK_FRAG_OVERLAP() |
2600 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2601 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2602 | |
2603 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2604 | ||
2605 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2606 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2607 | ||
2608 | AT_DATA([bundle.txt], [dnl | |
2609 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2610 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100310011a4870a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2611 | ]) | |
2612 | ||
2613 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2614 | # There is one byte of overlap, hence the no packet gets thru. conntrack. | |
2615 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2616 | ]) | |
2617 | ||
2618 | OVS_TRAFFIC_VSWITCHD_STOP | |
2619 | AT_CLEANUP | |
2620 | ||
2621 | AT_SETUP([conntrack - IPv4 fragmentation overlapping fragments by 1 octet out of order]) | |
2622 | CHECK_CONNTRACK() | |
b21ac618 DB |
2623 | CHECK_CONNTRACK_FRAG_OVERLAP() |
2624 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2625 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2626 | |
2627 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2628 | ||
2629 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
2630 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
2631 | ||
2632 | AT_DATA([bundle.txt], [dnl | |
2633 | packet-out in_port=1, packet=50540000000a505400000009080045000030000100310011a4870a0101010a01010200010002000800000010203040506070809000010203040506070809, actions=ct(commit) | |
2634 | packet-out in_port=1, packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2635 | ]) | |
2636 | ||
2637 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2638 | # There is one byte of overlap, hence the no packet gets thru. conntrack. | |
2639 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
2640 | ]) | |
2641 | ||
2642 | OVS_TRAFFIC_VSWITCHD_STOP | |
2643 | AT_CLEANUP | |
2644 | ||
27130224 AZ |
2645 | AT_SETUP([conntrack - IPv6 fragmentation]) |
2646 | CHECK_CONNTRACK() | |
cf7659b6 | 2647 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2648 | |
2649 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2650 | ||
2651 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2652 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2653 | ||
2654 | dnl Sending ping through conntrack | |
2655 | AT_DATA([flows.txt], [dnl | |
2656 | priority=1,action=drop | |
2657 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2658 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2659 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2660 | priority=100,icmp6,icmp_type=135,action=normal | |
2661 | priority=100,icmp6,icmp_type=136,action=normal | |
2662 | ]) | |
2663 | ||
6cfa8ec3 | 2664 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2665 | |
c10840ff JS |
2666 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2667 | dnl waiting, we get occasional failures due to the following error: | |
27130224 | 2668 | dnl "connect: Cannot assign requested address" |
c10840ff | 2669 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
27130224 | 2670 | |
221a2668 | 2671 | dnl Ipv6 fragmentation connectivity check. |
27130224 AZ |
2672 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
2673 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2674 | ]) | |
2675 | ||
221a2668 | 2676 | dnl Ipv6 larger fragmentation connectivity check. |
27130224 AZ |
2677 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl |
2678 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2679 | ]) | |
2680 | ||
2681 | OVS_TRAFFIC_VSWITCHD_STOP | |
2682 | AT_CLEANUP | |
2683 | ||
0cf28088 JS |
2684 | AT_SETUP([conntrack - IPv6 fragmentation expiry]) |
2685 | CHECK_CONNTRACK() | |
2686 | OVS_TRAFFIC_VSWITCHD_START() | |
2687 | ||
2688 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2689 | ||
2690 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2691 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2692 | ||
2693 | AT_DATA([flows.txt], [dnl | |
2694 | priority=1,action=drop | |
2695 | ||
2696 | dnl Only allow non-fragmented messages and 1st fragments of each message | |
2697 | priority=10,in_port=1,ipv6,ip_frag=first,action=ct(commit,zone=9),2 | |
2698 | priority=10,in_port=1,ipv6,ip_frag=no,action=ct(commit,zone=9),2 | |
2699 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2700 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2701 | ||
2702 | dnl Neighbour Discovery | |
2703 | priority=100,icmp6,icmp_type=135,action=normal | |
2704 | priority=100,icmp6,icmp_type=136,action=normal | |
2705 | ]) | |
2706 | ||
2707 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2708 | ||
c10840ff JS |
2709 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2710 | dnl waiting, we get occasional failures due to the following error: | |
0cf28088 | 2711 | dnl "connect: Cannot assign requested address" |
c10840ff | 2712 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
0cf28088 | 2713 | |
0cf28088 JS |
2714 | dnl Send an IPv6 fragment. Some time later, it should expire. |
2715 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 1 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
2716 | 7 packets transmitted, 0 received, 100% packet loss, time 0ms | |
2717 | ]) | |
2718 | ||
2719 | dnl At this point, the kernel will either crash or everything is OK. | |
2720 | ||
2721 | OVS_TRAFFIC_VSWITCHD_STOP | |
2722 | AT_CLEANUP | |
2723 | ||
27130224 AZ |
2724 | AT_SETUP([conntrack - IPv6 fragmentation + vlan]) |
2725 | CHECK_CONNTRACK() | |
cf7659b6 | 2726 | OVS_TRAFFIC_VSWITCHD_START() |
27130224 AZ |
2727 | |
2728 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2729 | ||
2730 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2731 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2732 | ||
2733 | ADD_VLAN(p0, at_ns0, 100, "fc00:1::3/96") | |
2734 | ADD_VLAN(p1, at_ns1, 100, "fc00:1::4/96") | |
2735 | ||
2736 | dnl Sending ping through conntrack | |
2737 | AT_DATA([flows.txt], [dnl | |
2738 | priority=1,action=drop | |
2739 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2740 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2741 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2742 | priority=100,icmp6,icmp_type=135,action=normal | |
2743 | priority=100,icmp6,icmp_type=136,action=normal | |
2744 | ]) | |
2745 | ||
6cfa8ec3 | 2746 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 | 2747 | |
c10840ff JS |
2748 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
2749 | dnl waiting, we get occasional failures due to the following error: | |
27130224 | 2750 | dnl "connect: Cannot assign requested address" |
c10840ff | 2751 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
27130224 | 2752 | |
27130224 AZ |
2753 | dnl Ipv4 fragmentation connectivity check. |
2754 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2755 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2756 | ]) | |
2757 | ||
2758 | dnl Ipv4 larger fragmentation connectivity check. | |
2759 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2760 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2761 | ]) | |
2762 | ||
2763 | OVS_TRAFFIC_VSWITCHD_STOP | |
2764 | AT_CLEANUP | |
2765 | ||
2526a3dc EG |
2766 | AT_SETUP([conntrack - IPv6 fragmentation + cvlan]) |
2767 | CHECK_CONNTRACK() | |
2526a3dc EG |
2768 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) |
2769 | OVS_CHECK_8021AD() | |
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 | ADD_SVLAN(p0, at_ns0, 4094, "fc00:ffff::3/96") | |
2777 | ADD_SVLAN(p1, at_ns1, 4094, "fc00:ffff::4/96") | |
2778 | ||
2779 | ADD_CVLAN(p0.4094, at_ns0, 100, "fc00:1::3/96") | |
2780 | ADD_CVLAN(p1.4094, at_ns1, 100, "fc00:1::4/96") | |
2781 | ||
2782 | dnl Sending ping through conntrack | |
2783 | AT_DATA([flows.txt], [dnl | |
2784 | priority=1,action=drop | |
2785 | priority=10,in_port=1,ipv6,action=ct(commit,zone=9),2 | |
2786 | priority=10,in_port=2,ct_state=-trk,ipv6,action=ct(table=0,zone=9) | |
2787 | priority=10,in_port=2,ct_state=+trk+est-new,ipv6,action=1 | |
2788 | priority=100,icmp6,icmp_type=135,action=normal | |
2789 | priority=100,icmp6,icmp_type=136,action=normal | |
2790 | ]) | |
2791 | ||
2792 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
2793 | ||
2794 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::4]) | |
2795 | ||
2796 | dnl Ipv6 fragmentation connectivity check. | |
2797 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2798 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2799 | ]) | |
2800 | ||
2801 | dnl Ipv6 fragmentation connectivity check. (outer svlan) | |
2802 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:ffff::4 | FORMAT_PING], [0], [dnl | |
2803 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2804 | ]) | |
2805 | ||
2806 | dnl Ipv6 larger fragmentation connectivity check. | |
2807 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl | |
2808 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2809 | ]) | |
2810 | ||
2811 | dnl Ipv6 larger fragmentation connectivity check. (outer svlan) | |
2812 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:ffff::4 | FORMAT_PING], [0], [dnl | |
2813 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
2814 | ]) | |
2815 | ||
2816 | OVS_TRAFFIC_VSWITCHD_STOP | |
2817 | AT_CLEANUP | |
2818 | ||
e917d3ee DB |
2819 | AT_SETUP([conntrack - IPv6 fragmentation incomplete reassembled packet]) |
2820 | CHECK_CONNTRACK() | |
2821 | OVS_TRAFFIC_VSWITCHD_START() | |
4ea96698 | 2822 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2823 | |
2824 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2825 | ||
2826 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2827 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2828 | ||
2829 | AT_DATA([bundle.txt], [dnl | |
2830 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000001a02cfffc000000000000000000000000000001fc0000000000000000000000000000021100000100000001000100020008f62900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2831 | ]) | |
2832 | ||
2833 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2834 | ||
2835 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2836 | ]) | |
2837 | ||
2838 | OVS_TRAFFIC_VSWITCHD_STOP | |
2839 | AT_CLEANUP | |
2840 | ||
2841 | AT_SETUP([conntrack - IPv6 fragmentation with fragments specified]) | |
2842 | CHECK_CONNTRACK() | |
e917d3ee | 2843 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2844 | DPCTL_SET_MIN_FRAG_SIZE() |
e917d3ee DB |
2845 | |
2846 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2847 | ||
2848 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2849 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2850 | ||
2851 | AT_DATA([bundle.txt], [dnl | |
2852 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000001a02cfffc000000000000000000000000000001fc0000000000000000000000000000021100000100000001000100020008ba0200010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2853 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000000242cfffc000000000000000000000000000001fc000000000000000000000000000002110001980000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
2854 | ]) | |
2855 | ||
2856 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2857 | ||
2858 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2859 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2860 | ]) | |
2861 | ||
2862 | OVS_TRAFFIC_VSWITCHD_STOP | |
2863 | AT_CLEANUP | |
2864 | ||
b21ac618 DB |
2865 | AT_SETUP([conntrack - IPv6 fragmentation out of order]) |
2866 | CHECK_CONNTRACK() | |
b21ac618 | 2867 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2868 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2869 | |
2870 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2871 | ||
2872 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2873 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2874 | ||
2875 | AT_DATA([bundle.txt], [dnl | |
2876 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000000242cfffc000000000000000000000000000001fc000000000000000000000000000002110001980000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
2877 | packet-out in_port=1, packet=50540000000a50540000000986dd6000000001a02cfffc000000000000000000000000000001fc0000000000000000000000000000021100000100000001000100020008ba0200010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809, actions=ct(commit) | |
2878 | ]) | |
2879 | ||
2880 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2881 | ||
2882 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2883 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2884 | ]) | |
2885 | ||
2886 | OVS_TRAFFIC_VSWITCHD_STOP | |
2887 | AT_CLEANUP | |
2888 | ||
2889 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers]) | |
2890 | CHECK_CONNTRACK() | |
b21ac618 | 2891 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2892 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2893 | |
2894 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2895 | ||
2896 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2897 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2898 | ||
2899 | # Add different extension headers | |
2900 | AT_DATA([bundle.txt], [dnl | |
1630b26f | 2901 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000019800fffc000000000000000000000000000001fc0000000000000000000000000000022c000000000000001100000100000001000100020008e04000010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607, actions=ct(commit) |
b21ac618 DB |
2902 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000000000000110001880000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) |
2903 | ]) | |
2904 | ||
2905 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2906 | ||
2907 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2908 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2909 | ]) | |
2910 | ||
2911 | OVS_TRAFFIC_VSWITCHD_STOP | |
2912 | AT_CLEANUP | |
2913 | ||
2914 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers + out of order]) | |
2915 | CHECK_CONNTRACK() | |
b21ac618 | 2916 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2917 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2918 | |
2919 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2920 | ||
2921 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2922 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2923 | ||
2924 | # Add different extension headers | |
2925 | AT_DATA([bundle.txt], [dnl | |
2926 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000000000000110001880000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
1630b26f | 2927 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000019800fffc000000000000000000000000000001fc0000000000000000000000000000022c000000000000001100000100000001000100020008e04000010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607, actions=ct(commit) |
b21ac618 DB |
2928 | ]) |
2929 | ||
2930 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2931 | ||
2932 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2933 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2934 | ]) | |
2935 | ||
2936 | OVS_TRAFFIC_VSWITCHD_STOP | |
2937 | AT_CLEANUP | |
2938 | ||
2939 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers 2]) | |
2940 | CHECK_CONNTRACK() | |
b21ac618 | 2941 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2942 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2943 | |
2944 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2945 | ||
2946 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2947 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2948 | ||
2949 | # Add different extension headers | |
2950 | AT_DATA([bundle.txt], [dnl | |
1630b26f | 2951 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000019800fffc000000000000000000000000000001fc0000000000000000000000000000022c000000050200001100000100000001000100020008e04000010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607, actions=ct(commit) |
b21ac618 DB |
2952 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000005020000110001880000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) |
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 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2959 | ]) | |
2960 | ||
2961 | OVS_TRAFFIC_VSWITCHD_STOP | |
2962 | AT_CLEANUP | |
2963 | ||
2964 | AT_SETUP([conntrack - IPv6 fragmentation, multiple extension headers 2 + out of order]) | |
2965 | CHECK_CONNTRACK() | |
b21ac618 | 2966 | OVS_TRAFFIC_VSWITCHD_START() |
4ea96698 | 2967 | DPCTL_SET_MIN_FRAG_SIZE() |
b21ac618 DB |
2968 | |
2969 | ADD_NAMESPACES(at_ns0, at_ns1) | |
2970 | ||
2971 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
2972 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
2973 | ||
2974 | # Add different extension headers | |
2975 | AT_DATA([bundle.txt], [dnl | |
2976 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000002c00fffc000000000000000000000000000001fc0000000000000000000000000000022c00000005020000110001880000000100010002000800000001020304050607080900010203040506070809, actions=ct(commit) | |
1630b26f | 2977 | packet-out in_port=1, packet=50540000000a50540000000986dd60000000019800fffc000000000000000000000000000001fc0000000000000000000000000000022c000000050200001100000100000001000100020008e04000010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607, actions=ct(commit) |
b21ac618 DB |
2978 | ]) |
2979 | ||
2980 | AT_CHECK([ovs-ofctl bundle br0 bundle.txt]) | |
2981 | ||
2982 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
2983 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>) | |
2984 | ]) | |
2985 | ||
2986 | OVS_TRAFFIC_VSWITCHD_STOP | |
2987 | AT_CLEANUP | |
2988 | ||
27130224 | 2989 | AT_SETUP([conntrack - Fragmentation over vxlan]) |
dfb21e96 | 2990 | OVS_CHECK_VXLAN() |
27130224 | 2991 | CHECK_CONNTRACK() |
c6fb6677 | 2992 | CHECK_CONNTRACK_LOCAL_STACK() |
27130224 | 2993 | |
cf7659b6 JR |
2994 | OVS_TRAFFIC_VSWITCHD_START() |
2995 | ADD_BR([br-underlay]) | |
2996 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
2997 | ||
27130224 AZ |
2998 | ADD_NAMESPACES(at_ns0) |
2999 | ||
3000 | dnl Sending ping through conntrack | |
3001 | AT_DATA([flows.txt], [dnl | |
3002 | priority=1,action=drop | |
3003 | priority=10,arp,action=normal | |
3004 | priority=100,in_port=1,icmp,action=ct(commit,zone=9),LOCAL | |
3a9eb803 | 3005 | priority=100,in_port=LOCAL,icmp,action=ct(table=1,zone=9) |
723af132 | 3006 | table=1,in_port=LOCAL,ct_state=+trk+est,icmp,action=1 |
27130224 AZ |
3007 | ]) |
3008 | ||
6cfa8ec3 | 3009 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
27130224 AZ |
3010 | |
3011 | dnl Set up underlay link from host into the namespace using veth pair. | |
3012 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
3013 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
3014 | AT_CHECK([ip link set dev br-underlay up]) | |
3015 | ||
3016 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
3017 | dnl linux device inside the namespace. | |
6e3a764c | 3018 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], [10.1.1.100/24]) |
27130224 AZ |
3019 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24], |
3020 | [id 0 dstport 4789]) | |
3021 | ||
3022 | dnl First, check the underlay | |
3023 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
3024 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3025 | ]) | |
3026 | ||
3027 | dnl Okay, now check the overlay with different packet sizes | |
3028 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3029 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3030 | ]) | |
3031 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3032 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3033 | ]) | |
3034 | NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PING], [0], [dnl | |
3035 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3036 | ]) | |
3037 | ||
3038 | OVS_TRAFFIC_VSWITCHD_STOP | |
3039 | AT_CLEANUP | |
c4e34c61 | 3040 | |
84f646df | 3041 | AT_SETUP([conntrack - IPv6 Fragmentation over vxlan]) |
a9f70f3d | 3042 | OVS_CHECK_VXLAN() |
84f646df | 3043 | CHECK_CONNTRACK() |
c6fb6677 | 3044 | CHECK_CONNTRACK_LOCAL_STACK() |
84f646df JS |
3045 | |
3046 | OVS_TRAFFIC_VSWITCHD_START() | |
3047 | ADD_BR([br-underlay]) | |
3048 | AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) | |
3049 | ||
3050 | ADD_NAMESPACES(at_ns0) | |
3051 | ||
3052 | dnl Sending ping through conntrack | |
3053 | AT_DATA([flows.txt], [dnl | |
3054 | priority=1,action=drop | |
3055 | priority=100,in_port=1,ipv6,action=ct(commit,zone=9),LOCAL | |
3056 | priority=100,in_port=LOCAL,ipv6,action=ct(table=1,zone=9) | |
723af132 | 3057 | table=1,in_port=LOCAL,ct_state=+trk+est,ipv6,action=1 |
84f646df JS |
3058 | |
3059 | dnl Neighbour Discovery | |
3060 | priority=1000,icmp6,icmp_type=135,action=normal | |
3061 | priority=1000,icmp6,icmp_type=136,action=normal | |
3062 | ]) | |
3063 | ||
3064 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3065 | ||
3066 | dnl Set up underlay link from host into the namespace using veth pair. | |
3067 | ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24") | |
3068 | AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) | |
3069 | AT_CHECK([ip link set dev br-underlay up]) | |
3070 | ||
3071 | dnl Set up tunnel endpoints on OVS outside the namespace and with a native | |
3072 | dnl linux device inside the namespace. | |
6e3a764c | 3073 | ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], ["fc00::2/96"]) |
84f646df JS |
3074 | ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], ["fc00::1/96"], |
3075 | [id 0 dstport 4789]) | |
3076 | ||
c10840ff JS |
3077 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
3078 | dnl waiting, we get occasional failures due to the following error: | |
84f646df | 3079 | dnl "connect: Cannot assign requested address" |
c10840ff | 3080 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
84f646df JS |
3081 | |
3082 | dnl First, check the underlay | |
3083 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl | |
3084 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3085 | ]) | |
3086 | ||
3087 | dnl Okay, now check the overlay with different packet sizes | |
3088 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3089 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3090 | ]) | |
3091 | NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3092 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3093 | ]) | |
3094 | NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl | |
3095 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3096 | ]) | |
3097 | ||
3098 | OVS_TRAFFIC_VSWITCHD_STOP | |
3099 | AT_CLEANUP | |
9ac0aada | 3100 | |
c4e34c61 RB |
3101 | AT_SETUP([conntrack - resubmit to ct multiple times]) |
3102 | CHECK_CONNTRACK() | |
3103 | ||
3104 | OVS_TRAFFIC_VSWITCHD_START( | |
3105 | [set-fail-mode br0 secure -- ]) | |
3106 | ||
3107 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3108 | ||
3109 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3110 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3111 | ||
3112 | AT_DATA([flows.txt], [dnl | |
3113 | table=0,priority=150,arp,action=normal | |
3114 | table=0,priority=100,ip,in_port=1,action=resubmit(,1),resubmit(,2) | |
3115 | ||
723af132 JS |
3116 | table=1,ip,action=ct(table=3) |
3117 | table=2,ip,action=ct(table=3) | |
c4e34c61 RB |
3118 | |
3119 | table=3,ip,action=drop | |
3120 | ]) | |
3121 | ||
3122 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
3123 | ||
3124 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3125 | 1 packets transmitted, 0 received, 100% packet loss, time 0ms | |
3126 | ]) | |
3127 | ||
3128 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
3129 | n_packets=1, n_bytes=98, priority=100,ip,in_port=1 actions=resubmit(,1),resubmit(,2) | |
3130 | n_packets=2, n_bytes=84, priority=150,arp actions=NORMAL | |
723af132 JS |
3131 | table=1, n_packets=1, n_bytes=98, ip actions=ct(table=3) |
3132 | table=2, n_packets=1, n_bytes=98, ip actions=ct(table=3) | |
c4e34c61 RB |
3133 | table=3, n_packets=2, n_bytes=196, ip actions=drop |
3134 | NXST_FLOW reply: | |
3135 | ]) | |
3136 | ||
3137 | OVS_TRAFFIC_VSWITCHD_STOP | |
3138 | AT_CLEANUP | |
9ac0aada | 3139 | |
1d768544 JS |
3140 | AT_BANNER([conntrack - L7]) |
3141 | ||
3142 | AT_SETUP([conntrack - IPv4 HTTP]) | |
3143 | CHECK_CONNTRACK() | |
3144 | OVS_TRAFFIC_VSWITCHD_START() | |
3145 | ||
3146 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3147 | ||
3148 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3149 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3150 | ||
3151 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3152 | AT_DATA([flows.txt], [dnl | |
3153 | priority=1,action=drop | |
3154 | priority=10,arp,action=normal | |
3155 | priority=10,icmp,action=normal | |
3156 | priority=100,in_port=1,tcp,action=ct(commit),2 | |
3157 | priority=100,in_port=2,ct_state=-trk,tcp,action=ct(table=0) | |
3158 | priority=100,in_port=2,ct_state=+trk+est,tcp,action=1 | |
3159 | ]) | |
3160 | ||
3161 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3162 | ||
3163 | OVS_START_L7([at_ns0], [http]) | |
3164 | OVS_START_L7([at_ns1], [http]) | |
3165 | ||
3166 | dnl HTTP requests from ns0->ns1 should work fine. | |
3167 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3168 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3169 | 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>) | |
3170 | ]) | |
3171 | ||
3172 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
3173 | dnl Try 3 times, in 1 second intervals. | |
3174 | NS_CHECK_EXEC([at_ns1], [wget 10.1.1.1 -t 3 -T 1 --retry-connrefused -v -o wget1.log], [4]) | |
3175 | ||
3176 | OVS_TRAFFIC_VSWITCHD_STOP | |
3177 | AT_CLEANUP | |
3178 | ||
3179 | AT_SETUP([conntrack - IPv6 HTTP]) | |
3180 | CHECK_CONNTRACK() | |
3181 | OVS_TRAFFIC_VSWITCHD_START() | |
3182 | ||
3183 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3184 | ||
3185 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3186 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3187 | ||
3188 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3189 | AT_DATA([flows.txt], [dnl | |
3190 | priority=1,action=drop | |
3191 | priority=10,icmp6,action=normal | |
3192 | priority=100,in_port=1,tcp6,action=ct(commit),2 | |
3193 | priority=100,in_port=2,ct_state=-trk,tcp6,action=ct(table=0) | |
3194 | priority=100,in_port=2,ct_state=+trk+est,tcp6,action=1 | |
3195 | ]) | |
3196 | ||
3197 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3198 | ||
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: | |
3201 | dnl "connect: Cannot assign requested address" | |
3202 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
3203 | ||
3204 | OVS_START_L7([at_ns0], [http6]) | |
3205 | OVS_START_L7([at_ns1], [http6]) | |
3206 | ||
3207 | dnl HTTP requests from ns0->ns1 should work fine. | |
3208 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3209 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3210 | 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>) | |
3211 | ]) | |
3212 | ||
3213 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
3214 | dnl Try 3 times, in 1 second intervals. | |
3215 | NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 --retry-connrefused -v -o wget1.log], [4]) | |
3216 | ||
3217 | OVS_TRAFFIC_VSWITCHD_STOP | |
3218 | AT_CLEANUP | |
3219 | ||
3220 | AT_SETUP([conntrack - commit, recirc]) | |
3221 | CHECK_CONNTRACK() | |
3222 | OVS_TRAFFIC_VSWITCHD_START() | |
3223 | ||
3224 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3) | |
3225 | ||
3226 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3227 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3228 | ADD_VETH(p2, at_ns2, br0, "10.1.1.3/24") | |
3229 | ADD_VETH(p3, at_ns3, br0, "10.1.1.4/24") | |
3230 | ||
3231 | dnl Allow any traffic from ns0->ns1, ns2->ns3. | |
3232 | AT_DATA([flows.txt], [dnl | |
3233 | priority=1,action=drop | |
3234 | priority=10,arp,action=normal | |
3235 | priority=10,icmp,action=normal | |
3236 | priority=100,in_port=1,tcp,ct_state=-trk,action=ct(commit,table=0) | |
3237 | priority=100,in_port=1,tcp,ct_state=+trk,action=2 | |
3238 | priority=100,in_port=2,tcp,ct_state=-trk,action=ct(table=0) | |
3239 | priority=100,in_port=2,tcp,ct_state=+trk,action=1 | |
3240 | priority=100,in_port=3,tcp,ct_state=-trk,action=set_field:0->metadata,ct(table=0) | |
3241 | priority=100,in_port=3,tcp,ct_state=+trk,metadata=0,action=set_field:1->metadata,ct(commit,table=0) | |
3242 | priority=100,in_port=3,tcp,ct_state=+trk,metadata=1,action=4 | |
3243 | priority=100,in_port=4,tcp,ct_state=-trk,action=ct(commit,table=0) | |
3244 | priority=100,in_port=4,tcp,ct_state=+trk,action=3 | |
3245 | ]) | |
3246 | ||
3247 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3248 | ||
3249 | OVS_START_L7([at_ns1], [http]) | |
3250 | OVS_START_L7([at_ns3], [http]) | |
3251 | ||
3252 | dnl HTTP requests from p0->p1 should work fine. | |
3253 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3254 | ||
3255 | dnl HTTP requests from p2->p3 should work fine. | |
3256 | NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o wget1.log]) | |
3257 | ||
3258 | OVS_TRAFFIC_VSWITCHD_STOP | |
3259 | AT_CLEANUP | |
3260 | ||
3261 | AT_SETUP([conntrack - multiple zones, local]) | |
3262 | CHECK_CONNTRACK() | |
3263 | CHECK_CONNTRACK_LOCAL_STACK() | |
3264 | OVS_TRAFFIC_VSWITCHD_START() | |
3265 | ||
3266 | ADD_NAMESPACES(at_ns0) | |
3267 | ||
3268 | AT_CHECK([ip addr add dev br0 "10.1.1.1/24"]) | |
3269 | AT_CHECK([ip link set dev br0 up]) | |
3270 | on_exit 'ip addr del dev br0 "10.1.1.1/24"' | |
3271 | ADD_VETH(p0, at_ns0, br0, "10.1.1.2/24") | |
3272 | ||
3273 | dnl Allow traffic from local stack to ns0. Only allow neighbour discovery, | |
3274 | dnl return traffic from ns0 back to the local stack. | |
3275 | AT_DATA([flows.txt], [dnl | |
3276 | priority=1,action=drop | |
3277 | priority=10,arp,action=normal | |
3278 | priority=100,in_port=LOCAL,ip,ct_state=-trk,action=drop | |
3279 | priority=100,in_port=LOCAL,ip,ct_state=+trk+new,action=ct(commit,zone=1),ct(commit,zone=2),1 | |
3280 | priority=100,in_port=LOCAL,ip,ct_state=+trk+est,action=ct(commit,zone=1),ct(commit,zone=2),1 | |
3281 | priority=100,in_port=1,ip,ct_state=-trk,action=ct(table=1,zone=1) | |
3282 | table=1,in_port=1,ip,ct_state=+trk+est,ct_zone=1,action=ct(table=2,zone=2) | |
3283 | table=2,in_port=1,ip,ct_state=+trk+est,ct_zone=2,action=LOCAL | |
3284 | ]) | |
3285 | ||
3286 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3287 | ||
3288 | AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3289 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3290 | ]) | |
3291 | ||
3292 | OVS_START_L7([at_ns0], [http]) | |
3293 | ||
3294 | dnl HTTP requests from root namespace to p0 should work fine. | |
3295 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3296 | ||
3297 | dnl (again) HTTP requests from root namespace to p0 should work fine. | |
3298 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3299 | ||
3300 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | grep "zone"], [0], [dnl | |
3301 | 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 | |
3302 | 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 | |
3303 | 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>) | |
3304 | 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>) | |
3305 | ]) | |
3306 | ||
3307 | OVS_TRAFFIC_VSWITCHD_STOP | |
3308 | AT_CLEANUP | |
3309 | ||
3310 | AT_SETUP([conntrack - multi-stage pipeline, local]) | |
3311 | CHECK_CONNTRACK() | |
3312 | CHECK_CONNTRACK_LOCAL_STACK() | |
3313 | OVS_TRAFFIC_VSWITCHD_START() | |
3314 | ||
3315 | ADD_NAMESPACES(at_ns0) | |
3316 | ||
3317 | AT_CHECK([ip addr add dev br0 "10.1.1.1/24"]) | |
3318 | AT_CHECK([ip link set dev br0 up]) | |
3319 | on_exit 'ip addr del dev br0 "10.1.1.1/24"' | |
3320 | ADD_VETH(p0, at_ns0, br0, "10.1.1.2/24") | |
3321 | ||
3322 | dnl Allow traffic from local stack to ns0. Only allow neighbour discovery, | |
3323 | dnl return traffic from ns0 back to the local stack. | |
3324 | AT_DATA([flows.txt], [dnl | |
3325 | dnl default | |
3326 | table=0,priority=1,action=drop | |
3327 | table=0,priority=10,arp,action=normal | |
3328 | ||
3329 | dnl Load the output port to REG0 | |
3330 | table=0,priority=100,ip,in_port=LOCAL,action=load:1->NXM_NX_REG0[[0..15]],goto_table:1 | |
3331 | table=0,priority=100,ip,in_port=1,action=load:65534->NXM_NX_REG0[[0..15]],goto_table:1 | |
3332 | ||
3333 | dnl Ingress pipeline | |
3334 | dnl - Allow all connections from LOCAL port (commit and proceed to egress) | |
3335 | dnl - All other connections go through conntracker using the input port as | |
3336 | dnl a connection tracking zone. | |
f6fabcc6 | 3337 | 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 |
3338 | table=1,priority=100,ip,action=ct(table=2,zone=OXM_OF_IN_PORT[[0..15]]) |
3339 | table=1,priority=1,action=drop | |
3340 | ||
3341 | dnl Egress pipeline | |
3342 | dnl - Allow all connections from LOCAL port (commit and skip to output) | |
3343 | dnl - Allow other established connections to go through conntracker using | |
3344 | dnl output port as a connection tracking zone. | |
f6fabcc6 | 3345 | 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 |
3346 | table=2,priority=100,ip,ct_state=+trk+est,action=ct(table=3,zone=NXM_NX_REG0[[0..15]]) |
3347 | table=2,priority=1,action=drop | |
3348 | ||
3349 | dnl Only allow established traffic from egress ct lookup | |
3350 | table=3,priority=100,ip,ct_state=+trk+est,action=goto_table:4 | |
3351 | table=3,priority=1,action=drop | |
3352 | ||
3353 | dnl output table | |
3354 | table=4,priority=100,ip,action=output:NXM_NX_REG0[[]] | |
3355 | ]) | |
3356 | ||
3357 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3358 | ||
3359 | AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl | |
3360 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
3361 | ]) | |
3362 | ||
3363 | OVS_START_L7([at_ns0], [http]) | |
3364 | ||
3365 | dnl HTTP requests from root namespace to p0 should work fine. | |
3366 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3367 | ||
3368 | dnl (again) HTTP requests from root namespace to p0 should work fine. | |
3369 | AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3370 | ||
3371 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | grep "zone"], [0], [dnl | |
3372 | 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 | |
3373 | 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 | |
3374 | 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>) | |
3375 | 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>) | |
3376 | ]) | |
3377 | ||
3378 | OVS_TRAFFIC_VSWITCHD_STOP | |
3379 | AT_CLEANUP | |
3380 | ||
3f1087c7 YHW |
3381 | AT_SETUP([conntrack - limit by zone]) |
3382 | CHECK_CONNTRACK() | |
adf1b852 | 3383 | CHECK_CT_DPIF_PER_ZONE_LIMIT() |
3f1087c7 YHW |
3384 | OVS_TRAFFIC_VSWITCHD_START() |
3385 | ||
3386 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3387 | ||
3388 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3389 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3390 | ||
3391 | AT_DATA([flows.txt], [dnl | |
3392 | priority=1,action=drop | |
3393 | priority=10,arp,action=normal | |
3394 | priority=100,in_port=1,udp,action=ct(commit),2 | |
3395 | priority=100,in_port=2,udp,action=ct(zone=3,commit),1 | |
3396 | ]) | |
3397 | ||
3398 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3399 | ||
3400 | 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]) | |
3401 | AT_CHECK([ovs-appctl dpctl/ct-del-limits zone=1,2,4]) | |
3402 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,1,2,3], [],[dnl | |
3403 | default limit=10 | |
3404 | zone=0,limit=5,count=0 | |
3405 | zone=1,limit=10,count=0 | |
3406 | zone=2,limit=10,count=0 | |
3407 | zone=3,limit=3,count=0 | |
3408 | ]) | |
3409 | ||
3410 | dnl Test UDP from port 1 | |
3411 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000200080000 actions=resubmit(,0)"]) | |
3412 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000300080000 actions=resubmit(,0)"]) | |
3413 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)"]) | |
3414 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000500080000 actions=resubmit(,0)"]) | |
3415 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000600080000 actions=resubmit(,0)"]) | |
3416 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000700080000 actions=resubmit(,0)"]) | |
3417 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000800080000 actions=resubmit(,0)"]) | |
3418 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000900080000 actions=resubmit(,0)"]) | |
3419 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000a00080000 actions=resubmit(,0)"]) | |
3420 | ||
3421 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,1,2,3,4,5], [0], [dnl | |
3422 | default limit=10 | |
3423 | zone=0,limit=5,count=5 | |
3424 | zone=1,limit=10,count=0 | |
3425 | zone=2,limit=10,count=0 | |
3426 | zone=3,limit=3,count=0 | |
3427 | zone=4,limit=10,count=0 | |
3428 | zone=5,limit=10,count=0 | |
3429 | ]) | |
3430 | ||
3431 | dnl Test ct-get-limits for all zoens | |
3432 | AT_CHECK([ovs-appctl dpctl/ct-get-limits], [0], [dnl | |
3433 | default limit=10 | |
3434 | zone=0,limit=5,count=5 | |
3435 | zone=3,limit=3,count=0 | |
3436 | ]) | |
3437 | ||
3438 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.1," | sort ], [0], [dnl | |
3439 | 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) | |
3440 | 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) | |
3441 | 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) | |
3442 | 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) | |
3443 | 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) | |
3444 | ]) | |
3445 | ||
3446 | dnl Test UDP from port 2 | |
3447 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101030a0101040001000200080000 actions=resubmit(,0)"]) | |
3448 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101030a0101040001000300080000 actions=resubmit(,0)"]) | |
3449 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101030a0101040001000400080000 actions=resubmit(,0)"]) | |
3450 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101030a0101040001000500080000 actions=resubmit(,0)"]) | |
3451 | AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=2 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101030a0101040001000600080000 actions=resubmit(,0)"]) | |
3452 | ||
3453 | AT_CHECK([ovs-appctl dpctl/ct-get-limits zone=0,3], [0], [dnl | |
3454 | default limit=10 | |
3455 | zone=0,limit=5,count=5 | |
3456 | zone=3,limit=3,count=3 | |
3457 | ]) | |
3458 | ||
3459 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | grep "orig=.src=10\.1\.1\.3," | sort ], [0], [dnl | |
3460 | 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 | |
3461 | 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 | |
3462 | 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 | |
3463 | ]) | |
3464 | ||
3465 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
3466 | /could not create datapath/d | |
3467 | /(Cannot allocate memory) on packet/d"]) | |
3468 | AT_CLEANUP | |
3469 | ||
9d3e0e5c JR |
3470 | AT_SETUP([FTP - no conntrack]) |
3471 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
3472 | OVS_TRAFFIC_VSWITCHD_START() | |
3473 | ||
3474 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3475 | ||
3476 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3477 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3478 | ||
3479 | AT_DATA([flows.txt], [dnl | |
3480 | table=0,action=normal | |
3481 | ]) | |
3482 | ||
3483 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows.txt]) | |
3484 | ||
3485 | NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp1.pid]) | |
3486 | NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid]) | |
3487 | OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) | |
3488 | ||
3489 | dnl FTP requests from p0->p1 should work fine. | |
3490 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3491 | ||
3492 | AT_CHECK([find -name index.html], [0], [dnl | |
3493 | ./index.html | |
3494 | ]) | |
3495 | ||
3496 | OVS_TRAFFIC_VSWITCHD_STOP | |
3497 | AT_CLEANUP | |
3498 | ||
1d768544 | 3499 | AT_SETUP([conntrack - FTP]) |
40c7b2fc | 3500 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3501 | CHECK_CONNTRACK() |
3502 | CHECK_CONNTRACK_ALG() | |
3503 | OVS_TRAFFIC_VSWITCHD_START() | |
3504 | ||
3505 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3506 | ||
3507 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3508 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3509 | ||
3510 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3511 | AT_DATA([flows1.txt], [dnl | |
3512 | table=0,priority=1,action=drop | |
3513 | table=0,priority=10,arp,action=normal | |
3514 | table=0,priority=10,icmp,action=normal | |
3515 | table=0,priority=100,in_port=1,tcp,action=ct(alg=ftp,commit),2 | |
3516 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3517 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3518 | table=1,in_port=2,tcp,ct_state=+trk+rel,action=1 | |
3519 | ]) | |
3520 | ||
3521 | dnl Similar policy but without allowing all traffic from ns0->ns1. | |
3522 | AT_DATA([flows2.txt], [dnl | |
3523 | table=0,priority=1,action=drop | |
3524 | table=0,priority=10,arp,action=normal | |
3525 | table=0,priority=10,icmp,action=normal | |
3526 | ||
3527 | dnl Allow outgoing TCP connections, and treat them as FTP | |
3528 | table=0,priority=100,in_port=1,tcp,action=ct(table=1) | |
3529 | table=1,in_port=1,tcp,ct_state=+trk+new,action=ct(commit,alg=ftp),2 | |
3530 | table=1,in_port=1,tcp,ct_state=+trk+est,action=2 | |
3531 | ||
3532 | dnl Allow incoming FTP data connections and responses to existing connections | |
3533 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3534 | table=1,in_port=2,tcp,ct_state=+trk+new+rel,action=ct(commit),1 | |
3535 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3536 | table=1,in_port=2,tcp,ct_state=+trk-new+rel,action=1 | |
3537 | ]) | |
3538 | ||
3a2a425b DB |
3539 | dnl flows3 is same as flows1, except no ALG is specified. |
3540 | AT_DATA([flows3.txt], [dnl | |
3541 | table=0,priority=1,action=drop | |
3542 | table=0,priority=10,arp,action=normal | |
3543 | table=0,priority=10,icmp,action=normal | |
3544 | table=0,priority=100,in_port=1,tcp,action=ct(commit),2 | |
3545 | table=0,priority=100,in_port=2,tcp,action=ct(table=1) | |
3546 | table=1,in_port=2,tcp,ct_state=+trk+est,action=1 | |
3547 | table=1,in_port=2,tcp,ct_state=+trk+rel,action=1 | |
3548 | ]) | |
3549 | ||
1d768544 JS |
3550 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt]) |
3551 | ||
3552 | OVS_START_L7([at_ns0], [ftp]) | |
3553 | OVS_START_L7([at_ns1], [ftp]) | |
3554 | ||
3555 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3556 | dnl Try 3 times, in 1 second intervals. | |
3557 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3558 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3559 | ]) | |
3560 | ||
3561 | dnl FTP requests from p0->p1 should work fine. | |
3562 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3563 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3564 | 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 | |
3565 | ]) | |
3566 | ||
3567 | dnl Try the second set of flows. | |
3568 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows2.txt]) | |
3569 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3570 | ||
3571 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3572 | dnl Try 3 times, in 1 second intervals. | |
3573 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3574 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3575 | ]) | |
3576 | ||
3577 | dnl Active FTP requests from p0->p1 should work fine. | |
3578 | 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]) | |
3579 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3580 | 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 | |
3581 | 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>) | |
3582 | ]) | |
3583 | ||
3584 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3585 | ||
3586 | dnl Passive FTP requests from p0->p1 should work fine. | |
3587 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0-2.log]) | |
3588 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3589 | 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 | |
3590 | ]) | |
3591 | ||
3a2a425b DB |
3592 | dnl Try the third set of flows, without alg specifier. |
3593 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows3.txt]) | |
3594 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3595 | ||
3596 | dnl FTP control requests from p0->p1 should work fine, but helper will not be assigned. | |
3597 | 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]) | |
3598 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3599 | 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>) | |
3600 | ]) | |
3601 | ||
1d768544 JS |
3602 | OVS_TRAFFIC_VSWITCHD_STOP |
3603 | AT_CLEANUP | |
3604 | ||
3605 | AT_SETUP([conntrack - FTP over IPv6]) | |
40c7b2fc | 3606 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3607 | CHECK_CONNTRACK() |
3608 | CHECK_CONNTRACK_ALG() | |
3609 | OVS_TRAFFIC_VSWITCHD_START() | |
3610 | ||
3611 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3612 | ||
3613 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3614 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3615 | ||
3616 | dnl Allow any traffic from ns0->ns1. | |
3617 | dnl Only allow nd, return traffic from ns1->ns0. | |
3618 | AT_DATA([flows.txt], [dnl | |
3619 | dnl Track all IPv6 traffic and drop the rest. | |
3620 | dnl Allow ICMPv6 both ways. No commit, so pings will not be tracked. | |
3621 | table=0 priority=100 in_port=1 icmp6, action=2 | |
3622 | table=0 priority=100 in_port=2 icmp6, action=1 | |
3623 | table=0 priority=10 ip6, action=ct(table=1) | |
3624 | table=0 priority=0 action=drop | |
3625 | dnl | |
3626 | dnl Table 1 | |
3627 | dnl | |
3628 | dnl Allow new TCPv6 FTP control connections from port 1. | |
3629 | table=1 in_port=1 ct_state=+new, tcp6, tp_dst=21, action=ct(alg=ftp,commit),2 | |
3630 | dnl Allow related TCPv6 connections from port 2. | |
3631 | table=1 in_port=2 ct_state=+new+rel, tcp6, action=ct(commit),1 | |
3632 | dnl Allow established TCPv6 connections both ways. | |
3633 | table=1 in_port=1 ct_state=+est, tcp6, action=2 | |
3634 | table=1 in_port=2 ct_state=+est, tcp6, action=1 | |
3635 | dnl Drop everything else. | |
3636 | table=1 priority=0, action=drop | |
3637 | ]) | |
3638 | ||
3639 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3640 | ||
3641 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
3642 | dnl waiting, we get occasional failures due to the following error: | |
3643 | dnl "connect: Cannot assign requested address" | |
3644 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
3645 | ||
3646 | OVS_START_L7([at_ns1], [ftp]) | |
3647 | ||
3648 | dnl FTP requests from p0->p1 should work fine. | |
3649 | 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]) | |
3650 | ||
3651 | dnl Discards CLOSE_WAIT and CLOSING | |
3652 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3653 | 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 | |
3654 | 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>) | |
3655 | ]) | |
3656 | ||
3657 | OVS_TRAFFIC_VSWITCHD_STOP | |
3658 | AT_CLEANUP | |
3659 | ||
200a9af9 DB |
3660 | AT_SETUP([conntrack - IPv6 FTP Passive]) |
3661 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
3662 | CHECK_CONNTRACK() | |
3663 | CHECK_CONNTRACK_ALG() | |
3664 | OVS_TRAFFIC_VSWITCHD_START() | |
3665 | ||
3666 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3667 | ||
3668 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
3669 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
3670 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
3671 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:99]) | |
3672 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:99 dev p0]) | |
3673 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:88 dev p1]) | |
3674 | ||
3675 | dnl Allow any traffic from ns0->ns1. | |
3676 | dnl Only allow nd, return traffic from ns1->ns0. | |
3677 | AT_DATA([flows.txt], [dnl | |
3678 | dnl Track all IPv6 traffic and drop the rest. | |
3679 | dnl Allow ICMPv6 both ways. No commit, so pings will not be tracked. | |
3680 | table=0 priority=100 in_port=1 icmp6, action=2 | |
3681 | table=0 priority=100 in_port=2 icmp6, action=1 | |
3682 | table=0 priority=10 ip6, action=ct(table=1) | |
3683 | table=0 priority=0 action=drop | |
3684 | dnl | |
3685 | dnl Table 1 | |
3686 | dnl | |
3687 | dnl Allow new TCPv6 FTP control connections from port 1. | |
3688 | table=1 in_port=1 ct_state=+new, tcp6, tp_dst=21, action=ct(alg=ftp,commit),2 | |
3689 | dnl Allow related TCPv6 connections from port 1. | |
3690 | table=1 in_port=1 ct_state=+new+rel, tcp6, action=ct(commit),2 | |
3691 | dnl Allow established TCPv6 connections both ways. | |
3692 | table=1 in_port=1 ct_state=+est, tcp6, action=2 | |
3693 | table=1 in_port=2 ct_state=+est, tcp6, action=1 | |
3694 | dnl Drop everything else. | |
3695 | table=1 priority=0, action=drop | |
3696 | ]) | |
3697 | ||
3698 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3699 | ||
3700 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
3701 | dnl waiting, we get occasional failures due to the following error: | |
3702 | dnl "connect: Cannot assign requested address" | |
3703 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
3704 | ||
3705 | OVS_START_L7([at_ns1], [ftp]) | |
3706 | ||
3707 | dnl FTP passive requests from p0->p1 should work fine. | |
3708 | 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]) | |
3709 | ||
3710 | dnl Discards CLOSE_WAIT and CLOSING | |
3711 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
3712 | 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>) | |
3713 | 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 | |
3714 | ]) | |
3715 | ||
3716 | OVS_TRAFFIC_VSWITCHD_STOP | |
3717 | AT_CLEANUP | |
3718 | ||
1d768544 | 3719 | AT_SETUP([conntrack - FTP with multiple expectations]) |
40c7b2fc | 3720 | AT_SKIP_IF([test $HAVE_FTP = no]) |
1d768544 JS |
3721 | CHECK_CONNTRACK() |
3722 | CHECK_CONNTRACK_ALG() | |
3723 | OVS_TRAFFIC_VSWITCHD_START() | |
3724 | ||
3725 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3726 | ||
3727 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3728 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3729 | ||
3730 | dnl Dual-firewall, allow all from ns1->ns2, allow established and ftp ns2->ns1. | |
3731 | AT_DATA([flows.txt], [dnl | |
3732 | table=0,priority=1,action=drop | |
3733 | table=0,priority=10,arp,action=normal | |
3734 | table=0,priority=10,icmp,action=normal | |
3735 | ||
3736 | dnl Traffic from ns1 | |
3737 | table=0,priority=100,in_port=1,tcp,action=ct(table=1,zone=1) | |
3738 | 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 | |
3739 | table=1,in_port=1,tcp,ct_zone=1,ct_state=+trk+new+rel,action=ct(commit,zone=1),ct(commit,zone=2),2 | |
3740 | table=1,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,action=ct(table=2,zone=2) | |
3741 | table=2,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,action=2 | |
3742 | ||
3743 | dnl Traffic from ns2 | |
3744 | table=0,priority=100,in_port=2,tcp,action=ct(table=1,zone=2) | |
3745 | table=1,in_port=2,tcp,ct_zone=2,ct_state=+trk+rel,action=ct(commit,zone=2),ct(commit,zone=1),1 | |
3746 | table=1,in_port=2,tcp,ct_zone=2,ct_state=+trk+est,action=ct(table=2,zone=1) | |
3747 | table=2,in_port=2,tcp,ct_zone=1,ct_state=+trk+rel,action=ct(commit,zone=2),ct(commit,zone=1),1 | |
3748 | table=2,in_port=2,tcp,ct_zone=1,ct_state=+trk+est,action=1 | |
3749 | ]) | |
3750 | ||
3751 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3752 | ||
3753 | OVS_START_L7([at_ns0], [ftp]) | |
3754 | OVS_START_L7([at_ns1], [ftp]) | |
3755 | ||
3756 | dnl FTP requests from p1->p0 should fail due to network failure. | |
3757 | dnl Try 3 times, in 1 second intervals. | |
3758 | NS_CHECK_EXEC([at_ns1], [wget ftp://10.1.1.1 --no-passive-ftp -t 3 -T 1 -v -o wget1.log], [4]) | |
3759 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3760 | ]) | |
3761 | ||
3762 | dnl Active FTP requests from p0->p1 should work fine. | |
3763 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3764 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3765 | 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 | |
3766 | 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 | |
3767 | 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>) | |
3768 | 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>) | |
3769 | ]) | |
3770 | ||
3771 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3772 | ||
3773 | dnl Passive FTP requests from p0->p1 should work fine. | |
3774 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
3775 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3776 | 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>) | |
3777 | 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 | |
3778 | 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>) | |
3779 | 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 | |
3780 | ]) | |
3781 | ||
3782 | OVS_TRAFFIC_VSWITCHD_STOP | |
3783 | AT_CLEANUP | |
3784 | ||
40c7b2fc JS |
3785 | AT_SETUP([conntrack - TFTP]) |
3786 | AT_SKIP_IF([test $HAVE_TFTP = no]) | |
3787 | CHECK_CONNTRACK() | |
3788 | CHECK_CONNTRACK_ALG() | |
3789 | OVS_TRAFFIC_VSWITCHD_START() | |
3790 | ||
3791 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3792 | ||
3793 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3794 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3795 | ||
3796 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3797 | AT_DATA([flows1.txt], [dnl | |
3798 | table=0,priority=1,action=drop | |
3799 | table=0,priority=10,arp,action=normal | |
3800 | table=0,priority=10,icmp,action=normal | |
3801 | table=0,priority=100,in_port=1,udp,action=ct(alg=tftp,commit),2 | |
3802 | table=0,priority=100,in_port=2,udp,action=ct(table=1) | |
3803 | table=1,in_port=2,udp,ct_state=+trk+est,action=1 | |
3804 | table=1,in_port=2,udp,ct_state=+trk+rel,action=1 | |
3805 | ]) | |
3806 | ||
3807 | dnl Similar policy but without allowing all traffic from ns0->ns1. | |
3808 | AT_DATA([flows2.txt], [dnl | |
3809 | table=0,priority=1,action=drop | |
3810 | table=0,priority=10,arp,action=normal | |
3811 | table=0,priority=10,icmp,action=normal | |
3812 | ||
3813 | dnl Allow outgoing UDP connections, and treat them as TFTP | |
3814 | table=0,priority=100,in_port=1,udp,action=ct(table=1) | |
3815 | table=1,in_port=1,udp,ct_state=+trk+new-rel,action=ct(commit,alg=tftp),2 | |
3816 | table=1,in_port=1,udp,ct_state=+trk+new+rel,action=ct(commit),2 | |
3817 | table=1,in_port=1,udp,ct_state=+trk+est,action=2 | |
3818 | ||
3819 | dnl Allow incoming TFTP data connections and responses to existing connections | |
3820 | table=0,priority=100,in_port=2,udp,action=ct(table=1) | |
3821 | table=1,in_port=2,udp,ct_state=+trk+est,action=1 | |
3822 | table=1,in_port=2,udp,ct_state=+trk+new+rel,action=1 | |
3823 | ]) | |
3824 | ||
3825 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt]) | |
3826 | ||
3827 | OVS_START_L7([at_ns0], [tftp]) | |
3828 | OVS_START_L7([at_ns1], [tftp]) | |
3829 | ||
3830 | dnl TFTP requests from p1->p0 should fail due to network failure. | |
3831 | NS_CHECK_EXEC([at_ns1], [[curl $CURL_OPT tftp://10.1.1.1/flows1.txt -o foo 2>curl0.log]], [28]) | |
3832 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3833 | ]) | |
3834 | ||
3835 | dnl TFTP requests from p0->p1 should work fine. | |
3836 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows1.txt -o foo 2>curl1.log]]) | |
3837 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3838 | 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 | |
3839 | ]) | |
3840 | ||
3841 | dnl Try the second set of flows. | |
3842 | AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows2.txt]) | |
3843 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
3844 | ||
3845 | dnl TFTP requests from p1->p0 should fail due to network failure. | |
3846 | NS_CHECK_EXEC([at_ns1], [[curl $CURL_OPT tftp://10.1.1.1/flows1.txt -o foo 2>curl2.log]], [28]) | |
3847 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.1)], [0], [dnl | |
3848 | ]) | |
3849 | ||
3850 | dnl TFTP requests from p0->p1 should work fine. | |
3851 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows1.txt -o foo 2>curl3.log]]) | |
3852 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
3853 | 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 | |
3854 | ]) | |
3855 | ||
3856 | OVS_TRAFFIC_VSWITCHD_STOP | |
3857 | AT_CLEANUP | |
3858 | ||
ee8941ab | 3859 | AT_BANNER([conntrack - NAT]) |
9ac0aada JR |
3860 | |
3861 | AT_SETUP([conntrack - simple SNAT]) | |
3862 | CHECK_CONNTRACK() | |
4573c42e | 3863 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
3864 | OVS_TRAFFIC_VSWITCHD_START() |
3865 | ||
3866 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3867 | ||
3868 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3869 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
3870 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3871 | ||
3872 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3873 | AT_DATA([flows.txt], [dnl | |
3874 | in_port=1,ip,action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255)),2 | |
3875 | in_port=2,ct_state=-trk,ip,action=ct(table=0,zone=1,nat) | |
3876 | in_port=2,ct_state=+trk,ct_zone=1,ip,action=1 | |
3877 | dnl | |
3878 | dnl ARP | |
3879 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
3880 | priority=10 arp action=normal | |
3881 | priority=0,action=drop | |
3882 | dnl | |
3883 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
3884 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
3885 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
3886 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
3887 | dnl TPA IP in reg2. | |
3888 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
3889 | table=10 priority=100 arp xreg0=0 action=normal | |
3890 | 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]] | |
3891 | table=10 priority=0 action=drop | |
3892 | ]) | |
3893 | ||
3894 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3895 | ||
3896 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 3897 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
3898 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
3899 | ||
13c10e56 | 3900 | 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 | 3901 | 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 |
3902 | ]) |
3903 | ||
3904 | OVS_TRAFFIC_VSWITCHD_STOP | |
3905 | AT_CLEANUP | |
3906 | ||
c0324e37 JR |
3907 | AT_SETUP([conntrack - SNAT with ct_mark change on reply]) |
3908 | CHECK_CONNTRACK() | |
3909 | CHECK_CONNTRACK_NAT() | |
3910 | OVS_TRAFFIC_VSWITCHD_START() | |
3911 | ||
3912 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3913 | ||
3914 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
ed307567 DB |
3915 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) |
3916 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
3917 | ||
c0324e37 | 3918 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") |
ed307567 DB |
3919 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) |
3920 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
c0324e37 JR |
3921 | |
3922 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3923 | AT_DATA([flows.txt], [dnl | |
ed307567 | 3924 | in_port=1,ip,action=ct(commit,zone=1,nat(src=10.1.1.240)),2 |
c0324e37 JR |
3925 | in_port=2,ct_state=-trk,ip,action=ct(table=0,zone=1,nat) |
3926 | dnl | |
3927 | dnl Setting the mark fails if the datapath can't find the existing conntrack | |
3928 | dnl entry after NAT has been reversed and the skb was lost due to an upcall. | |
3929 | dnl | |
3930 | in_port=2,ct_state=+trk,ct_zone=1,ip,action=ct(table=1,commit,zone=1,exec(set_field:1->ct_mark)),1 | |
3931 | table=1,in_port=2,ct_mark=1,ct_state=+rpl,ct_zone=1,ip,action=1 | |
3932 | dnl | |
c0324e37 | 3933 | priority=0,action=drop |
c0324e37 JR |
3934 | ]) |
3935 | ||
3936 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3937 | ||
aeae4330 | 3938 | dnl ICMP requests from p0->p1 should work fine. |
c0324e37 JR |
3939 | NS_CHECK_EXEC([at_ns0], [ping -c 1 10.1.1.2 | FORMAT_PING], [0], [dnl |
3940 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms | |
3941 | ]) | |
3942 | ||
3943 | 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 | |
3944 | 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 | |
3945 | ]) | |
3946 | ||
3947 | OVS_TRAFFIC_VSWITCHD_STOP | |
3948 | AT_CLEANUP | |
9ac0aada JR |
3949 | |
3950 | AT_SETUP([conntrack - SNAT with port range]) | |
3951 | CHECK_CONNTRACK() | |
4573c42e | 3952 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
3953 | OVS_TRAFFIC_VSWITCHD_START() |
3954 | ||
3955 | ADD_NAMESPACES(at_ns0, at_ns1) | |
3956 | ||
3957 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
3958 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
3959 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
3960 | ||
3961 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
3962 | AT_DATA([flows.txt], [dnl | |
3963 | in_port=1,tcp,action=ct(commit,zone=1,nat(src=10.1.1.240-10.1.1.255:34567-34568,random)),2 | |
3964 | in_port=2,ct_state=-trk,tcp,tp_dst=34567,action=ct(table=0,zone=1,nat) | |
3965 | in_port=2,ct_state=-trk,tcp,tp_dst=34568,action=ct(table=0,zone=1,nat) | |
3966 | in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
3967 | dnl | |
3968 | dnl ARP | |
3969 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
3970 | priority=10 arp action=normal | |
3971 | priority=0,action=drop | |
3972 | dnl | |
3973 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
3974 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
3975 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
3976 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
3977 | dnl TPA IP in reg2. | |
3978 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
3979 | table=10 priority=100 arp xreg0=0 action=normal | |
3980 | 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]] | |
3981 | table=10 priority=0 action=drop | |
3982 | ]) | |
3983 | ||
3984 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
3985 | ||
3986 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 3987 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
3988 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
3989 | ||
13c10e56 | 3990 | 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 | 3991 | 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 |
3992 | ]) |
3993 | ||
3994 | OVS_TRAFFIC_VSWITCHD_STOP | |
3995 | AT_CLEANUP | |
3996 | ||
32b2c81f DB |
3997 | AT_SETUP([conntrack - SNAT with port range with exhaustion]) |
3998 | CHECK_CONNTRACK() | |
3999 | CHECK_CONNTRACK_NAT() | |
4000 | OVS_TRAFFIC_VSWITCHD_START() | |
4001 | ||
4002 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4003 | ||
4004 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4005 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4006 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4007 | ||
4008 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4009 | AT_DATA([flows.txt], [dnl | |
4010 | in_port=1,tcp,action=ct(commit,zone=1,nat(src=10.1.1.240:34568,random)),2 | |
4011 | in_port=2,ct_state=-trk,tcp,tp_dst=34567,action=ct(table=0,zone=1,nat) | |
4012 | in_port=2,ct_state=-trk,tcp,tp_dst=34568,action=ct(table=0,zone=1,nat) | |
4013 | in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1 | |
4014 | dnl | |
4015 | dnl ARP | |
4016 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4017 | priority=10 arp action=normal | |
4018 | priority=0,action=drop | |
4019 | dnl | |
4020 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4021 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4022 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4023 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4024 | dnl TPA IP in reg2. | |
4025 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4026 | table=10 priority=100 arp xreg0=0 action=normal | |
4027 | 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]] | |
4028 | table=10 priority=0 action=drop | |
4029 | ]) | |
4030 | ||
4031 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4032 | ||
4033 | dnl HTTP requests from p0->p1 should work fine. | |
4034 | OVS_START_L7([at_ns1], [http]) | |
4035 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 1 -T 1 --retry-connrefused -v -o wget0.log]) | |
4036 | ||
4037 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 1 -T 1 --retry-connrefused -v -o wget0.log], [4]) | |
4038 | ||
4039 | 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 | |
4040 | 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>) | |
4041 | ]) | |
4042 | ||
4043 | OVS_TRAFFIC_VSWITCHD_STOP(["dnl | |
4044 | /Unable to NAT due to tuple space exhaustion - if DoS attack, use firewalling and\/or zone partitioning./d | |
4045 | /Dropped .* log messages in last .* seconds \(most recently, .* seconds ago\) due to excessive rate/d"]) | |
4046 | AT_CLEANUP | |
9ac0aada JR |
4047 | |
4048 | AT_SETUP([conntrack - more complex SNAT]) | |
4049 | CHECK_CONNTRACK() | |
4573c42e | 4050 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4051 | OVS_TRAFFIC_VSWITCHD_START() |
4052 | ||
4053 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4054 | ||
4055 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4056 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4057 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4058 | ||
4059 | AT_DATA([flows.txt], [dnl | |
4060 | dnl Track all IP traffic, NAT existing connections. | |
4061 | priority=100 ip action=ct(table=1,zone=1,nat) | |
4062 | dnl | |
4063 | dnl Allow ARP, but generate responses for NATed addresses | |
4064 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4065 | priority=10 arp action=normal | |
4066 | priority=0 action=drop | |
4067 | dnl | |
4068 | dnl Allow any traffic from ns0->ns1. SNAT ns0 to 10.1.1.240-10.1.1.255 | |
4069 | 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 | |
4070 | table=1 priority=100 in_port=1 ip ct_state=+trk-new+est action=2 | |
4071 | dnl Only allow established traffic from ns1->ns0. | |
4072 | table=1 priority=100 in_port=2 ip ct_state=+trk-new+est action=1 | |
4073 | table=1 priority=0 action=drop | |
4074 | dnl | |
4075 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4076 | table=8 priority=100 reg2=0x0a0101f0/0xfffffff0 action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4077 | dnl Zero result means not found. | |
4078 | table=8 priority=0 action=load:0->OXM_OF_PKT_REG0[[]] | |
4079 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4080 | dnl ARP TPA IP in reg2. | |
4081 | table=10 priority=100 arp xreg0=0 action=normal | |
4082 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4083 | 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]] | |
4084 | table=10 priority=0 action=drop | |
4085 | ]) | |
4086 | ||
4087 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4088 | ||
4089 | dnl HTTP requests from p0->p1 should work fine. | |
7ed40afe | 4090 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4091 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4092 | ||
13c10e56 | 4093 | 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 | 4094 | 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 |
4095 | ]) |
4096 | ||
4097 | OVS_TRAFFIC_VSWITCHD_STOP | |
4098 | AT_CLEANUP | |
4099 | ||
4100 | AT_SETUP([conntrack - simple DNAT]) | |
4101 | CHECK_CONNTRACK() | |
4573c42e | 4102 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4103 | OVS_TRAFFIC_VSWITCHD_START() |
4104 | ||
4105 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4106 | ||
4107 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4108 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4109 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:88]) | |
4110 | ||
4111 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4112 | AT_DATA([flows.txt], [dnl | |
4113 | priority=100 in_port=1,ip,nw_dst=10.1.1.64,action=ct(zone=1,nat(dst=10.1.1.2),commit),2 | |
4114 | priority=10 in_port=1,ip,action=ct(commit,zone=1),2 | |
4115 | priority=100 in_port=2,ct_state=-trk,ip,action=ct(table=0,nat,zone=1) | |
4116 | priority=100 in_port=2,ct_state=+trk+est,ct_zone=1,ip,action=1 | |
4117 | dnl | |
4118 | dnl ARP | |
4119 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4120 | priority=10 arp action=normal | |
4121 | priority=0,action=drop | |
4122 | dnl | |
4123 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4124 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4125 | dnl Zero result means not found. | |
4126 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4127 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4128 | dnl TPA IP in reg2. | |
4129 | table=10 priority=100 arp xreg0=0 action=normal | |
4130 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4131 | 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]] | |
4132 | table=10 priority=0 action=drop | |
4133 | ]) | |
4134 | ||
4135 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4136 | ||
4137 | dnl Should work with the virtual IP address through NAT | |
7ed40afe | 4138 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4139 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4140 | ||
420c73b2 JR |
4141 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
4142 | 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 |
4143 | ]) |
4144 | ||
4145 | dnl Should work with the assigned IP address as well | |
4146 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4147 | ||
420c73b2 JR |
4148 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
4149 | 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 |
4150 | ]) |
4151 | ||
4152 | OVS_TRAFFIC_VSWITCHD_STOP | |
4153 | AT_CLEANUP | |
4154 | ||
4155 | AT_SETUP([conntrack - more complex DNAT]) | |
4156 | CHECK_CONNTRACK() | |
4573c42e | 4157 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4158 | OVS_TRAFFIC_VSWITCHD_START() |
4159 | ||
4160 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4161 | ||
4162 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4163 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4164 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:88]) | |
4165 | ||
4166 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4167 | AT_DATA([flows.txt], [dnl | |
4168 | dnl Track all IP traffic | |
4169 | table=0 priority=100 ip action=ct(table=1,zone=1,nat) | |
4170 | dnl | |
4171 | dnl Allow ARP, but generate responses for NATed addresses | |
4172 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4173 | table=0 priority=10 arp action=normal | |
4174 | table=0 priority=0 action=drop | |
4175 | dnl | |
4176 | dnl Allow any IP traffic from ns0->ns1. DNAT ns0 from 10.1.1.64 to 10.1.1.2 | |
4177 | 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 | |
4178 | table=1 priority=10 in_port=1 ct_state=+new ip action=ct(commit,zone=1),2 | |
4179 | table=1 priority=100 in_port=1 ct_state=+est ct_zone=1 action=2 | |
4180 | dnl Only allow established traffic from ns1->ns0. | |
4181 | table=1 priority=100 in_port=2 ct_state=+est ct_zone=1 action=1 | |
4182 | table=1 priority=0 action=drop | |
4183 | dnl | |
4184 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4185 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4186 | dnl Zero result means not found. | |
4187 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4188 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4189 | dnl TPA IP in reg2. | |
4190 | table=10 priority=100 arp xreg0=0 action=normal | |
4191 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4192 | 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]] | |
4193 | table=10 priority=0 action=drop | |
4194 | ]) | |
4195 | ||
4196 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4197 | ||
4198 | dnl Should work with the virtual IP address through NAT | |
7ed40afe | 4199 | OVS_START_L7([at_ns1], [http]) |
9ac0aada JR |
4200 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget0.log]) |
4201 | ||
420c73b2 JR |
4202 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
4203 | 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 |
4204 | ]) |
4205 | ||
4206 | dnl Should work with the assigned IP address as well | |
4207 | NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4208 | ||
420c73b2 JR |
4209 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl |
4210 | 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 |
4211 | ]) |
4212 | ||
4213 | OVS_TRAFFIC_VSWITCHD_STOP | |
4214 | AT_CLEANUP | |
4215 | ||
4216 | AT_SETUP([conntrack - ICMP related with NAT]) | |
9c1ab985 | 4217 | AT_SKIP_IF([test $HAVE_NC = no]) |
b020a416 | 4218 | AT_SKIP_IF([test $HAVE_TCPDUMP = no]) |
9ac0aada | 4219 | CHECK_CONNTRACK() |
4573c42e | 4220 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4221 | OVS_TRAFFIC_VSWITCHD_START() |
4222 | ||
4223 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4224 | ||
4225 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4226 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4227 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4228 | ||
4229 | dnl Allow UDP traffic from ns0->ns1. Only allow related ICMP responses back. | |
4230 | dnl Make sure ICMP responses are reverse-NATted. | |
4231 | AT_DATA([flows.txt], [dnl | |
4232 | in_port=1,udp,action=ct(commit,nat(src=10.1.1.240-10.1.1.255),exec(set_field:1->ct_mark)),2 | |
4233 | in_port=2,icmp,ct_state=-trk,action=ct(table=0,nat) | |
4234 | in_port=2,icmp,nw_dst=10.1.1.1,ct_state=+trk+rel,ct_mark=1,action=1 | |
4235 | dnl | |
4236 | dnl ARP | |
4237 | priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4238 | priority=10 arp action=normal | |
4239 | priority=0,action=drop | |
4240 | dnl | |
4241 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4242 | table=8,reg2=0x0a0101f0/0xfffffff0,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
4243 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
4244 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4245 | dnl TPA IP in reg2. | |
4246 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4247 | table=10 priority=100 arp xreg0=0 action=normal | |
4248 | 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]] | |
4249 | table=10 priority=0 action=drop | |
4250 | ]) | |
4251 | ||
4252 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4253 | ||
b020a416 DB |
4254 | rm p0.pcap |
4255 | tcpdump -U -i ovs-p0 -w p0.pcap & | |
4256 | sleep 1 | |
4257 | ||
9ac0aada | 4258 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. |
b54971f7 | 4259 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc $NC_EOF_OPT -u 10.1.1.2 10000"]) |
9ac0aada JR |
4260 | |
4261 | AT_CHECK([ovs-appctl revalidator/purge], [0]) | |
4262 | AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip | sort | grep -v drop], [0], [dnl | |
4263 | n_packets=1, n_bytes=42, priority=10,arp actions=NORMAL | |
4264 | 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 | |
4265 | 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 | |
4266 | n_packets=1, n_bytes=72, ct_state=-trk,icmp,in_port=2 actions=ct(table=0,nat) | |
4267 | 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 | |
4268 | 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]] | |
4269 | table=10, n_packets=1, n_bytes=42, priority=100,arp,reg0=0,reg1=0 actions=NORMAL | |
4270 | table=8, n_packets=1, n_bytes=42, priority=0 actions=set_field:0->xreg0 | |
4271 | table=8, n_packets=1, n_bytes=42, reg2=0xa0101f0/0xfffffff0 actions=set_field:0x808888888888->xreg0 | |
4272 | OFPST_FLOW reply (OF1.5): | |
4273 | ]) | |
4274 | ||
a857bb69 DDP |
4275 | 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 |
4276 | 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 |
4277 | ]) |
4278 | ||
b020a416 DB |
4279 | AT_CHECK([tcpdump -v "icmp" -r p0.pcap 2>/dev/null | egrep 'wrong|bad'], [1], [ignore-nolog]) |
4280 | ||
9ac0aada JR |
4281 | OVS_TRAFFIC_VSWITCHD_STOP |
4282 | AT_CLEANUP | |
4283 | ||
2cd20955 | 4284 | dnl CHECK_FTP_NAT(TITLE, IP_ADDR, FLOWS, CT_DUMP) |
019c73ac | 4285 | dnl |
74f205f6 JS |
4286 | dnl Checks the implementation of conntrack with FTP ALGs in combination with |
4287 | dnl NAT, using the provided flow table. | |
4288 | m4_define([CHECK_FTP_NAT], | |
efa29a89 | 4289 | [AT_SETUP([conntrack - FTP $1]) |
40c7b2fc | 4290 | AT_SKIP_IF([test $HAVE_FTP = no]) |
253e4dc0 | 4291 | AT_SKIP_IF([test $HAVE_LFTP = no]) |
74f205f6 JS |
4292 | CHECK_CONNTRACK() |
4293 | CHECK_CONNTRACK_NAT() | |
fc9a5ee1 | 4294 | CHECK_CONNTRACK_ALG() |
019c73ac | 4295 | |
74f205f6 | 4296 | OVS_TRAFFIC_VSWITCHD_START() |
019c73ac | 4297 | |
74f205f6 | 4298 | ADD_NAMESPACES(at_ns0, at_ns1) |
019c73ac | 4299 | |
74f205f6 JS |
4300 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") |
4301 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4302 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
019c73ac | 4303 | |
74f205f6 | 4304 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. |
2cd20955 | 4305 | AT_DATA([flows.txt], [$3]) |
019c73ac | 4306 | |
74f205f6 | 4307 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) |
019c73ac | 4308 | |
7ed40afe | 4309 | OVS_START_L7([at_ns1], [ftp]) |
019c73ac | 4310 | |
74f205f6 | 4311 | dnl FTP requests from p0->p1 should work fine. |
253e4dc0 DM |
4312 | AT_DATA([ftp.cmd], [dnl |
4313 | set net:max-retries 1 | |
4314 | set net:timeout 1 | |
4315 | set ftp:passive-mode off | |
4316 | cache off | |
4317 | connect ftp://anonymous:@10.1.1.2 | |
4318 | ls | |
4319 | ls | |
4320 | ls | |
4321 | ls | |
4322 | ]) | |
4323 | NS_CHECK_EXEC([at_ns0], [lftp -f ftp.cmd > lftp.log]) | |
019c73ac | 4324 | |
74f205f6 | 4325 | dnl Discards CLOSE_WAIT and CLOSING |
2cd20955 | 4326 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [$4]) |
019c73ac | 4327 | |
74f205f6 JS |
4328 | OVS_TRAFFIC_VSWITCHD_STOP |
4329 | AT_CLEANUP]) | |
019c73ac | 4330 | |
efa29a89 | 4331 | dnl CHECK_FTP_SNAT_PRE_RECIRC(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
74f205f6 JS |
4332 | dnl |
4333 | dnl Checks the implementation of conntrack with FTP ALGs in combination with | |
4334 | dnl NAT, with flow tables that implement the NATing as part of handling of | |
4335 | dnl initial incoming packets - ie, the first flow is ct(nat,table=foo). | |
4336 | dnl | |
4337 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4338 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4339 | m4_define([CHECK_FTP_SNAT_PRE_RECIRC], [dnl |
4340 | CHECK_FTP_NAT([SNAT prerecirc $1], [$2], [dnl | |
9ac0aada JR |
4341 | dnl track all IP traffic, de-mangle non-NEW connections |
4342 | table=0 in_port=1, ip, action=ct(table=1,nat) | |
4343 | table=0 in_port=2, ip, action=ct(table=2,nat) | |
4344 | dnl | |
4345 | dnl ARP | |
4346 | dnl | |
4347 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4348 | table=0 priority=10 arp action=normal | |
4349 | table=0 priority=0 action=drop | |
4350 | dnl | |
4351 | dnl Table 1: port 1 -> 2 | |
4352 | dnl | |
4353 | dnl Allow new FTP connections. These need to be commited. | |
74f205f6 | 4354 | 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 | 4355 | dnl Allow established TCP connections, make sure they are NATted already. |
74f205f6 | 4356 | table=1 ct_state=+est, tcp, nw_src=$2, action=2 |
9ac0aada JR |
4357 | dnl |
4358 | dnl Table 1: droppers | |
4359 | dnl | |
4360 | table=1 priority=10, tcp, action=drop | |
4361 | table=1 priority=0,action=drop | |
4362 | dnl | |
4363 | dnl Table 2: port 2 -> 1 | |
4364 | dnl | |
4365 | dnl Allow established TCP connections, make sure they are reverse NATted | |
4366 | table=2 ct_state=+est, tcp, nw_dst=10.1.1.1, action=1 | |
4367 | dnl Allow (new) related (data) connections. These need to be commited. | |
74f205f6 | 4368 | table=2 ct_state=+new+rel, tcp, nw_dst=$2, action=ct(commit,nat),1 |
9ac0aada JR |
4369 | dnl Allow related ICMP packets, make sure they are reverse NATted |
4370 | table=2 ct_state=+rel, icmp, nw_dst=10.1.1.1, action=1 | |
4371 | dnl | |
4372 | dnl Table 2: droppers | |
4373 | dnl | |
4374 | table=2 priority=10, tcp, action=drop | |
4375 | table=2 priority=0, action=drop | |
4376 | dnl | |
4377 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4378 | dnl | |
74f205f6 | 4379 | table=8,reg2=$3/0xffffffff,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
9ac0aada JR |
4380 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4381 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4382 | dnl TPA IP in reg2. | |
4383 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4384 | table=10 priority=100 arp xreg0=0 action=normal | |
4385 | 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]] | |
4386 | table=10 priority=0 action=drop | |
2cd20955 JR |
4387 | ], [dnl |
4388 | 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 | |
4389 | 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>) | |
4390 | ]) | |
9ac0aada JR |
4391 | ]) |
4392 | ||
74f205f6 | 4393 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment. |
efa29a89 | 4394 | CHECK_FTP_SNAT_PRE_RECIRC([], [10.1.1.9], [0x0a010109]) |
9ac0aada | 4395 | |
74f205f6 JS |
4396 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment. |
4397 | dnl | |
4398 | dnl The FTP PORT command includes the ASCII representation of the address, | |
4399 | dnl so when these messages need to be NATed between addresses that have | |
4400 | dnl different lengths when represented in ASCII (such as the original address | |
4401 | dnl of 10.1.1.1 used in the test and 10.1.1.240 here), the FTP NAT ALG must | |
4402 | dnl resize the packet and adjust TCP sequence numbers. This test is kept | |
4403 | dnl separate from the above to easier identify issues in this code on different | |
4404 | dnl kernels. | |
efa29a89 | 4405 | CHECK_FTP_SNAT_PRE_RECIRC([seqadj], [10.1.1.240], [0x0a0101f0]) |
74f205f6 | 4406 | |
efa29a89 | 4407 | dnl CHECK_FTP_SNAT_POST_RECIRC(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
74f205f6 JS |
4408 | dnl |
4409 | dnl Checks the implementation of conntrack with FTP ALGs in combination with | |
4410 | dnl NAT, with flow tables that implement the NATing after the first round | |
4411 | dnl of recirculation - that is, the first flow ct(table=foo) then a subsequent | |
4412 | dnl flow will implement the NATing with ct(nat..),output:foo. | |
4413 | dnl | |
4414 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4415 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4416 | m4_define([CHECK_FTP_SNAT_POST_RECIRC], [dnl |
4417 | CHECK_FTP_NAT([SNAT postrecirc $1], [$2], [dnl | |
9ac0aada JR |
4418 | dnl track all IP traffic (this includes a helper call to non-NEW packets.) |
4419 | table=0 ip, action=ct(table=1) | |
4420 | dnl | |
4421 | dnl ARP | |
4422 | dnl | |
4423 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4424 | table=0 priority=10 arp action=normal | |
4425 | table=0 priority=0 action=drop | |
4426 | dnl | |
4427 | dnl Table 1 | |
4428 | dnl | |
4429 | dnl Allow new FTP connections. These need to be commited. | |
4430 | dnl This does helper for new packets. | |
74f205f6 | 4431 | table=1 in_port=1 ct_state=+new, tcp, tp_dst=21, action=ct(alg=ftp,commit,nat(src=$2)),2 |
9ac0aada JR |
4432 | dnl Allow and NAT established TCP connections |
4433 | table=1 in_port=1 ct_state=+est, tcp, action=ct(nat),2 | |
4434 | table=1 in_port=2 ct_state=+est, tcp, action=ct(nat),1 | |
4435 | dnl Allow and NAT (new) related active (data) connections. | |
4436 | dnl These need to be commited. | |
4437 | table=1 in_port=2 ct_state=+new+rel, tcp, action=ct(commit,nat),1 | |
4438 | dnl Allow related ICMP packets. | |
4439 | table=1 in_port=2 ct_state=+rel, icmp, action=ct(nat),1 | |
4440 | dnl Drop everything else. | |
4441 | table=1 priority=0, action=drop | |
4442 | dnl | |
4443 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4444 | dnl | |
74f205f6 | 4445 | table=8,reg2=$3/0xffffffff,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
9ac0aada JR |
4446 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4447 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4448 | dnl TPA IP in reg2. | |
4449 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4450 | table=10 priority=100 arp xreg0=0 action=normal | |
4451 | 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]] | |
4452 | table=10 priority=0 action=drop | |
2cd20955 JR |
4453 | ], [dnl |
4454 | 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 | |
4455 | 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>) | |
4456 | ]) | |
9ac0aada JR |
4457 | ]) |
4458 | ||
74f205f6 | 4459 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment. |
efa29a89 | 4460 | CHECK_FTP_SNAT_POST_RECIRC([], [10.1.1.9], [0x0a010109]) |
9ac0aada | 4461 | |
74f205f6 JS |
4462 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment. |
4463 | dnl | |
4464 | dnl The FTP PORT command includes the ASCII representation of the address, | |
4465 | dnl so when these messages need to be NATed between addresses that have | |
4466 | dnl different lengths when represented in ASCII (such as the original address | |
4467 | dnl of 10.1.1.1 used in the test and 10.1.1.240 here), the FTP NAT ALG must | |
4468 | dnl resize the packet and adjust TCP sequence numbers. This test is kept | |
4469 | dnl separate from the above to easier identify issues in this code on different | |
4470 | dnl kernels. | |
efa29a89 | 4471 | CHECK_FTP_SNAT_POST_RECIRC([seqadj], [10.1.1.240], [0x0a0101f0]) |
9ac0aada | 4472 | |
daf4d3c1 | 4473 | |
efa29a89 | 4474 | dnl CHECK_FTP_SNAT_ORIG_TUPLE(TITLE, IP_ADDR, IP_ADDR_AS_HEX) |
daf4d3c1 JR |
4475 | dnl |
4476 | dnl Checks the implementation of conntrack original direction tuple matching | |
4477 | dnl with FTP ALGs in combination with NAT, with flow tables that implement | |
4478 | dnl the NATing before the first round of recirculation - that is, the first | |
4479 | dnl flow ct(nat, table=foo) then a subsequent flow will implement the | |
4480 | dnl commiting of NATed and other connections with ct(nat..),output:foo. | |
4481 | dnl | |
4482 | dnl IP_ADDR must specify the NAT address in standard "10.1.1.x" format, | |
4483 | dnl and IP_ADDR_AS_HEX must specify the same address as hex, eg 0x0a0101xx. | |
efa29a89 DM |
4484 | m4_define([CHECK_FTP_SNAT_ORIG_TUPLE], [dnl |
4485 | CHECK_FTP_NAT([SNAT orig tuple $1], [$2], [dnl | |
2cd20955 JR |
4486 | dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2). |
4487 | dnl NAT is only applied to OUT-direction packets, so that ACL | |
4488 | dnl processing can be done with non-NATted headers. | |
4489 | dnl | |
4490 | dnl Track all IP traffic in the IN-direction (IN from Port 1). | |
4491 | table=0 in_port=1, ip, action=set_field:1->reg4,set_field:1->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1) | |
4492 | dnl Track all IP traffic in the OUT-direction (OUT to the Port 1). | |
4493 | 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 |
4494 | dnl |
4495 | dnl ARP | |
4496 | dnl | |
4497 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
4498 | table=0 priority=10 arp action=normal | |
4499 | table=0 priority=0 action=drop | |
4500 | dnl | |
2cd20955 JR |
4501 | dnl Pass tracked traffic through ACL, drop everything else. |
4502 | dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers | |
4503 | dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets | |
4504 | dnl get the ACL lookup using the conntrack tuple and the inverted direction. | |
4505 | dnl RELATED packets get ACL lookup using the conntrack tuple in the direction | |
28033773 | 4506 | dnl of the master connection, as stored in ct_label[0]. |
2cd20955 JR |
4507 | dnl |
4508 | dnl Incoming non-related packet in the original direction (ACL IN) | |
4509 | table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5 | |
4510 | dnl Incoming non-related reply packet (CT ACL OUT) | |
4511 | table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4 | |
4512 | dnl Outgoing non-related packet (ACL OUT) | |
4513 | table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5 | |
4514 | dnl Outgoing non-related reply packet (CT ACL IN) | |
4515 | table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4 | |
daf4d3c1 | 4516 | dnl |
2cd20955 | 4517 | dnl Related packet (CT ACL in the direction of the master connection.) |
28033773 | 4518 | 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 |
4519 | dnl Drop everything else. |
4520 | table=1 priority=0, action=drop | |
4521 | dnl | |
2cd20955 JR |
4522 | dnl "ACL table" |
4523 | dnl | |
4524 | dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with | |
4525 | dnl IP source address '10.1.1.1'. Store rule ID (1234) in reg1, verdict | |
4526 | dnl in reg2. | |
4527 | table=3 priority=10, reg0=1, ip, nw_src=10.1.1.1 action=set_field:1234->reg1,set_field:1->reg2 | |
4528 | dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235) | |
4529 | table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2 | |
4530 | dnl | |
4531 | dnl Re-process stateful traffic that was not accepted by a stateful rule as | |
4532 | dnl normal traffic in the current direction. This should also delete the | |
4533 | dnl now stale conntrack state, so that new state can be created in it's place. | |
4534 | dnl | |
4535 | dnl Stateful accepts go to next table. | |
4536 | table=4 priority=100 reg2=1, action=goto_table:5 | |
4537 | dnl Everything else is reprocessed disregarding the CT state, using the actual | |
4538 | dnl packet direction. | |
4539 | table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5 | |
4540 | dnl | |
4541 | dnl "ACL verdict processing table." | |
4542 | dnl | |
4543 | dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0) | |
4544 | dnl | |
4545 | dnl Drop all non-accepted packets. | |
4546 | table=5 reg2=0 priority=1000 action=drop | |
daf4d3c1 | 4547 | dnl |
2cd20955 JR |
4548 | dnl Commit new incoming FTP control connections with SNAT range. Must match on |
4549 | dnl 'tcp' when setting 'alg=ftp'. Store the directionality of non-related | |
28033773 JR |
4550 | dnl connections to ct_label[0] Store the rule ID to ct_label[96..127]. |
4551 | 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 | 4552 | dnl Commit other new incoming non-related IP connections with SNAT range. |
28033773 | 4553 | 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 |
4554 | dnl Commit non-related outgoing new IP connections with DNAT range. |
4555 | dnl (This should not get any packets in this test.) | |
28033773 | 4556 | 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 | 4557 | dnl Commit new related connections in either direction, which need 'nat' |
28033773 | 4558 | dnl and which inherit the label (the direction of the original direction |
2cd20955 JR |
4559 | dnl master tuple) from the master connection. |
4560 | 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 | |
4561 | dnl | |
4562 | dnl NAT incoming non-NEW packets. Outgoing packets were NATted in table 0. | |
4563 | dnl | |
4564 | table=5 priority=10 ct_state=-new+trk-inv reg3=1 ip, action=ct(zone=NXM_NX_REG4[[0..15]],nat),goto_table:6 | |
4565 | dnl Forward everything else, including stateless accepts. | |
4566 | table=5 priority=0 action=goto_table:6 | |
4567 | dnl | |
4568 | dnl "Forwarding table" | |
4569 | dnl | |
4570 | table=6 in_port=1 action=2 | |
4571 | table=6 in_port=2 action=1 | |
daf4d3c1 JR |
4572 | dnl |
4573 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
4574 | dnl | |
2cd20955 | 4575 | table=8,reg2=$3,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] |
daf4d3c1 JR |
4576 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] |
4577 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
4578 | dnl TPA IP in reg2. | |
4579 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
4580 | table=10 priority=100 arp xreg0=0 action=normal | |
4581 | 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]] | |
4582 | table=10 priority=0 action=drop | |
2cd20955 | 4583 | ], [dnl |
28033773 JR |
4584 | 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 |
4585 | 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 | 4586 | ]) |
daf4d3c1 JR |
4587 | ]) |
4588 | ||
4589 | dnl Check that ct(nat,table=foo) works without TCP sequence adjustment with | |
4590 | dnl an ACL table based on matching on conntrack original direction tuple only. | |
efa29a89 | 4591 | CHECK_FTP_SNAT_ORIG_TUPLE([], [10.1.1.9], [0x0a010109]) |
daf4d3c1 JR |
4592 | |
4593 | dnl Check that ct(nat,table=foo) works with TCP sequence adjustment with | |
4594 | dnl an ACL table based on matching on conntrack original direction tuple only. | |
efa29a89 | 4595 | CHECK_FTP_SNAT_ORIG_TUPLE([seqadj], [10.1.1.240], [0x0a0101f0]) |
daf4d3c1 | 4596 | |
efa29a89 | 4597 | AT_SETUP([conntrack - IPv4 FTP Passive with SNAT]) |
200a9af9 DB |
4598 | AT_SKIP_IF([test $HAVE_FTP = no]) |
4599 | CHECK_CONNTRACK() | |
4600 | CHECK_CONNTRACK_NAT() | |
4601 | CHECK_CONNTRACK_ALG() | |
4602 | ||
4603 | OVS_TRAFFIC_VSWITCHD_START() | |
4604 | ||
4605 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4606 | ||
4607 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4608 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4609 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4610 | ||
4611 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
4612 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4613 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4614 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
4615 | ||
4616 | dnl Allow any traffic from ns0->ns1. | |
4617 | AT_DATA([flows.txt], [dnl | |
4618 | dnl track all IPv4 traffic and NAT any established traffic. | |
4619 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4620 | table=0 priority=0 action=drop | |
4621 | dnl | |
4622 | dnl Table 1 | |
4623 | dnl | |
4624 | dnl Allow new FTP control connections. | |
4625 | 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 | |
4626 | dnl Allow related TCP connections from port 1. | |
4627 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
4628 | dnl Allow established TCP connections both ways, post-NAT match. | |
4629 | table=1 in_port=1 ct_state=+est tcp nw_src=10.1.1.240 action=2 | |
4630 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4631 | ||
4632 | dnl Allow ICMP both ways. | |
4633 | table=1 priority=100 in_port=1 icmp, action=2 | |
4634 | table=1 priority=100 in_port=2 icmp, action=1 | |
4635 | table=1 priority=0, action=drop | |
4636 | ]) | |
4637 | ||
4638 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4639 | ||
4640 | dnl Check that the stacks working to avoid races. | |
4641 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
4642 | ||
4643 | OVS_START_L7([at_ns1], [ftp]) | |
4644 | ||
4645 | dnl FTP requests from p0->p1 should work fine. | |
4646 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4647 | ||
4648 | dnl Discards CLOSE_WAIT and CLOSING | |
4649 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4650 | 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>) | |
4651 | 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 | |
4652 | ]) | |
4653 | ||
4654 | OVS_TRAFFIC_VSWITCHD_STOP | |
4655 | AT_CLEANUP | |
4656 | ||
efa29a89 DM |
4657 | AT_SETUP([conntrack - IPv4 FTP Passive with DNAT]) |
4658 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
4659 | CHECK_CONNTRACK() | |
4660 | CHECK_CONNTRACK_NAT() | |
4661 | CHECK_CONNTRACK_ALG() | |
4662 | ||
4663 | OVS_TRAFFIC_VSWITCHD_START() | |
4664 | ||
4665 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4666 | ||
4667 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4668 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4669 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4670 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.240 e6:66:c1:22:22:22]) | |
4671 | ||
4672 | ADD_VETH(p1, at_ns1, br0, "10.1.1.240/24") | |
4673 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4674 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4675 | ||
4676 | dnl Allow any traffic from ns0->ns1. | |
4677 | AT_DATA([flows.txt], [dnl | |
4678 | dnl track all IPv4 traffic and NAT any established traffic. | |
4679 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4680 | table=0 priority=0 action=drop | |
4681 | dnl | |
4682 | dnl Table 1 | |
4683 | dnl | |
4684 | dnl Allow new FTP control connections. | |
4685 | 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 | |
4686 | dnl Allow related TCP connections from port 1. | |
4687 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
4688 | dnl Allow established TCP connections both ways, post-NAT match. | |
4689 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.240 action=2 | |
4690 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4691 | ||
4692 | dnl Allow ICMP both ways. | |
4693 | table=1 priority=100 in_port=1 icmp, action=2 | |
4694 | table=1 priority=100 in_port=2 icmp, action=1 | |
4695 | table=1 priority=0, action=drop | |
4696 | ]) | |
4697 | ||
4698 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4699 | ||
4700 | dnl Check that the stacks working to avoid races. | |
4701 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.240 >/dev/null]) | |
4702 | ||
4703 | OVS_START_L7([at_ns1], [ftp]) | |
4704 | ||
4705 | dnl FTP requests from p0->p1 should work fine. | |
4706 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4707 | ||
4708 | dnl Discards CLOSE_WAIT and CLOSING | |
4709 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4710 | 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>) | |
4711 | 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 | |
4712 | ]) | |
4713 | ||
4714 | OVS_TRAFFIC_VSWITCHD_STOP | |
4715 | AT_CLEANUP | |
4716 | ||
cd7c99a6 DB |
4717 | AT_SETUP([conntrack - IPv4 FTP Passive with DNAT 2]) |
4718 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
4719 | CHECK_CONNTRACK() | |
4720 | CHECK_CONNTRACK_NAT() | |
4721 | CHECK_CONNTRACK_ALG() | |
4722 | ||
4723 | OVS_TRAFFIC_VSWITCHD_START() | |
4724 | ||
4725 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4726 | ||
4727 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/16") | |
4728 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4729 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.200 e6:66:c1:22:22:22]) | |
4730 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.100.1 e6:66:c1:22:22:22]) | |
4731 | ||
4732 | ADD_VETH(p1, at_ns1, br0, "10.1.100.1/16") | |
4733 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4734 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4735 | ||
4736 | dnl Allow any traffic from ns0->ns1. | |
4737 | AT_DATA([flows.txt], [dnl | |
4738 | dnl track all IPv4 traffic and NAT any established traffic. | |
4739 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4740 | table=0 priority=0 action=drop | |
4741 | dnl | |
4742 | dnl Table 1 | |
4743 | dnl | |
4744 | dnl Allow new FTP control connections. | |
4745 | 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 | |
4746 | dnl Allow related TCP connections from port 1. | |
4747 | table=1 in_port=1 ct_state=+new+rel tcp nw_src=10.1.1.1 action=ct(commit,nat),2 | |
4748 | dnl Allow established TCP connections both ways, post-NAT match. | |
4749 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.100.1 action=2 | |
4750 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4751 | ||
4752 | dnl Allow ICMP both ways. | |
4753 | table=1 priority=100 in_port=1 icmp, action=2 | |
4754 | table=1 priority=100 in_port=2 icmp, action=1 | |
4755 | table=1 priority=0, action=drop | |
4756 | ]) | |
4757 | ||
4758 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4759 | ||
4760 | dnl Check that the stacks working to avoid races. | |
4761 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.100.1 >/dev/null]) | |
4762 | ||
4763 | OVS_START_L7([at_ns1], [ftp]) | |
4764 | ||
4765 | dnl FTP requests from p0->p1 should work fine. | |
4766 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.200 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4767 | ||
4768 | dnl Discards CLOSE_WAIT and CLOSING | |
4769 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.200)], [0], [dnl | |
4770 | 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>) | |
4771 | 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 | |
4772 | ]) | |
4773 | ||
4774 | OVS_TRAFFIC_VSWITCHD_STOP | |
4775 | AT_CLEANUP | |
4776 | ||
efa29a89 DM |
4777 | AT_SETUP([conntrack - IPv4 FTP Active with DNAT]) |
4778 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
4779 | CHECK_CONNTRACK() | |
4780 | CHECK_CONNTRACK_NAT() | |
4781 | CHECK_CONNTRACK_ALG() | |
4782 | ||
4783 | OVS_TRAFFIC_VSWITCHD_START() | |
4784 | ||
4785 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4786 | ||
4787 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
4788 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
4789 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
4790 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.240 e6:66:c1:22:22:22]) | |
4791 | ||
4792 | ADD_VETH(p1, at_ns1, br0, "10.1.1.240/24") | |
4793 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
4794 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4795 | ||
4796 | dnl Allow any traffic from ns0->ns1. | |
4797 | AT_DATA([flows.txt], [dnl | |
4798 | dnl track all IPv4 traffic and NAT any established traffic. | |
4799 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4800 | table=0 priority=0 action=drop | |
4801 | dnl | |
4802 | dnl Table 1 | |
4803 | dnl | |
4804 | dnl Allow new FTP control connections. | |
4805 | 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 | |
4806 | dnl Allow related TCP connections from port 1. | |
4807 | table=1 in_port=2 ct_state=+new+rel tcp nw_src=10.1.1.240 action=ct(commit,nat),1 | |
4808 | dnl Allow established TCP connections both ways, post-NAT match. | |
4809 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.240 action=2 | |
4810 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4811 | ||
4812 | dnl Allow ICMP both ways. | |
4813 | table=1 priority=100 in_port=1 icmp, action=2 | |
4814 | table=1 priority=100 in_port=2 icmp, action=1 | |
4815 | table=1 priority=0, action=drop | |
4816 | ]) | |
4817 | ||
4818 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4819 | ||
4820 | dnl Check that the stacks working to avoid races. | |
4821 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.240 >/dev/null]) | |
4822 | ||
4823 | OVS_START_L7([at_ns1], [ftp]) | |
4824 | ||
4825 | dnl FTP requests from p0->p1 should work fine. | |
4826 | NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4827 | ||
4828 | dnl Discards CLOSE_WAIT and CLOSING | |
4829 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
4830 | 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 | |
4831 | 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>) | |
4832 | ]) | |
4833 | ||
4834 | OVS_TRAFFIC_VSWITCHD_STOP | |
4835 | AT_CLEANUP | |
4836 | ||
4837 | AT_SETUP([conntrack - IPv4 FTP Active with DNAT with reverse skew]) | |
4838 | AT_SKIP_IF([test $HAVE_FTP = no]) | |
4839 | CHECK_CONNTRACK() | |
4840 | CHECK_CONNTRACK_NAT() | |
4841 | CHECK_CONNTRACK_ALG() | |
4842 | ||
4843 | OVS_TRAFFIC_VSWITCHD_START() | |
4844 | ||
4845 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4846 | ||
cd7c99a6 | 4847 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/16") |
efa29a89 DM |
4848 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) |
4849 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
cd7c99a6 | 4850 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.120.240 e6:66:c1:22:22:22]) |
efa29a89 | 4851 | |
cd7c99a6 | 4852 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/16") |
efa29a89 DM |
4853 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) |
4854 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
4855 | ||
4856 | dnl Allow any traffic from ns0->ns1. | |
4857 | AT_DATA([flows.txt], [dnl | |
4858 | dnl track all IPv4 traffic and NAT any established traffic. | |
4859 | table=0 priority=10 ip, action=ct(nat,table=1) | |
4860 | table=0 priority=0 action=drop | |
4861 | dnl | |
4862 | dnl Table 1 | |
4863 | dnl | |
4864 | dnl Allow new FTP control connections. | |
4865 | 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 | |
4866 | dnl Allow related TCP connections from port 1. | |
4867 | table=1 in_port=2 ct_state=+new+rel tcp nw_src=10.1.1.2 action=ct(commit,nat),1 | |
4868 | dnl Allow established TCP connections both ways, post-NAT match. | |
4869 | table=1 in_port=1 ct_state=+est tcp nw_dst=10.1.1.2 action=2 | |
4870 | table=1 in_port=2 ct_state=+est tcp nw_dst=10.1.1.1 action=1 | |
4871 | ||
4872 | dnl Allow ICMP both ways. | |
4873 | table=1 priority=100 in_port=1 icmp, action=2 | |
4874 | table=1 priority=100 in_port=2 icmp, action=1 | |
4875 | table=1 priority=0, action=drop | |
4876 | ]) | |
4877 | ||
4878 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4879 | ||
4880 | dnl Check that the stacks working to avoid races. | |
4881 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
4882 | ||
4883 | OVS_START_L7([at_ns1], [ftp]) | |
4884 | ||
4885 | dnl FTP requests from p0->p1 should work fine. | |
cd7c99a6 | 4886 | 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 |
4887 | |
4888 | dnl Discards CLOSE_WAIT and CLOSING | |
cd7c99a6 DB |
4889 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.120.240)], [0], [dnl |
4890 | 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 | |
4891 | 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 |
4892 | ]) |
4893 | ||
4894 | OVS_TRAFFIC_VSWITCHD_STOP | |
4895 | AT_CLEANUP | |
4896 | ||
b020a416 | 4897 | AT_SETUP([conntrack - IPv6 HTTP with SNAT]) |
9ac0aada | 4898 | CHECK_CONNTRACK() |
4573c42e | 4899 | CHECK_CONNTRACK_NAT() |
9ac0aada JR |
4900 | OVS_TRAFFIC_VSWITCHD_START() |
4901 | ||
4902 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4903 | ||
4904 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
4905 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
4906 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
4907 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
b020a416 | 4908 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::241 lladdr 80:88:88:88:88:88 dev p1]) |
9ac0aada JR |
4909 | |
4910 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4911 | AT_DATA([flows.txt], [dnl | |
4912 | priority=1,action=drop | |
4913 | priority=10,icmp6,action=normal | |
b020a416 | 4914 | priority=100,in_port=1,ip6,action=ct(commit,nat(src=fc00::240-fc00::241)),2 |
9ac0aada JR |
4915 | priority=100,in_port=2,ct_state=-trk,ip6,action=ct(nat,table=0) |
4916 | priority=100,in_port=2,ct_state=+trk+est,ip6,action=1 | |
4917 | 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 | 4918 | 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 |
4919 | ]) |
4920 | ||
4921 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4922 | ||
c10840ff JS |
4923 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
4924 | dnl waiting, we get occasional failures due to the following error: | |
9ac0aada | 4925 | dnl "connect: Cannot assign requested address" |
c10840ff | 4926 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) |
9ac0aada JR |
4927 | |
4928 | dnl HTTP requests from ns0->ns1 should work fine. | |
7ed40afe | 4929 | OVS_START_L7([at_ns1], [http6]) |
9ac0aada JR |
4930 | |
4931 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused -v -o wget0.log]) | |
4932 | ||
4933 | dnl HTTP requests from ns1->ns0 should fail due to network failure. | |
4934 | dnl Try 3 times, in 1 second intervals. | |
7ed40afe | 4935 | OVS_START_L7([at_ns0], [http6]) |
9ac0aada JR |
4936 | NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 -v -o wget1.log], [4]) |
4937 | ||
4938 | OVS_TRAFFIC_VSWITCHD_STOP | |
4939 | AT_CLEANUP | |
4940 | ||
b020a416 DB |
4941 | AT_SETUP([conntrack - IPv6 HTTP with DNAT]) |
4942 | CHECK_CONNTRACK() | |
4943 | CHECK_CONNTRACK_NAT() | |
4944 | OVS_TRAFFIC_VSWITCHD_START() | |
4945 | ||
4946 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4947 | ||
4948 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
4949 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
4950 | NS_CHECK_EXEC([at_ns0], [ip -6 link set dev p0 address 80:88:88:88:88:77]) | |
4951 | NS_CHECK_EXEC([at_ns1], [ip -6 link set dev p1 address 80:88:88:88:88:88]) | |
4952 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p0]) | |
4953 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:77 dev p1]) | |
4954 | ||
4955 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
4956 | AT_DATA([flows.txt], [dnl | |
4957 | priority=100 in_port=1,ip6,ipv6_dst=fc00::240,action=ct(zone=1,nat(dst=fc00::2),commit),2 | |
4958 | priority=100 in_port=2,ct_state=-trk,ip6,action=ct(table=0,nat,zone=1) | |
4959 | priority=100 in_port=2,ct_state=+trk+est,ct_zone=1,ip6,action=1 | |
4960 | ]) | |
4961 | ||
4962 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
4963 | ||
4964 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
4965 | dnl waiting, we get occasional failures due to the following error: | |
4966 | dnl "connect: Cannot assign requested address" | |
4967 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::240]) | |
4968 | ||
4969 | NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::240 | FORMAT_PING], [0], [dnl | |
4970 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
4971 | ]) | |
4972 | ||
4973 | dnl Should work with the virtual IP address through NAT | |
4974 | OVS_START_L7([at_ns1], [http6]) | |
4975 | NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::240]] -t 5 -T 1 --retry-connrefused -v -o wget0.log]) | |
4976 | ||
4977 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::1)], [0], [dnl | |
4978 | 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 | |
4979 | 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>) | |
4980 | ]) | |
4981 | ||
4982 | OVS_TRAFFIC_VSWITCHD_STOP | |
4983 | AT_CLEANUP | |
4984 | ||
4985 | AT_SETUP([conntrack - IPv6 ICMP6 Related with SNAT]) | |
4986 | AT_SKIP_IF([test $HAVE_TCPDUMP = no]) | |
4987 | CHECK_CONNTRACK() | |
4988 | CHECK_CONNTRACK_NAT() | |
4989 | OVS_TRAFFIC_VSWITCHD_START() | |
4990 | ||
4991 | ADD_NAMESPACES(at_ns0, at_ns1) | |
4992 | ||
4993 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
4994 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
4995 | NS_CHECK_EXEC([at_ns0], [ip -6 link set dev p0 address 80:88:88:88:88:77]) | |
4996 | NS_CHECK_EXEC([at_ns1], [ip -6 link set dev p1 address 80:88:88:88:88:88]) | |
4997 | ||
4998 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:88 dev p0]) | |
4999 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::3 lladdr 80:88:88:88:88:88 dev p0]) | |
5000 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:77 dev p1]) | |
5001 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::1 lladdr 80:88:88:88:88:77 dev p1]) | |
5002 | ||
5003 | NS_CHECK_EXEC([at_ns0], [ip -6 route add default via fc00::2]) | |
5004 | ||
5005 | dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0. | |
5006 | AT_DATA([flows.txt], [dnl | |
5007 | priority=100 in_port=1,ip6,action=ct(nat(src=fc00::240),commit),2 | |
5008 | priority=100 in_port=2,ct_state=-trk,ip6,action=ct(table=0,nat) | |
5009 | priority=100 in_port=2,ct_state=+trk+est,ip6,action=1 | |
5010 | priority=100 in_port=2,ct_state=+trk+rel,ip6,action=1 | |
5011 | ]) | |
5012 | ||
5013 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5014 | ||
5015 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5016 | dnl waiting, we get occasional failures due to the following error: | |
5017 | dnl "connect: Cannot assign requested address" | |
5018 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2]) | |
5019 | ||
5020 | AT_CHECK([ovs-appctl dpctl/flush-conntrack]) | |
5021 | ||
5022 | rm p0.pcap | |
5023 | tcpdump -U -i ovs-p0 -w p0.pcap & | |
5024 | sleep 1 | |
5025 | ||
5026 | dnl UDP packets from ns0->ns1 should solicit "destination unreachable" response. | |
5027 | NS_CHECK_EXEC([at_ns0], [bash -c "echo a | nc -6 $NC_EOF_OPT -u fc00::2 1"]) | |
5028 | ||
5029 | AT_CHECK([tcpdump -v "icmp6" -r p0.pcap 2>/dev/null | egrep 'wrong|bad'], [1], [ignore-nolog]) | |
5030 | ||
5031 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5032 | udp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::240,sport=<cleared>,dport=<cleared>) | |
5033 | ]) | |
5034 | ||
5035 | OVS_TRAFFIC_VSWITCHD_STOP | |
5036 | AT_CLEANUP | |
9ac0aada | 5037 | |
efa29a89 | 5038 | AT_SETUP([conntrack - IPv6 FTP with SNAT]) |
40c7b2fc | 5039 | AT_SKIP_IF([test $HAVE_FTP = no]) |
9ac0aada | 5040 | CHECK_CONNTRACK() |
4573c42e | 5041 | CHECK_CONNTRACK_NAT() |
fc9a5ee1 DB |
5042 | CHECK_CONNTRACK_ALG() |
5043 | ||
9ac0aada JR |
5044 | OVS_TRAFFIC_VSWITCHD_START() |
5045 | ||
5046 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5047 | ||
5048 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5049 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5050 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5051 | dnl Would be nice if NAT could translate neighbor discovery messages, too. | |
5052 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5053 | ||
5054 | dnl Allow any traffic from ns0->ns1. | |
5055 | dnl Only allow nd, return traffic from ns1->ns0. | |
5056 | AT_DATA([flows.txt], [dnl | |
9ac0aada JR |
5057 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) |
5058 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5059 | table=0 priority=0 action=drop | |
5060 | dnl | |
5061 | dnl Table 1 | |
5062 | dnl | |
5063 | dnl Allow new TCPv6 FTP control connections. | |
5064 | 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 | |
5065 | dnl Allow related TCPv6 connections from port 2 to the NATted address. | |
5066 | table=1 in_port=2 ct_state=+new+rel tcp6 ipv6_dst=fc00::240 action=ct(commit,nat),1 | |
5067 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5068 | table=1 in_port=1 ct_state=+est tcp6 ipv6_src=fc00::240 action=2 | |
5069 | table=1 in_port=2 ct_state=+est tcp6 ipv6_dst=fc00::1 action=1 | |
daf4d3c1 JR |
5070 | dnl Allow other ICMPv6 both ways (without commit). |
5071 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5072 | table=1 priority=100 in_port=2 icmp6, action=1 | |
9ac0aada JR |
5073 | dnl Drop everything else. |
5074 | table=1 priority=0, action=drop | |
5075 | ]) | |
5076 | ||
5077 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5078 | ||
c10840ff JS |
5079 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without |
5080 | dnl waiting, we get occasional failures due to the following error: | |
5081 | dnl "connect: Cannot assign requested address" | |
5082 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5083 | ||
7ed40afe | 5084 | OVS_START_L7([at_ns1], [ftp]) |
9ac0aada JR |
5085 | |
5086 | dnl FTP requests from p0->p1 should work fine. | |
4fee8b13 | 5087 | 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 | 5088 | |
a857bb69 | 5089 | dnl Discards CLOSE_WAIT and CLOSING |
420c73b2 JR |
5090 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl |
5091 | 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 | |
5092 | 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 |
5093 | ]) |
5094 | ||
5095 | OVS_TRAFFIC_VSWITCHD_STOP | |
5096 | AT_CLEANUP | |
2c66ebe4 | 5097 | |
efa29a89 | 5098 | AT_SETUP([conntrack - IPv6 FTP Passive with SNAT]) |
200a9af9 DB |
5099 | AT_SKIP_IF([test $HAVE_FTP = no]) |
5100 | CHECK_CONNTRACK() | |
5101 | CHECK_CONNTRACK_NAT() | |
5102 | CHECK_CONNTRACK_ALG() | |
5103 | ||
5104 | OVS_TRAFFIC_VSWITCHD_START() | |
5105 | ||
5106 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5107 | ||
5108 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5109 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5110 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5111 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:99]) | |
5112 | NS_CHECK_EXEC([at_ns0], [ip -6 neigh add fc00::2 lladdr 80:88:88:88:88:99 dev p0]) | |
5113 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5114 | ||
5115 | dnl Allow any traffic from ns0->ns1. | |
5116 | dnl Only allow nd, return traffic from ns1->ns0. | |
5117 | AT_DATA([flows.txt], [dnl | |
5118 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) | |
5119 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5120 | table=0 priority=0 action=drop | |
5121 | dnl | |
5122 | dnl Table 1 | |
5123 | dnl | |
5124 | dnl Allow new TCPv6 FTP control connections. | |
5125 | 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 | |
5126 | dnl Allow related TCPv6 connections from port 1. | |
5127 | table=1 in_port=1 ct_state=+new+rel tcp6 ipv6_dst=fc00::2 action=ct(commit,nat),2 | |
5128 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5129 | table=1 in_port=1 ct_state=+est tcp6 ipv6_src=fc00::240 action=2 | |
5130 | table=1 in_port=2 ct_state=+est tcp6 ipv6_dst=fc00::1 action=1 | |
5131 | dnl Allow other ICMPv6 both ways (without commit). | |
5132 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5133 | table=1 priority=100 in_port=2 icmp6, action=1 | |
5134 | dnl Drop everything else. | |
5135 | table=1 priority=0, action=drop | |
5136 | ]) | |
5137 | ||
5138 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5139 | ||
5140 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5141 | dnl waiting, we get occasional failures due to the following error: | |
5142 | dnl "connect: Cannot assign requested address" | |
5143 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5144 | ||
5145 | OVS_START_L7([at_ns1], [ftp]) | |
5146 | ||
5147 | dnl FTP requests from p0->p1 should work fine. | |
5148 | 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]) | |
5149 | ||
5150 | dnl Discards CLOSE_WAIT and CLOSING | |
5151 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5152 | 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>) | |
5153 | 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 | |
5154 | ]) | |
5155 | ||
5156 | OVS_TRAFFIC_VSWITCHD_STOP | |
5157 | AT_CLEANUP | |
daf4d3c1 | 5158 | |
efa29a89 | 5159 | AT_SETUP([conntrack - IPv6 FTP with SNAT - orig tuple]) |
daf4d3c1 JR |
5160 | AT_SKIP_IF([test $HAVE_FTP = no]) |
5161 | CHECK_CONNTRACK() | |
5162 | CHECK_CONNTRACK_NAT() | |
aeae4330 | 5163 | CHECK_CONNTRACK_ALG() |
daf4d3c1 JR |
5164 | OVS_TRAFFIC_VSWITCHD_START() |
5165 | ||
5166 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5167 | ||
5168 | ADD_VETH(p0, at_ns0, br0, "fc00::1/96") | |
5169 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address 80:88:88:88:88:88]) | |
5170 | ADD_VETH(p1, at_ns1, br0, "fc00::2/96") | |
5171 | dnl Would be nice if NAT could translate neighbor discovery messages, too. | |
5172 | NS_CHECK_EXEC([at_ns1], [ip -6 neigh add fc00::240 lladdr 80:88:88:88:88:88 dev p1]) | |
5173 | ||
5174 | dnl Allow any traffic from ns0->ns1. | |
5175 | dnl Only allow nd, return traffic from ns1->ns0. | |
5176 | AT_DATA([flows.txt], [dnl | |
5177 | dnl track all IPv6 traffic (this includes NAT & help to non-NEW packets.) | |
5178 | table=0 priority=10 ip6, action=ct(nat,table=1) | |
5179 | table=0 priority=0 action=drop | |
5180 | dnl | |
5181 | dnl Table 1 | |
5182 | dnl | |
5183 | dnl Allow other ICMPv6 both ways (without commit). | |
5184 | table=1 priority=100 in_port=1 icmp6, action=2 | |
5185 | table=1 priority=100 in_port=2 icmp6, action=1 | |
5186 | dnl Allow new TCPv6 FTP control connections. | |
5187 | 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 | |
5188 | dnl Allow related TCPv6 connections from port 2 to the NATted address. | |
5189 | 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 | |
5190 | dnl Allow established TCPv6 connections both ways, enforce NATting | |
5191 | 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 | |
5192 | 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 | |
5193 | dnl Drop everything else. | |
5194 | table=1 priority=0, action=drop | |
5195 | ]) | |
5196 | ||
5197 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5198 | ||
5199 | dnl Linux seems to take a little time to get its IPv6 stack in order. Without | |
5200 | dnl waiting, we get occasional failures due to the following error: | |
5201 | dnl "connect: Cannot assign requested address" | |
5202 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) | |
5203 | ||
5204 | NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid]) | |
5205 | OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) | |
5206 | ||
5207 | dnl FTP requests from p0->p1 should work fine. | |
5208 | 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]) | |
5209 | ||
5210 | dnl Discards CLOSE_WAIT and CLOSING | |
5211 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl | |
5212 | 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 | |
5213 | 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>) | |
5214 | ]) | |
5215 | ||
5216 | OVS_TRAFFIC_VSWITCHD_STOP | |
5217 | AT_CLEANUP | |
5218 | ||
efa29a89 | 5219 | AT_SETUP([conntrack - IPv4 TFTP with SNAT]) |
8fc6257b | 5220 | AT_SKIP_IF([test $HAVE_TFTP = no]) |
200a9af9 DB |
5221 | CHECK_CONNTRACK() |
5222 | CHECK_CONNTRACK_NAT() | |
5223 | CHECK_CONNTRACK_ALG() | |
5224 | ||
5225 | OVS_TRAFFIC_VSWITCHD_START() | |
5226 | ||
5227 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5228 | ||
5229 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5230 | NS_CHECK_EXEC([at_ns0], [ip link set dev p0 address e6:66:c1:11:11:11]) | |
5231 | NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22]) | |
5232 | ||
5233 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
5234 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address e6:66:c1:22:22:22]) | |
5235 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.1 e6:66:c1:11:11:11]) | |
5236 | NS_CHECK_EXEC([at_ns1], [arp -s 10.1.1.240 e6:66:c1:11:11:11]) | |
5237 | ||
5238 | dnl Allow any traffic from ns0->ns1. | |
5239 | AT_DATA([flows.txt], [dnl | |
5240 | dnl track all IPv4 traffic. | |
5241 | table=0 priority=10 ip, action=ct(table=1) | |
5242 | dnl drop everything else. | |
5243 | table=0 priority=0 action=drop | |
5244 | dnl | |
5245 | dnl Table 1 | |
5246 | dnl Allow ICMP both ways. | |
5247 | table=1 priority=100 in_port=1 icmp, action=2 | |
5248 | table=1 priority=100 in_port=2 icmp, action=1 | |
5249 | dnl | |
5250 | dnl Allow new TFTP control connections. | |
5251 | 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 | |
5252 | dnl Allow related UDP connections from port 1. | |
5253 | table=1 in_port=2 ct_state=+new+rel udp nw_src=10.1.1.2 action=ct(commit,nat),1 | |
5254 | dnl Allow established and NAT them. | |
5255 | table=1 in_port=1 ct_state=+est udp nw_src=10.1.1.1 action=ct(nat,table=2) | |
5256 | table=1 in_port=2 ct_state=+est udp nw_src=10.1.1.2 action=ct(nat,table=2) | |
5257 | dnl | |
5258 | table=1 priority=0, action=drop | |
5259 | dnl | |
5260 | table=2 in_port=1 ct_state=+est udp nw_src=10.1.1.240 action=2 | |
5261 | table=2 in_port=2 ct_state=+est udp nw_dst=10.1.1.1 action=1 | |
5262 | ]) | |
5263 | ||
5264 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5265 | ||
5266 | dnl Check that the stacks working to avoid races. | |
5267 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2 >/dev/null]) | |
5268 | ||
5269 | OVS_START_L7([at_ns0], [tftp]) | |
5270 | OVS_START_L7([at_ns1], [tftp]) | |
5271 | ||
5272 | dnl TFTP requests from p0->p1 should work fine. | |
5273 | NS_CHECK_EXEC([at_ns0], [[curl $CURL_OPT tftp://10.1.1.2/flows.txt -o foo 2>curl0.log]]) | |
5274 | ||
5275 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl | |
5276 | 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 | |
5277 | 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>) | |
5278 | ]) | |
5279 | ||
5280 | OVS_TRAFFIC_VSWITCHD_STOP | |
5281 | AT_CLEANUP | |
daf4d3c1 | 5282 | |
2c66ebe4 JR |
5283 | AT_SETUP([conntrack - DNAT load balancing]) |
5284 | CHECK_CONNTRACK() | |
4573c42e | 5285 | CHECK_CONNTRACK_NAT() |
2c66ebe4 JR |
5286 | OVS_TRAFFIC_VSWITCHD_START() |
5287 | ||
5288 | ADD_NAMESPACES(at_ns1, at_ns2, at_ns3, at_ns4) | |
5289 | ||
5290 | ADD_VETH(p1, at_ns1, br0, "10.1.1.1/24") | |
5291 | ADD_VETH(p2, at_ns2, br0, "10.1.1.2/24") | |
5292 | ADD_VETH(p3, at_ns3, br0, "10.1.1.3/24") | |
5293 | ADD_VETH(p4, at_ns4, br0, "10.1.1.4/24") | |
5294 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:11]) | |
5295 | NS_CHECK_EXEC([at_ns2], [ip link set dev p2 address 80:88:88:88:88:22]) | |
5296 | NS_CHECK_EXEC([at_ns3], [ip link set dev p3 address 80:88:88:88:88:33]) | |
5297 | NS_CHECK_EXEC([at_ns4], [ip link set dev p4 address 80:88:88:88:88:44]) | |
5298 | ||
5299 | dnl Select group for load balancing. One bucket per server. Each bucket | |
5300 | dnl tracks and NATs the connection and recirculates to table 4 for egress | |
5301 | dnl routing. Packets of existing connections are always NATted based on | |
5302 | dnl connection state, only new connections are NATted according to the | |
5303 | dnl specific NAT parameters in each bucket. | |
5304 | 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)"]) | |
5305 | ||
5306 | AT_DATA([flows.txt], [dnl | |
5307 | dnl Track connections to the virtual IP address. | |
5308 | table=0 priority=100 ip nw_dst=10.1.1.64 action=group:234 | |
5309 | dnl All other IP traffic is allowed but the connection state is no commited. | |
5310 | table=0 priority=90 ip action=ct(table=4,nat) | |
5311 | dnl | |
5312 | dnl Allow ARP, but generate responses for virtual addresses | |
5313 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
5314 | table=0 priority=10 arp action=normal | |
5315 | table=0 priority=0 action=drop | |
5316 | dnl | |
5317 | dnl Routing table | |
5318 | dnl | |
5319 | table=4,ip,nw_dst=10.1.1.1 action=mod_dl_dst:80:88:88:88:88:11,output:1 | |
5320 | table=4,ip,nw_dst=10.1.1.2 action=mod_dl_dst:80:88:88:88:88:22,output:2 | |
5321 | table=4,ip,nw_dst=10.1.1.3 action=mod_dl_dst:80:88:88:88:88:33,output:3 | |
5322 | table=4,ip,nw_dst=10.1.1.4 action=mod_dl_dst:80:88:88:88:88:44,output:4 | |
5323 | table=4 priority=0 action=drop | |
5324 | dnl | |
5325 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
5326 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
5327 | dnl Zero result means not found. | |
5328 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
5329 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
5330 | dnl TPA IP in reg2. | |
5331 | table=10 priority=100 arp xreg0=0 action=normal | |
5332 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
5333 | 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]] | |
5334 | table=10 priority=0 action=controller | |
5335 | ]) | |
5336 | ||
5337 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5338 | ||
5339 | dnl Start web servers | |
7ed40afe JS |
5340 | OVS_START_L7([at_ns2], [http]) |
5341 | OVS_START_L7([at_ns3], [http]) | |
5342 | OVS_START_L7([at_ns4], [http]) | |
2c66ebe4 JR |
5343 | |
5344 | on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0' | |
5345 | on_exit 'ovs-appctl revalidator/purge' | |
5346 | on_exit 'ovs-appctl dpif/dump-flows br0' | |
5347 | ||
5348 | dnl Should work with the virtual IP address through NAT | |
5349 | for i in 1 2 3 4 5 6 7 8 9 10 11 12; do | |
5350 | echo Request $i | |
5351 | NS_CHECK_EXEC([at_ns1], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o wget$i.log]) | |
5352 | done | |
5353 | ||
5354 | dnl Each server should have at least one connection. | |
420c73b2 JR |
5355 | AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl |
5356 | 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>) | |
5357 | 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>) | |
5358 | 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 |
5359 | ]) |
5360 | ||
5361 | ovs-appctl dpif/dump-flows br0 | |
5362 | ovs-appctl revalidator/purge | |
5363 | ovs-ofctl -O OpenFlow15 dump-flows br0 | |
5364 | ovs-ofctl -O OpenFlow15 dump-group-stats br0 | |
5365 | ||
5366 | OVS_TRAFFIC_VSWITCHD_STOP | |
5367 | AT_CLEANUP | |
5368 | ||
5369 | ||
5370 | AT_SETUP([conntrack - DNAT load balancing with NC]) | |
9c1ab985 | 5371 | AT_SKIP_IF([test $HAVE_NC = no]) |
2c66ebe4 | 5372 | CHECK_CONNTRACK() |
4573c42e | 5373 | CHECK_CONNTRACK_NAT() |
2c66ebe4 JR |
5374 | OVS_TRAFFIC_VSWITCHD_START() |
5375 | ||
5376 | ADD_NAMESPACES(at_ns1, at_ns2, at_ns3, at_ns4, at_ns5) | |
5377 | ||
5378 | ADD_VETH(p1, at_ns1, br0, "10.1.1.1/24") | |
5379 | ADD_VETH(p2, at_ns2, br0, "10.1.1.2/24") | |
5380 | ADD_VETH(p3, at_ns3, br0, "10.1.1.3/24") | |
5381 | ADD_VETH(p4, at_ns4, br0, "10.1.1.4/24") | |
5382 | ADD_VETH(p5, at_ns5, br0, "10.1.1.5/24") | |
5383 | NS_CHECK_EXEC([at_ns1], [ip link set dev p1 address 80:88:88:88:88:11]) | |
5384 | NS_CHECK_EXEC([at_ns2], [ip link set dev p2 address 80:88:88:88:88:22]) | |
5385 | NS_CHECK_EXEC([at_ns3], [ip link set dev p3 address 80:88:88:88:88:33]) | |
5386 | NS_CHECK_EXEC([at_ns4], [ip link set dev p4 address 80:88:88:88:88:44]) | |
5387 | NS_CHECK_EXEC([at_ns5], [ip link set dev p5 address 80:88:88:88:88:55]) | |
5388 | ||
5389 | dnl Select group for load balancing. One bucket per server. Each bucket | |
5390 | dnl tracks and NATs the connection and recirculates to table 4 for egress | |
5391 | dnl routing. Packets of existing connections are always NATted based on | |
5392 | dnl connection state, only new connections are NATted according to the | |
5393 | dnl specific NAT parameters in each bucket. | |
5394 | 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)"]) | |
5395 | ||
5396 | AT_DATA([flows.txt], [dnl | |
5397 | dnl Track connections to the virtual IP address. | |
5398 | table=0 priority=100 ip nw_dst=10.1.1.64 action=group:234 | |
5399 | dnl All other IP traffic is allowed but the connection state is no commited. | |
5400 | table=0 priority=90 ip action=ct(table=4,nat) | |
5401 | dnl | |
5402 | dnl Allow ARP, but generate responses for virtual addresses | |
5403 | table=0 priority=100 arp arp_op=1 action=move:OXM_OF_ARP_TPA[[]]->NXM_NX_REG2[[]],resubmit(,8),goto_table:10 | |
5404 | table=0 priority=10 arp action=normal | |
5405 | table=0 priority=0 action=drop | |
5406 | dnl | |
5407 | dnl Routing table | |
5408 | dnl | |
5409 | table=4,ip,nw_dst=10.1.1.1 action=mod_dl_dst:80:88:88:88:88:11,output:1 | |
5410 | table=4,ip,nw_dst=10.1.1.2 action=mod_dl_dst:80:88:88:88:88:22,output:2 | |
5411 | table=4,ip,nw_dst=10.1.1.3 action=mod_dl_dst:80:88:88:88:88:33,output:3 | |
5412 | table=4,ip,nw_dst=10.1.1.4 action=mod_dl_dst:80:88:88:88:88:44,output:4 | |
5413 | table=4,ip,nw_dst=10.1.1.5 action=mod_dl_dst:80:88:88:88:88:55,output:5 | |
5414 | table=4 priority=0 action=drop | |
5415 | dnl | |
5416 | dnl MAC resolution table for IP in reg2, stores mac in OXM_OF_PKT_REG0 | |
5417 | table=8,reg2=0x0a010140,action=load:0x808888888888->OXM_OF_PKT_REG0[[]] | |
5418 | dnl Zero result means not found. | |
5419 | table=8,priority=0,action=load:0->OXM_OF_PKT_REG0[[]] | |
5420 | dnl ARP responder mac filled in at OXM_OF_PKT_REG0, or 0 for normal action. | |
5421 | dnl TPA IP in reg2. | |
5422 | table=10 priority=100 arp xreg0=0 action=normal | |
5423 | dnl Swaps the fields of the ARP message to turn a query to a response. | |
5424 | 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]] | |
5425 | table=10 priority=0 action=controller | |
5426 | ]) | |
5427 | ||
5428 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5429 | ||
5430 | dnl Start web servers | |
7ed40afe JS |
5431 | OVS_START_L7([at_ns2], [http]) |
5432 | OVS_START_L7([at_ns3], [http]) | |
5433 | OVS_START_L7([at_ns4], [http]) | |
2c66ebe4 JR |
5434 | |
5435 | on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0' | |
5436 | on_exit 'ovs-appctl revalidator/purge' | |
5437 | on_exit 'ovs-appctl dpif/dump-flows br0' | |
5438 | ||
5439 | sleep 5 | |
5440 | ||
5441 | dnl Should work with the virtual IP address through NAT | |
5442 | for i in 1 2 3 4 5 6 7 8 9; do | |
5443 | echo Request $i | |
5444 | NS_CHECK_EXEC([at_ns1], [echo "TEST1" | nc -p 4100$i 10.1.1.64 80 > nc-1-$i.log]) | |
5445 | NS_CHECK_EXEC([at_ns5], [echo "TEST5" | nc -p 4100$i 10.1.1.64 80 > nc-5-$i.log]) | |
5446 | done | |
5447 | ||
5448 | conntrack -L 2>&1 | |
5449 | ||
5450 | ovs-appctl dpif/dump-flows br0 | |
5451 | ovs-appctl revalidator/purge | |
5452 | ovs-ofctl -O OpenFlow15 dump-flows br0 | |
5453 | ovs-ofctl -O OpenFlow15 dump-group-stats br0 | |
5454 | ||
5455 | OVS_TRAFFIC_VSWITCHD_STOP | |
5456 | AT_CLEANUP | |
b4fa814c | 5457 | |
8d48d5f3 EG |
5458 | AT_SETUP([conntrack - floating IP]) |
5459 | AT_SKIP_IF([test $HAVE_NC = no]) | |
5460 | CHECK_CONNTRACK() | |
5461 | OVS_TRAFFIC_VSWITCHD_START() | |
5462 | OVS_CHECK_CT_CLEAR() | |
5463 | ||
5464 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5465 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24", "f0:00:00:01:01:01") dnl FIP 10.254.254.1 | |
5466 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24", "f0:00:00:01:01:02") dnl FIP 10.254.254.2 | |
5467 | ||
5468 | dnl Static ARPs | |
5469 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.2 lladdr f0:00:00:01:01:02 dev p0]) | |
5470 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.1 lladdr f0:00:00:01:01:01 dev p1]) | |
5471 | ||
5472 | dnl Static ARP and route entries for the FIP "gateway" | |
5473 | NS_CHECK_EXEC([at_ns0], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p0]) | |
5474 | NS_CHECK_EXEC([at_ns1], [ip neigh add 10.1.1.254 lladdr f0:00:00:01:01:FE dev p1]) | |
5475 | NS_CHECK_EXEC([at_ns0], [ip route add default nexthop via 10.1.1.254]) | |
5476 | NS_CHECK_EXEC([at_ns1], [ip route add default nexthop via 10.1.1.254]) | |
5477 | ||
5478 | NETNS_DAEMONIZE([at_ns0], [nc -l -k 1234 > /dev/null], [nc0.pid]) | |
5479 | ||
5480 | AT_DATA([flows.txt], [dnl | |
5481 | table=0,priority=10 ip action=ct(table=1) | |
5482 | table=0,priority=1 action=drop | |
5483 | dnl dst FIP | |
5484 | table=1,priority=20 ip,ct_state=+trk+est,nw_dst=10.254.254.0/24 action=goto_table:10 | |
5485 | table=1,priority=20 ip,ct_state=+trk+new,nw_dst=10.254.254.0/24 action=ct(commit,table=10) | |
5486 | dnl dst local | |
5487 | table=1,priority=10 ip,ct_state=+trk+est action=goto_table:20 | |
5488 | table=1,priority=10 ip,ct_state=+trk+new action=ct(commit,table=20) | |
5489 | table=1,priority=1 ip,ct_state=+trk+inv action=drop | |
5490 | dnl | |
5491 | dnl FIP translation (dst FIP, src local) --> (dst local, src FIP) | |
5492 | table=10 ip,nw_dst=10.254.254.1 action=set_field:10.1.1.1->nw_dst,goto_table:11 | |
5493 | table=10 ip,nw_dst=10.254.254.2 action=set_field:10.1.1.2->nw_dst,goto_table:11 | |
5494 | table=11 ip,nw_src=10.1.1.1 action=set_field:10.254.254.1->nw_src,goto_table:12 | |
5495 | table=11 ip,nw_src=10.1.1.2 action=set_field:10.254.254.2->nw_src,goto_table:12 | |
5496 | dnl clear conntrack and do another lookup since we changed the tuple | |
5497 | table=12,priority=10 ip action=ct_clear,ct(table=13) | |
5498 | table=12,priority=1 action=drop | |
5499 | table=13 ip,ct_state=+trk+est action=goto_table:20 | |
5500 | table=13 ip,ct_state=+trk+new action=ct(commit,table=20) | |
5501 | table=13 ip,ct_state=+trk+inv action=drop | |
5502 | dnl | |
5503 | dnl Output | |
5504 | table=20 ip,nw_src=10.1.1.1 action=set_field:f0:00:00:01:01:01->eth_src,goto_table:21 | |
5505 | table=20 ip,nw_src=10.1.1.2 action=set_field:f0:00:00:01:01:02->eth_src,goto_table:21 | |
5506 | table=20 ip,nw_src=10.254.254.0/24 action=set_field:f0:00:00:01:01:FE->eth_src,goto_table:21 | |
5507 | table=21 ip,nw_dst=10.1.1.1 action=set_field:f0:00:00:01:01:01->eth_dst,output:ovs-p0 | |
5508 | table=21 ip,nw_dst=10.1.1.2 action=set_field:f0:00:00:01:01:02->eth_dst,output:ovs-p1 | |
5509 | ]) | |
5510 | ||
5511 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) | |
5512 | ||
5513 | dnl non-FIP case | |
5514 | NS_CHECK_EXEC([at_ns1], [echo "foobar" |nc $NC_EOF_OPT 10.1.1.1 1234]) | |
5515 | 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' | | |
5516 | 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)" | |
5517 | ]]) | |
5518 | ||
5519 | dnl Check that the full session ends as expected (i.e. TIME_WAIT). Otherwise it | |
5520 | dnl means the datapath didn't process the ct_clear action. Ending in SYN_RECV | |
5521 | dnl (OVS maps to ESTABLISHED) means the initial frame was committed, but not a | |
5522 | dnl second time after the FIP translation (because ct_clear didn't occur). | |
5523 | NS_CHECK_EXEC([at_ns1], [echo "foobar" |nc $NC_EOF_OPT 10.254.254.1 1234]) | |
5524 | 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' | | |
5525 | 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)" | |
5526 | ]]) | |
5527 | ||
5528 | OVS_TRAFFIC_VSWITCHD_STOP | |
5529 | AT_CLEANUP | |
5530 | ||
b4fa814c EG |
5531 | AT_BANNER([802.1ad]) |
5532 | ||
5533 | AT_SETUP([802.1ad - vlan_limit]) | |
5534 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5535 | OVS_CHECK_8021AD() | |
5536 | ||
5537 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5538 | ||
5539 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5540 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
5541 | ||
5542 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
5543 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
5544 | ||
5545 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
5546 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
5547 | ||
5548 | AT_CHECK([ovs-ofctl add-flow br0 "priority=1 action=normal"]) | |
5549 | ||
5550 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5551 | ||
5552 | dnl CVLAN traffic should match the flow and drop | |
5553 | AT_CHECK([ovs-appctl revalidator/purge]) | |
5554 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:vlan-limit=1]) | |
5555 | AT_CHECK([ovs-ofctl add-flow br0 "priority=100 dl_type=0x8100 action=drop"]) | |
5556 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 -w 3 10.2.2.2], [1], [ignore]) | |
5557 | ||
5558 | OVS_TRAFFIC_VSWITCHD_STOP | |
5559 | AT_CLEANUP | |
0147a20e EG |
5560 | |
5561 | ||
5562 | AT_SETUP([802.1ad - push/pop outer 802.1ad]) | |
5563 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5564 | OVS_CHECK_8021AD() | |
5565 | ||
5566 | ADD_BR([br1]) | |
5567 | ADD_BR([br2]) | |
5568 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5569 | ||
5570 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
5571 | AT_CHECK([ip link set dev ovs-p0 up]) | |
5572 | AT_CHECK([ip link set dev ovs-p1 up]) | |
5573 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
5574 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
5575 | on_exit 'ip link del ovs-p0' | |
5576 | ||
5577 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
5578 | AT_CHECK([ip link set dev ovs-p2 up]) | |
5579 | AT_CHECK([ip link set dev ovs-p3 up]) | |
5580 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
5581 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
5582 | on_exit 'ip link del ovs-p2' | |
5583 | ||
5584 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
5585 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
5586 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
5587 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
5588 | ||
5589 | AT_DATA([flows-br0.txt], [dnl | |
5590 | priority=1 action=drop | |
5591 | priority=100 in_port=1 action=push_vlan:0x88a8,mod_vlan_vid=4094,output:2 | |
5592 | priority=100 in_port=2 action=push_vlan:0x88a8,mod_vlan_vid=4094,output:1 | |
5593 | ]) | |
5594 | ||
5595 | AT_DATA([flows-customer-br.txt], [dnl | |
5596 | priority=1 action=normal | |
5597 | priority=100 in_port=1 vlan_tci=0x1000/0x1000 action=pop_vlan,normal | |
5598 | ]) | |
5599 | ||
5600 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
5601 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-customer-br.txt]) | |
5602 | AT_CHECK([ovs-ofctl --bundle add-flows br2 flows-customer-br.txt]) | |
5603 | ||
5604 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5605 | ||
5606 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5607 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5608 | ]) | |
5609 | ||
5610 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5611 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5612 | ]) | |
5613 | ||
5614 | OVS_TRAFFIC_VSWITCHD_STOP | |
5615 | AT_CLEANUP | |
5616 | ||
5617 | ||
5618 | AT_SETUP([802.1ad - push/pop outer 802.1q]) | |
5619 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5620 | OVS_CHECK_8021AD() | |
5621 | ||
5622 | ADD_BR([br1]) | |
5623 | ADD_BR([br2]) | |
5624 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5625 | ||
5626 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
5627 | AT_CHECK([ip link set dev ovs-p0 up]) | |
5628 | AT_CHECK([ip link set dev ovs-p1 up]) | |
5629 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
5630 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
5631 | on_exit 'ip link del ovs-p0' | |
5632 | ||
5633 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
5634 | AT_CHECK([ip link set dev ovs-p2 up]) | |
5635 | AT_CHECK([ip link set dev ovs-p3 up]) | |
5636 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
5637 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
5638 | on_exit 'ip link del ovs-p2' | |
5639 | ||
5640 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
5641 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
5642 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
5643 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
5644 | ||
5645 | AT_DATA([flows-br0.txt], [dnl | |
5646 | priority=1 action=drop | |
5647 | priority=100 in_port=1 action=push_vlan:0x8100,mod_vlan_vid=4094,output:2 | |
5648 | priority=100 in_port=2 action=push_vlan:0x8100,mod_vlan_vid=4094,output:1 | |
5649 | ]) | |
5650 | ||
5651 | AT_DATA([flows-customer-br.txt], [dnl | |
5652 | priority=1 action=normal | |
5653 | priority=100 in_port=1 vlan_tci=0x1000/0x1000 action=pop_vlan,normal | |
5654 | ]) | |
5655 | ||
5656 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
5657 | AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-customer-br.txt]) | |
5658 | AT_CHECK([ovs-ofctl --bundle add-flows br2 flows-customer-br.txt]) | |
5659 | ||
5660 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5661 | ||
5662 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5663 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5664 | ]) | |
5665 | ||
5666 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5667 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5668 | ]) | |
5669 | ||
5670 | OVS_TRAFFIC_VSWITCHD_STOP | |
5671 | AT_CLEANUP | |
d4a814a8 EG |
5672 | |
5673 | ||
5674 | AT_SETUP([802.1ad - 802.1q tunnel]) | |
5675 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5676 | OVS_CHECK_8021AD() | |
5677 | ||
5678 | ADD_BR([br1]) | |
5679 | ADD_BR([br2]) | |
5680 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5681 | ||
5682 | AT_CHECK([ip link add ovs-p0 type veth peer name ovs-p1]) | |
5683 | AT_CHECK([ip link set dev ovs-p0 up]) | |
5684 | AT_CHECK([ip link set dev ovs-p1 up]) | |
5685 | AT_CHECK([ovs-vsctl add-port br0 ovs-p0]) | |
5686 | AT_CHECK([ovs-vsctl add-port br1 ovs-p1]) | |
5687 | on_exit 'ip link del ovs-p0' | |
5688 | ||
5689 | AT_CHECK([ip link add ovs-p2 type veth peer name ovs-p3]) | |
5690 | AT_CHECK([ip link set dev ovs-p2 up]) | |
5691 | AT_CHECK([ip link set dev ovs-p3 up]) | |
5692 | AT_CHECK([ovs-vsctl add-port br0 ovs-p2]) | |
5693 | AT_CHECK([ovs-vsctl add-port br2 ovs-p3]) | |
5694 | on_exit 'ip link del ovs-p2' | |
5695 | ||
5696 | ADD_VETH(p4, at_ns0, br1, "10.1.1.1/24") | |
5697 | ADD_VETH(p5, at_ns1, br2, "10.1.1.2/24") | |
5698 | ADD_CVLAN(p4, at_ns0, 100, "10.2.2.1/24") | |
5699 | ADD_CVLAN(p5, at_ns1, 100, "10.2.2.2/24") | |
5700 | ADD_CVLAN(p4, at_ns0, 200, "10.3.2.1/24") | |
5701 | ADD_CVLAN(p5, at_ns1, 200, "10.3.2.2/24") | |
5702 | ADD_CVLAN(p4, at_ns0, 300, "10.4.2.1/24") | |
5703 | ADD_CVLAN(p5, at_ns1, 300, "10.4.2.2/24") | |
5704 | ||
5705 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
5706 | AT_CHECK([ovs-ofctl add-flow br1 action=normal]) | |
5707 | AT_CHECK([ovs-ofctl add-flow br2 action=normal]) | |
5708 | AT_CHECK([ovs-vsctl set port ovs-p0 vlan_mode=dot1q-tunnel tag=4094 cvlans=100,200]) | |
5709 | AT_CHECK([ovs-vsctl set port ovs-p2 vlan_mode=dot1q-tunnel tag=4094 cvlans=100,200]) | |
5710 | ||
5711 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5712 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.3.2.2]) | |
5713 | ||
5714 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5715 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5716 | ]) | |
5717 | ||
5718 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.3.2.2 | FORMAT_PING], [0], [dnl | |
5719 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5720 | ]) | |
5721 | ||
5722 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5723 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5724 | ]) | |
5725 | ||
5726 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.3.2.2 | FORMAT_PING], [0], [dnl | |
5727 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5728 | ]) | |
5729 | ||
5730 | dnl CVLAN 300 is not permitted by dot1q-tunnel | |
5731 | NS_CHECK_EXEC([at_ns0], [ping -q -c 1 -w 3 10.4.2.2], [1], [ignore]) | |
5732 | ||
5733 | OVS_TRAFFIC_VSWITCHD_STOP(["/dropping VLAN \(0\|300\) packet received on dot1q-tunnel port/d"]) | |
5734 | AT_CLEANUP | |
79d6e24f EG |
5735 | |
5736 | AT_SETUP([802.1ad - double vlan match]) | |
5737 | OVS_TRAFFIC_VSWITCHD_START([set Open_vSwitch . other_config:vlan-limit=0]) | |
5738 | OVS_CHECK_8021AD() | |
5739 | ||
5740 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5741 | ||
5742 | ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") | |
5743 | ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24") | |
5744 | ||
5745 | ADD_SVLAN(p0, at_ns0, 4094, "10.255.2.1/24") | |
5746 | ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24") | |
5747 | ||
5748 | ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24") | |
5749 | ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24") | |
5750 | ||
5751 | AT_DATA([flows-br0.txt], [dnl | |
5752 | table=0,priority=1 action=drop | |
5753 | table=0,priority=100 dl_vlan=4094 action=pop_vlan,goto_table:1 | |
5754 | table=1,priority=100 dl_vlan=100 action=push_vlan:0x88a8,mod_vlan_vid:4094,normal | |
5755 | ]) | |
5756 | AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt]) | |
5757 | ||
5758 | OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2]) | |
5759 | ||
5760 | NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5761 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5762 | ]) | |
5763 | ||
5764 | NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl | |
5765 | 3 packets transmitted, 3 received, 0% packet loss, time 0ms | |
5766 | ]) | |
5767 | ||
296251ca AV |
5768 | OVS_TRAFFIC_VSWITCHD_STOP |
5769 | AT_CLEANUP | |
5770 | ||
5771 | ||
5772 | AT_BANNER([nsh-datapath]) | |
5773 | ||
5774 | AT_SETUP([nsh - encap header]) | |
5775 | OVS_TRAFFIC_VSWITCHD_START() | |
5776 | ||
5777 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5778 | ||
5779 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
5780 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
5781 | ||
5782 | dnl The flow will encap a nsh header to the TCP syn packet | |
5783 | dnl eth/ip/tcp --> OVS --> eth/nsh/eth/ip/tcp | |
5784 | 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"]) | |
5785 | ||
5786 | rm ovs-p1.pcap | |
5787 | tcpdump -U -i ovs-p1 -w ovs-p1.pcap & | |
5788 | sleep 1 | |
5789 | ||
5790 | dnl The hex dump is a TCP syn packet. pkt=eth/ip/tcp | |
5791 | dnl The packet is sent from p0(at_ns0) interface directed to | |
5792 | dnl p1(at_ns1) interface | |
5793 | NS_CHECK_EXEC([at_ns0], [$PYTHON $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]) | |
5794 | ||
5795 | sleep 1 | |
5796 | ||
5797 | dnl Check the expected nsh encapsulated packet on the egress interface | |
5798 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0fc6" 2>&1 1>/dev/null]) | |
5799 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0010: *0103 *0012 *34ff *1122 *3344 *0000 *0000 *0000" 2>&1 1>/dev/null]) | |
5800 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0020: *0000 *0000 *0000 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
5801 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
5802 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
5803 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
5804 | ||
5805 | ||
5806 | OVS_TRAFFIC_VSWITCHD_STOP | |
5807 | AT_CLEANUP | |
5808 | ||
5809 | AT_SETUP([nsh - decap header]) | |
5810 | OVS_TRAFFIC_VSWITCHD_START() | |
5811 | ||
5812 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5813 | ||
5814 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
5815 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
5816 | ||
5817 | dnl The flow will decap a nsh header which in turn carries a TCP syn packet | |
5818 | dnl eth/nsh/eth/ip/tcp --> OVS --> eth/ip/tcp | |
5819 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,dl_type=0x894f, actions=decap(),decap(), ovs-p1"]) | |
5820 | ||
5821 | rm ovs-p1.pcap | |
5822 | tcpdump -U -i ovs-p1 -w ovs-p1.pcap & | |
5823 | sleep 1 | |
5824 | ||
5825 | dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp | |
5826 | dnl The packet is sent from p0(at_ns0) interface directed to | |
5827 | dnl p1(at_ns1) interface | |
5828 | NS_CHECK_EXEC([at_ns0], [$PYTHON $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]) | |
5829 | ||
5830 | sleep 1 | |
5831 | ||
5832 | dnl Check the expected de-capsulated TCP packet on the egress interface | |
5833 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0000: *f200 *0000 *0002 *f200 *0000 *0001 *0800 *4500" 2>&1 1>/dev/null]) | |
5834 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0010: *0028 *0001 *0000 *4006 *b013 *c0a8 *000a *0a00" 2>&1 1>/dev/null]) | |
5835 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0020: *000a *0400 *0800 *0000 *00c8 *0000 *0000 *5002" 2>&1 1>/dev/null]) | |
5836 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0030: *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
5837 | ||
5838 | ||
5839 | OVS_TRAFFIC_VSWITCHD_STOP | |
5840 | AT_CLEANUP | |
5841 | ||
5842 | AT_SETUP([nsh - replace header]) | |
5843 | OVS_TRAFFIC_VSWITCHD_START() | |
5844 | ||
5845 | ADD_NAMESPACES(at_ns0, at_ns1) | |
5846 | ||
5847 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
5848 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
5849 | ||
5850 | dnl The flow will decap a nsh header and encap a new nsh header | |
5851 | dnl eth/nsh-X/eth/ip/tcp --> OVS --> eth/nsh-Y/eth/ip/tcp | |
5852 | dnl The flow will add another NSH header with nsh_spi=0x101, nsh_si=4, | |
5853 | dnl nsh_ttl=7 and change the md1 context | |
5854 | 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"]) | |
5855 | ||
5856 | rm ovs-p1.pcap | |
5857 | tcpdump -U -i ovs-p1 -w ovs-p1.pcap & | |
5858 | sleep 1 | |
5859 | ||
5860 | dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp | |
5861 | dnl The nsh_ttl is 8, nsh_spi is 0x100 and nsh_si is 3 | |
5862 | dnl The packet is sent from p0(at_ns0) interface directed to | |
5863 | dnl p1(at_ns1) interface | |
5864 | NS_CHECK_EXEC([at_ns0], [$PYTHON $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]) | |
5865 | ||
5866 | sleep 1 | |
5867 | ||
5868 | dnl Check the expected NSH packet with new fields in the header | |
5869 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000* 0001 *894f *01c6" 2>&1 1>/dev/null]) | |
5870 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0010: *0103 *0001 *0104 *100f *0e0d *0c0b *0a09 *0807" 2>&1 1>/dev/null]) | |
5871 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0020: *0605 *0403 *0201 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
5872 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
5873 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
5874 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
5875 | ||
5876 | OVS_TRAFFIC_VSWITCHD_STOP | |
5877 | AT_CLEANUP | |
5878 | ||
5879 | ||
5880 | AT_SETUP([nsh - forward]) | |
5881 | OVS_TRAFFIC_VSWITCHD_START() | |
5882 | ||
5883 | ADD_NAMESPACES(at_ns0, at_ns1, at_ns2) | |
5884 | ||
5885 | ADD_VETH(p0, at_ns0, br0, "0.0.0.0") | |
5886 | ADD_VETH(p1, at_ns1, br0, "0.0.0.0") | |
5887 | ADD_VETH(p2, at_ns2, br0, "0.0.0.0") | |
5888 | ||
5889 | dnl Push two flows to OVS. #1 will check on SPI=0X100, SI=2 and send the | |
5890 | dnl packet to at_ns1. #2 will check on SPI=0X100, SI=1 and send the | |
5891 | dnl packet to to at_ns2. | |
5892 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x02,actions=ovs-p1"]) | |
5893 | AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x01,actions=ovs-p2"]) | |
5894 | ||
5895 | ||
5896 | rm ovs-p1.pcap | |
5897 | rm ovs-p2.pcap | |
5898 | tcpdump -U -i ovs-p1 -w ovs-p1.pcap & | |
5899 | tcpdump -U -i ovs-p2 -w ovs-p2.pcap & | |
5900 | sleep 1 | |
5901 | ||
5902 | dnl First send packet from at_ns0 --> OVS with SPI=0x100 and SI=2 | |
5903 | NS_CHECK_EXEC([at_ns0], [$PYTHON $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]) | |
5904 | ||
5905 | sleep 1 | |
5906 | ||
5907 | dnl Check for the above packet on ovs-p1 interface | |
5908 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0206" 2>&1 1>/dev/null]) | |
5909 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0010: *0103 *0001 *0002 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null]) | |
5910 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
5911 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
5912 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
5913 | AT_CHECK([tcpdump -xx -r ovs-p1.pcap 2>&1 | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
5914 | ||
5915 | ||
5916 | dnl Send the second packet from at_ns1 --> OVS with SPI=0x100 and SI=1 | |
5917 | NS_CHECK_EXEC([at_ns1], [$PYTHON $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]) | |
5918 | ||
5919 | sleep 1 | |
5920 | ||
5921 | dnl Check for the above packet on ovs-p2 interface | |
5922 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *01c6" 2>&1 1>/dev/null]) | |
5923 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0010: *0103 *0001 *0001 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null]) | |
5924 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null]) | |
5925 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null]) | |
5926 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null]) | |
5927 | AT_CHECK([tcpdump -xx -r ovs-p2.pcap 2>&1 | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null]) | |
5928 | ||
5929 | ||
5930 | ||
79d6e24f EG |
5931 | OVS_TRAFFIC_VSWITCHD_STOP |
5932 | AT_CLEANUP |