Fri Jun 16 04:41:03 2017 UTC ()
Test routing messages emitted on operations of ARP/NDP entries


(ozaki-r)
diff -r1.22 -r1.23 src/tests/net/arp/t_arp.sh
diff -r1.19 -r1.20 src/tests/net/ndp/t_ndp.sh

cvs diff -r1.22 -r1.23 src/tests/net/arp/t_arp.sh (expand / switch to unified diff)

--- src/tests/net/arp/t_arp.sh 2016/11/25 08:51:16 1.22
+++ src/tests/net/arp/t_arp.sh 2017/06/16 04:41:02 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: t_arp.sh,v 1.22 2016/11/25 08:51:16 ozaki-r Exp $ 1# $NetBSD: t_arp.sh,v 1.23 2017/06/16 04:41:02 ozaki-r Exp $
2# 2#
3# Copyright (c) 2015 The NetBSD Foundation, Inc. 3# Copyright (c) 2015 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# Redistribution and use in source and binary forms, with or without 6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions 7# modification, are permitted provided that the following conditions
8# are met: 8# are met:
9# 1. Redistributions of source code must retain the above copyright 9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer. 10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright 11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the 12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution. 13# documentation and/or other materials provided with the distribution.
14# 14#
@@ -588,25 +588,97 @@ arp_proxy_arp_pubproxy_cleanup() @@ -588,25 +588,97 @@ arp_proxy_arp_pubproxy_cleanup()
588 588
589arp_link_activation_cleanup() 589arp_link_activation_cleanup()
590{ 590{
591 $DEBUG && dump 591 $DEBUG && dump
592 cleanup 592 cleanup
593} 593}
594 594
595arp_static_cleanup() 595arp_static_cleanup()
596{ 596{
597 $DEBUG && dump 597 $DEBUG && dump
598 cleanup 598 cleanup
599} 599}
600 600
 601arp_rtm_head()
 602{
 603
 604 atf_set "descr" "Tests for routing messages on operations of ARP entries"
 605 atf_set "require.progs" "rump_server"
 606}
 607
 608arp_rtm_body()
 609{
 610 local arp_keep=5
 611 local macaddr_src= macaddr_dst=
 612 local file=./tmp
 613 local pid= str=
 614
 615 rump_server_start $SOCKSRC
 616 rump_server_start $SOCKDST
 617
 618 setup_dst_server
 619 setup_src_server $arp_keep
 620
 621 macaddr_src=$(get_macaddr $SOCKSRC shmif0)
 622 macaddr_dst=$(get_macaddr $SOCKDST shmif0)
 623
 624 export RUMP_SERVER=$SOCKSRC
 625
 626 # Test ping and a resulting routing message (RTM_ADD)
 627 rump.route -n monitor -c 1 > $file &
 628 pid=$?
 629 sleep 1
 630 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
 631 wait $pid
 632 $DEBUG && cat $file
 633
 634 str="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>"
 635 atf_check -s exit:0 -o match:"$str" cat $file
 636 str="<DST,GATEWAY,IFP,IFA>"
 637 atf_check -s exit:0 -o match:"$str" cat $file
 638 str="$IP4DST link#2 $macaddr_src $IP4SRC"
 639 atf_check -s exit:0 -o match:"$str" cat $file
 640
 641 # Test arp -d and resulting routing messages (RTM_GET and RTM_DELETE)
 642 rump.route -n monitor -c 2 > $file &
 643 pid=$?
 644 sleep 1
 645 atf_check -s exit:0 -o ignore rump.arp -d $IP4DST
 646 wait $pid
 647 $DEBUG && cat $file
 648
 649 str="RTM_GET.+<UP,DONE,LLINFO>"
 650 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 651 str="<DST,GATEWAY,IFP,IFA>"
 652 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 653 str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
 654 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 655 str="RTM_DELETE.+<UP,DONE,LLINFO>"
 656 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 657 str="<DST,GATEWAY,IFP,IFA>"
 658 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 659 str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
 660 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 661
 662 rump_server_destroy_ifaces
 663}
 664
 665arp_rtm_cleanup()
 666{
 667
 668 $DEBUG && dump
 669 cleanup
 670}
 671
601atf_init_test_cases() 672atf_init_test_cases()
602{ 673{
603 atf_add_test_case arp_cache_expiration_5s 674 atf_add_test_case arp_cache_expiration_5s
604 atf_add_test_case arp_cache_expiration_10s 675 atf_add_test_case arp_cache_expiration_10s
605 atf_add_test_case arp_command 676 atf_add_test_case arp_command
606 atf_add_test_case arp_garp 677 atf_add_test_case arp_garp
607 atf_add_test_case arp_cache_overwriting 678 atf_add_test_case arp_cache_overwriting
608 atf_add_test_case arp_proxy_arp_pub 679 atf_add_test_case arp_proxy_arp_pub
609 atf_add_test_case arp_proxy_arp_pubproxy 680 atf_add_test_case arp_proxy_arp_pubproxy
610 atf_add_test_case arp_link_activation 681 atf_add_test_case arp_link_activation
611 atf_add_test_case arp_static 682 atf_add_test_case arp_static
 683 atf_add_test_case arp_rtm
612} 684}

cvs diff -r1.19 -r1.20 src/tests/net/ndp/t_ndp.sh (expand / switch to unified diff)

--- src/tests/net/ndp/t_ndp.sh 2017/05/26 01:14:38 1.19
+++ src/tests/net/ndp/t_ndp.sh 2017/06/16 04:41:02 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: t_ndp.sh,v 1.19 2017/05/26 01:14:38 ozaki-r Exp $ 1# $NetBSD: t_ndp.sh,v 1.20 2017/06/16 04:41:02 ozaki-r Exp $
2# 2#
3# Copyright (c) 2015 The NetBSD Foundation, Inc. 3# Copyright (c) 2015 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# Redistribution and use in source and binary forms, with or without 6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions 7# modification, are permitted provided that the following conditions
8# are met: 8# are met:
9# 1. Redistributions of source code must retain the above copyright 9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer. 10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright 11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the 12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution. 13# documentation and/or other materials provided with the distribution.
14# 14#
@@ -386,21 +386,92 @@ ndp_cache_overwriting_cleanup() @@ -386,21 +386,92 @@ ndp_cache_overwriting_cleanup()
386 386
387ndp_neighborgcthresh_cleanup() 387ndp_neighborgcthresh_cleanup()
388{ 388{
389 $DEBUG && dump 389 $DEBUG && dump
390 cleanup 390 cleanup
391} 391}
392 392
393ndp_link_activation_cleanup() 393ndp_link_activation_cleanup()
394{ 394{
395 $DEBUG && dump 395 $DEBUG && dump
396 cleanup 396 cleanup
397} 397}
398 398
 399ndp_rtm_head()
 400{
 401
 402 atf_set "descr" "Tests for routing messages on operations of ARP entries"
 403 atf_set "require.progs" "rump_server"
 404}
 405
 406ndp_rtm_body()
 407{
 408 local macaddr_src= macaddr_dst=
 409 local file=./tmp
 410 local pid= str=
 411
 412 rump_server_start $SOCKSRC netinet6
 413 rump_server_start $SOCKDST netinet6
 414
 415 setup_dst_server
 416 setup_src_server
 417
 418 macaddr_src=$(get_macaddr $SOCKSRC shmif0)
 419 macaddr_dst=$(get_macaddr $SOCKDST shmif0)
 420
 421 export RUMP_SERVER=$SOCKSRC
 422
 423 # Test ping and a resulting routing message (RTM_ADD)
 424 rump.route -n monitor -c 1 > $file &
 425 pid=$?
 426 sleep 1
 427 atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
 428 wait $pid
 429 $DEBUG && cat $file
 430
 431 str="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>"
 432 atf_check -s exit:0 -o match:"$str" cat $file
 433 str="<DST,GATEWAY,IFP,IFA>"
 434 atf_check -s exit:0 -o match:"$str" cat $file
 435 str="$IP6DST link#2 $macaddr_src $IP6SRC"
 436 atf_check -s exit:0 -o match:"$str" cat $file
 437
 438 # Test ndp -d and resulting routing messages (RTM_GET and RTM_DELETE)
 439 rump.route -n monitor -c 2 > $file &
 440 pid=$?
 441 sleep 1
 442 atf_check -s exit:0 -o ignore rump.ndp -d $IP6DST
 443 wait $pid
 444 $DEBUG && cat $file
 445
 446 str="RTM_GET.+<UP,DONE,LLINFO>"
 447 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 448 str="<DST,GATEWAY,IFP,IFA>"
 449 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 450 str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
 451 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 452 str="RTM_DELETE.+<UP,DONE,LLINFO>"
 453 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 454 str="<DST,GATEWAY,IFP,IFA>"
 455 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 456 str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
 457 atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 458
 459 rump_server_destroy_ifaces
 460}
 461
 462ndp_rtm_cleanup()
 463{
 464
 465 $DEBUG && dump
 466 cleanup
 467}
 468
399atf_init_test_cases() 469atf_init_test_cases()
400{ 470{
401 atf_add_test_case ndp_cache_expiration 471 atf_add_test_case ndp_cache_expiration
402 atf_add_test_case ndp_commands 472 atf_add_test_case ndp_commands
403 atf_add_test_case ndp_cache_overwriting 473 atf_add_test_case ndp_cache_overwriting
404 atf_add_test_case ndp_neighborgcthresh 474 atf_add_test_case ndp_neighborgcthresh
405 atf_add_test_case ndp_link_activation 475 atf_add_test_case ndp_link_activation
 476 atf_add_test_case ndp_rtm
406} 477}