t_arp.sh revision 1.15 1 # $NetBSD: t_arp.sh,v 1.15 2016/04/18 02:27:34 ozaki-r Exp $
2 #
3 # Copyright (c) 2015 The NetBSD Foundation, Inc.
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
26 #
27
28 inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif"
29 inetserver="$inetserver -lrumpdev -lrumpnet_tap"
30 HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes"
31
32 SOCKSRC=unix://commsock1
33 SOCKDST=unix://commsock2
34 IP4SRC=10.0.1.1
35 IP4DST=10.0.1.2
36 IP4DST_PROXYARP1=10.0.1.3
37 IP4DST_PROXYARP2=10.0.1.4
38
39 DEBUG=false
40 TIMEOUT=1
41
42 atf_test_case cache_expiration_5s cleanup
43 atf_test_case cache_expiration_10s cleanup
44 atf_test_case command cleanup
45 atf_test_case garp cleanup
46 atf_test_case cache_overwriting cleanup
47 atf_test_case proxy_arp_pub cleanup
48 atf_test_case proxy_arp_pubproxy cleanup
49 atf_test_case link_activation cleanup
50 atf_test_case static_arp cleanup
51
52 cache_expiration_5s_head()
53 {
54 atf_set "descr" "Tests for ARP cache expiration (5s)"
55 atf_set "require.progs" "rump_server"
56 }
57
58 cache_expiration_10s_head()
59 {
60 atf_set "descr" "Tests for ARP cache expiration (10s)"
61 atf_set "require.progs" "rump_server"
62 }
63
64 command_head()
65 {
66 atf_set "descr" "Tests for commands of arp(8)"
67 atf_set "require.progs" "rump_server"
68 }
69
70 garp_head()
71 {
72 atf_set "descr" "Tests for GARP"
73 atf_set "require.progs" "rump_server"
74 }
75
76 cache_overwriting_head()
77 {
78 atf_set "descr" "Tests for behavior of overwriting ARP caches"
79 atf_set "require.progs" "rump_server"
80 }
81
82 proxy_arp_pub_head()
83 {
84 atf_set "descr" "Tests for Proxy ARP (pub)"
85 atf_set "require.progs" "rump_server"
86 }
87
88 proxy_arp_pubproxy_head()
89 {
90 atf_set "descr" "Tests for Proxy ARP (pub proxy)"
91 atf_set "require.progs" "rump_server"
92 }
93
94 link_activation_head()
95 {
96 atf_set "descr" "Tests for activating a new MAC address"
97 atf_set "require.progs" "rump_server"
98 }
99
100 static_arp_head()
101 {
102
103 atf_set "descr" "Tests for static ARP entries"
104 atf_set "require.progs" "rump_server"
105 }
106
107 setup_dst_server()
108 {
109 export RUMP_SERVER=$SOCKDST
110 atf_check -s exit:0 rump.ifconfig shmif0 create
111 atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
112 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4DST/24
113 atf_check -s exit:0 rump.ifconfig shmif0 up
114 atf_check -s exit:0 rump.ifconfig -w 10
115
116 $DEBUG && rump.ifconfig shmif0
117 $DEBUG && rump.arp -n -a
118 }
119
120 setup_src_server()
121 {
122 local keep=$1
123
124 export RUMP_SERVER=$SOCKSRC
125
126 # Adjust ARP parameters
127 atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.arp.keep=$keep
128
129 # Setup an interface
130 atf_check -s exit:0 rump.ifconfig shmif0 create
131 atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
132 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4SRC/24
133 atf_check -s exit:0 rump.ifconfig shmif0 up
134 atf_check -s exit:0 rump.ifconfig -w 10
135
136 # Sanity check
137 $DEBUG && rump.ifconfig shmif0
138 $DEBUG && rump.arp -n -a
139 atf_check -s exit:0 -o ignore rump.arp -n $IP4SRC
140 atf_check -s not-exit:0 -e ignore rump.arp -n $IP4DST
141 }
142
143 test_cache_expiration()
144 {
145 local arp_keep=$1
146 local bonus=2
147
148 atf_check -s exit:0 ${inetserver} $SOCKSRC
149 atf_check -s exit:0 ${inetserver} $SOCKDST
150
151 setup_dst_server
152 setup_src_server $arp_keep
153
154 #
155 # Check if a cache is expired expectedly
156 #
157 export RUMP_SERVER=$SOCKSRC
158 atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4DST
159
160 $DEBUG && rump.arp -n -a
161 atf_check -s exit:0 -o ignore rump.arp -n $IP4SRC
162 # Should be cached
163 atf_check -s exit:0 -o ignore rump.arp -n $IP4DST
164
165 atf_check -s exit:0 sleep $(($arp_keep + $bonus))
166
167 $DEBUG && rump.arp -n -a
168 atf_check -s exit:0 -o ignore rump.arp -n $IP4SRC
169 # Should be expired
170 atf_check -s not-exit:0 -e ignore rump.arp -n $IP4DST
171 }
172
173 cache_expiration_5s_body()
174 {
175 test_cache_expiration 5
176 }
177
178 cache_expiration_10s_body()
179 {
180 test_cache_expiration 10
181 }
182
183 command_body()
184 {
185 local arp_keep=5
186 local bonus=2
187
188 atf_check -s exit:0 ${inetserver} $SOCKSRC
189 atf_check -s exit:0 ${inetserver} $SOCKDST
190
191 setup_dst_server
192 setup_src_server $arp_keep
193
194 export RUMP_SERVER=$SOCKSRC
195
196 # We can delete the entry for the interface's IP address
197 atf_check -s exit:0 -o ignore rump.arp -d $IP4SRC
198
199 # Add and delete a static entry
200 $DEBUG && rump.arp -n -a
201 atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:10
202 $DEBUG && rump.arp -n -a
203 atf_check -s exit:0 -o match:'b2:a0:20:00:00:10' rump.arp -n 10.0.1.10
204 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.10
205 atf_check -s exit:0 -o ignore rump.arp -d 10.0.1.10
206 $DEBUG && rump.arp -n -a
207 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10
208
209 # Add multiple entries via a file
210 cat - > ./list <<-EOF
211 10.0.1.11 b2:a0:20:00:00:11
212 10.0.1.12 b2:a0:20:00:00:12
213 10.0.1.13 b2:a0:20:00:00:13
214 10.0.1.14 b2:a0:20:00:00:14
215 10.0.1.15 b2:a0:20:00:00:15
216 EOF
217 $DEBUG && rump.arp -n -a
218 atf_check -s exit:0 -o ignore rump.arp -f ./list
219 $DEBUG && rump.arp -n -a
220 atf_check -s exit:0 -o match:'b2:a0:20:00:00:11' rump.arp -n 10.0.1.11
221 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.11
222 atf_check -s exit:0 -o match:'b2:a0:20:00:00:12' rump.arp -n 10.0.1.12
223 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.12
224 atf_check -s exit:0 -o match:'b2:a0:20:00:00:13' rump.arp -n 10.0.1.13
225 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.13
226 atf_check -s exit:0 -o match:'b2:a0:20:00:00:14' rump.arp -n 10.0.1.14
227 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.14
228 atf_check -s exit:0 -o match:'b2:a0:20:00:00:15' rump.arp -n 10.0.1.15
229 atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.15
230
231 # Test arp -a
232 atf_check -s exit:0 -o match:'10.0.1.11' rump.arp -n -a
233 atf_check -s exit:0 -o match:'10.0.1.12' rump.arp -n -a
234 atf_check -s exit:0 -o match:'10.0.1.13' rump.arp -n -a
235 atf_check -s exit:0 -o match:'10.0.1.14' rump.arp -n -a
236 atf_check -s exit:0 -o match:'10.0.1.15' rump.arp -n -a
237
238 # Flush all entries
239 $DEBUG && rump.arp -n -a
240 atf_check -s exit:0 -o ignore rump.arp -d -a
241 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.11
242 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.12
243 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.13
244 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.14
245 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.15
246 atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.1
247
248 # Test temp option
249 $DEBUG && rump.arp -n -a
250 atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:10 temp
251 $DEBUG && rump.arp -n -a
252 atf_check -s exit:0 -o match:'b2:a0:20:00:00:10' rump.arp -n 10.0.1.10
253 atf_check -s exit:0 -o not-match:'permanent' rump.arp -n 10.0.1.10
254
255 # Hm? the cache doesn't expire...
256 atf_check -s exit:0 sleep $(($arp_keep + $bonus))
257 $DEBUG && rump.arp -n -a
258 #atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10
259
260 return 0
261 }
262
263 make_pkt_str_arpreq()
264 {
265 local target=$1
266 local sender=$2
267 pkt="> ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42:"
268 pkt="$pkt Request who-has $target tell $sender, length 28"
269 echo $pkt
270 }
271
272 garp_body()
273 {
274 local pkt=
275
276 atf_check -s exit:0 ${inetserver} $SOCKSRC
277 export RUMP_SERVER=$SOCKSRC
278
279 # Setup an interface
280 atf_check -s exit:0 rump.ifconfig shmif0 create
281 atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
282 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24
283 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias
284 atf_check -s exit:0 rump.ifconfig shmif0 up
285 $DEBUG && rump.ifconfig shmif0
286
287 atf_check -s exit:0 sleep 1
288 shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out
289
290 # A GARP packet is sent for the primary address
291 pkt=$(make_pkt_str_arpreq 10.0.0.1 10.0.0.1)
292 atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
293 # No GARP packet is sent for the alias address
294 pkt=$(make_pkt_str_arpreq 10.0.0.2 10.0.0.2)
295 atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
296
297 atf_check -s exit:0 rump.ifconfig -w 10
298 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24
299 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias
300
301 # No GARP packets are sent during IFF_UP
302 shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out
303 pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3)
304 atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
305 pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4)
306 atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
307 }
308
309 cache_overwriting_body()
310 {
311 local arp_keep=5
312 local bonus=2
313
314 atf_check -s exit:0 ${inetserver} $SOCKSRC
315 atf_check -s exit:0 ${inetserver} $SOCKDST
316
317 setup_dst_server
318 setup_src_server $arp_keep
319
320 export RUMP_SERVER=$SOCKSRC
321
322 # Cannot overwrite a permanent cache
323 atf_check -s not-exit:0 -e match:'File exists' \
324 rump.arp -s $IP4SRC b2:a0:20:00:00:ff
325 $DEBUG && rump.arp -n -a
326
327 atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4DST
328 $DEBUG && rump.arp -n -a
329 # Can overwrite a dynamic cache
330 atf_check -s exit:0 -o ignore rump.arp -s $IP4DST b2:a0:20:00:00:00
331 $DEBUG && rump.arp -n -a
332 atf_check -s exit:0 -o match:'b2:a0:20:00:00:00' rump.arp -n $IP4DST
333 atf_check -s exit:0 -o match:'permanent' rump.arp -n $IP4DST
334
335 atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:10 temp
336 $DEBUG && rump.arp -n -a
337 atf_check -s exit:0 -o match:'b2:a0:20:00:00:10' rump.arp -n 10.0.1.10
338 atf_check -s exit:0 -o not-match:'permanent' rump.arp -n 10.0.1.10
339 # Can overwrite a temp cache
340 atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:ff
341 atf_check -s exit:0 -o match:'b2:a0:20:00:00:ff' rump.arp -n 10.0.1.10
342 $DEBUG && rump.arp -n -a
343
344 return 0
345 }
346
347 make_pkt_str_arprep()
348 {
349 local ip=$1
350 local mac=$2
351 pkt="ethertype ARP (0x0806), length 42: "
352 pkt="Reply $ip is-at $mac, length 28"
353 echo $pkt
354 }
355
356 make_pkt_str_garp()
357 {
358 local ip=$1
359 local mac=$2
360 local pkt=
361 pkt="$mac > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806),"
362 pkt="$pkt length 42: Request who-has $ip tell $ip, length 28"
363 echo $pkt
364 }
365
366 extract_new_packets()
367 {
368 local old=./old
369
370 if [ ! -f $old ]; then
371 old=/dev/null
372 fi
373
374 shmif_dumpbus -p - bus1 2>/dev/null| \
375 tcpdump -n -e -r - 2>/dev/null > ./new
376 diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff
377 mv -f ./new ./old
378 cat ./diff
379 }
380
381 test_proxy_arp()
382 {
383 local arp_keep=5
384 local opts= title= flags=
385 local type=$1
386
387 atf_check -s exit:0 ${inetserver} $SOCKSRC
388 atf_check -s exit:0 ${inetserver} $SOCKDST
389
390 setup_dst_server
391 setup_src_server $arp_keep
392
393 export RUMP_SERVER=$SOCKDST
394 atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1
395 macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}')
396
397 if [ "$type" = "pub" ]; then
398 opts="pub"
399 title="permanent published"
400 else
401 opts="pub proxy"
402 title='permanent published \(proxy only\)'
403 fi
404
405 #
406 # Test#1: First setup an endpoint then create proxy arp entry
407 #
408 export RUMP_SERVER=$SOCKDST
409 atf_check -s exit:0 rump.ifconfig tap1 create
410 atf_check -s exit:0 rump.ifconfig tap1 $IP4DST_PROXYARP1/24 up
411 atf_check -s exit:0 rump.ifconfig -w 10
412
413 # Try to ping (should fail w/o proxy arp)
414 export RUMP_SERVER=$SOCKSRC
415 atf_check -s not-exit:0 -o ignore -e ignore \
416 rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1
417
418 # Flushing
419 extract_new_packets > ./out
420
421 # Set up proxy ARP entry
422 export RUMP_SERVER=$SOCKDST
423 atf_check -s exit:0 -o ignore \
424 rump.arp -s $IP4DST_PROXYARP1 $macaddr_dst $opts
425 atf_check -s exit:0 -o match:"$title" rump.arp -n $IP4DST_PROXYARP1
426
427 # Try to ping
428 export RUMP_SERVER=$SOCKSRC
429 if [ "$type" = "pub" ]; then
430 # XXX fails
431 atf_check -s not-exit:0 -o ignore -e ignore \
432 rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1
433 else
434 atf_check -s exit:0 -o ignore \
435 rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1
436 fi
437
438 extract_new_packets > ./out
439 $DEBUG && cat ./out
440
441 pkt1=$(make_pkt_str_arprep $IP4DST_PROXYARP1 $macaddr_dst)
442 pkt2=$(make_pkt_str_garp $IP4DST_PROXYARP1 $macaddr_dst)
443 if [ "$type" = "pub" ]; then
444 atf_check -s not-exit:0 -x \
445 "cat ./out |grep -q -e '$pkt1' -e '$pkt2'"
446 else
447 atf_check -s exit:0 -x "cat ./out |grep -q -e '$pkt1' -e '$pkt2'"
448 fi
449
450 #
451 # Test#2: Create proxy arp entry then set up an endpoint
452 #
453 export RUMP_SERVER=$SOCKDST
454 atf_check -s exit:0 -o ignore \
455 rump.arp -s $IP4DST_PROXYARP2 $macaddr_dst $opts
456 atf_check -s exit:0 -o match:"$title" rump.arp -n $IP4DST_PROXYARP2
457 $DEBUG && rump.netstat -nr -f inet
458
459 # Try to ping (should fail because no endpoint exists)
460 export RUMP_SERVER=$SOCKSRC
461 atf_check -s not-exit:0 -o ignore -e ignore \
462 rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2
463
464 extract_new_packets > ./out
465 $DEBUG && cat ./out
466
467 # ARP reply should be sent
468 pkt=$(make_pkt_str_arprep $IP4DST_PROXYARP2 $macaddr_dst)
469 atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
470
471 export RUMP_SERVER=$SOCKDST
472 atf_check -s exit:0 rump.ifconfig tap2 create
473 atf_check -s exit:0 rump.ifconfig tap2 $IP4DST_PROXYARP2/24 up
474 atf_check -s exit:0 rump.ifconfig -w 10
475
476 # Try to ping
477 export RUMP_SERVER=$SOCKSRC
478 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2
479 }
480
481 proxy_arp_pub_body()
482 {
483
484 test_proxy_arp pub
485 }
486
487 proxy_arp_pubproxy_body()
488 {
489
490 test_proxy_arp pubproxy
491 }
492
493 link_activation_body()
494 {
495 local arp_keep=5
496 local bonus=2
497
498 atf_check -s exit:0 ${inetserver} $SOCKSRC
499 atf_check -s exit:0 ${inetserver} $SOCKDST
500
501 setup_dst_server
502 setup_src_server $arp_keep
503
504 # flush old packets
505 extract_new_packets > ./out
506
507 export RUMP_SERVER=$SOCKSRC
508
509 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
510 b2:a1:00:00:00:01
511
512 atf_check -s exit:0 sleep 1
513 extract_new_packets > ./out
514 $DEBUG && cat ./out
515
516 pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC)
517 atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
518
519 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
520 b2:a1:00:00:00:02 active
521
522 atf_check -s exit:0 sleep 1
523 extract_new_packets > ./out
524 $DEBUG && cat ./out
525
526 pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC)
527 atf_check -s exit:0 -x \
528 "cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'"
529 }
530
531 static_arp_body()
532 {
533 local arp_keep=5
534 local macaddr_src=
535
536 atf_check -s exit:0 ${inetserver} $SOCKSRC
537 atf_check -s exit:0 ${inetserver} $SOCKDST
538
539 setup_dst_server
540 setup_src_server $arp_keep
541
542 export RUMP_SERVER=$SOCKSRC
543 macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}')
544
545 # Set a (valid) static ARP entry for the src server
546 export RUMP_SERVER=$SOCKDST
547 $DEBUG && rump.arp -n -a
548 atf_check -s exit:0 -o ignore rump.arp -s $IP4SRC $macaddr_src
549 $DEBUG && rump.arp -n -a
550
551 # Test receiving an ARP request with the static ARP entry (as spa/sha)
552 export RUMP_SERVER=$SOCKSRC
553 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
554 }
555
556 cleanup()
557 {
558 env RUMP_SERVER=$SOCKSRC rump.halt
559 env RUMP_SERVER=$SOCKDST rump.halt
560 }
561
562 dump_src()
563 {
564 export RUMP_SERVER=$SOCKSRC
565 rump.netstat -nr
566 rump.arp -n -a
567 rump.ifconfig
568 $HIJACKING dmesg
569 }
570
571 dump_dst()
572 {
573 export RUMP_SERVER=$SOCKDST
574 rump.netstat -nr
575 rump.arp -n -a
576 rump.ifconfig
577 $HIJACKING dmesg
578 }
579
580 dump()
581 {
582 dump_src
583 dump_dst
584 shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r -
585 }
586
587 cache_expiration_5s_cleanup()
588 {
589 $DEBUG && dump
590 cleanup
591 }
592
593 cache_expiration_10s_cleanup()
594 {
595 $DEBUG && dump
596 cleanup
597 }
598
599 command_cleanup()
600 {
601 $DEBUG && dump
602 cleanup
603 }
604
605 garp_cleanup()
606 {
607 $DEBUG && dump_src
608 $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r -
609 env RUMP_SERVER=$SOCKSRC rump.halt
610 }
611
612 cache_overwriting_cleanup()
613 {
614 $DEBUG && dump
615 cleanup
616 }
617
618 proxy_arp_pub_cleanup()
619 {
620 $DEBUG && dump
621 cleanup
622 }
623
624 proxy_arp_pubproxy_cleanup()
625 {
626 $DEBUG && dump
627 cleanup
628 }
629
630 link_activation_cleanup()
631 {
632 $DEBUG && dump
633 cleanup
634 }
635
636 static_arp_cleanup()
637 {
638 $DEBUG && dump
639 cleanup
640 }
641
642 atf_init_test_cases()
643 {
644 atf_add_test_case cache_expiration_5s
645 atf_add_test_case cache_expiration_10s
646 atf_add_test_case command
647 atf_add_test_case garp
648 atf_add_test_case cache_overwriting
649 atf_add_test_case proxy_arp_pub
650 atf_add_test_case proxy_arp_pubproxy
651 atf_add_test_case link_activation
652 atf_add_test_case static_arp
653 }
654