Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net tests: fix ARP and NDP tests for RTM_* messages



details:   https://anonhg.NetBSD.org/src/rev/34395ca8fb0c
branches:  trunk
changeset: 454053:34395ca8fb0c
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Sep 03 19:07:50 2019 +0000

description:
tests: fix ARP and NDP tests for RTM_* messages

While here add tests for RTM_MISS.

diffstat:

 tests/net/arp/t_arp.sh |  37 +++++++++++++++++++++++++++++++++++--
 tests/net/ndp/t_ndp.sh |  37 +++++++++++++++++++++++++++++++++++--
 2 files changed, 70 insertions(+), 4 deletions(-)

diffs (116 lines):

diff -r cb8978c2a5f7 -r 34395ca8fb0c tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh    Tue Sep 03 15:38:52 2019 +0000
+++ b/tests/net/arp/t_arp.sh    Tue Sep 03 19:07:50 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_arp.sh,v 1.38 2019/08/19 03:22:05 ozaki-r Exp $
+#      $NetBSD: t_arp.sh,v 1.39 2019/09/03 19:07:50 roy Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,6 +33,8 @@
 IP4DST=10.0.1.2
 IP4DST_PROXYARP1=10.0.1.3
 IP4DST_PROXYARP2=10.0.1.4
+IP4DST_FAIL1=10.0.1.99
+IP4DST_FAIL2=10.0.99.99
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -718,7 +720,38 @@
 
        hdr="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>"
        what="<DST,GATEWAY>"
-       addr="$IP4DST link#2"
+       addr="$IP4DST $macaddr_dst"
+       atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+               cat $file
+
+       # Test ping and a resulting routing message (RTM_MISS) on subnet
+       rump.route -n monitor -c 1 > $file &
+       pid=$!
+       sleep 1
+       # arp_maxtries = 5, second between each try
+       atf_check -s exit:2 -o ignore -e ignore \
+               rump.ping -n -w 6 -c 6 $IP4DST_FAIL1
+       wait $pid
+       $DEBUG && cat $file
+
+       hdr="RTM_MISS.+<DONE>"
+       what="<DST,GATEWAY>"
+       addr="$IP4DST_FAIL1 link#2"
+       atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+               cat $file
+
+       # Test ping and a resulting routing message (RTM_MISS) off subnet
+       rump.route -n monitor -c 1 > $file &
+       pid=$!
+       sleep 1
+       atf_check -s exit:2 -o ignore -e ignore \
+               rump.ping -n -w 1 -c 1 $IP4DST_FAIL2
+       wait $pid
+       $DEBUG && cat $file
+
+       hdr="RTM_MISS.+<DONE>"
+       what="<DST>"
+       addr="$IP4DST_FAIL2"
        atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
                cat $file
 
diff -r cb8978c2a5f7 -r 34395ca8fb0c tests/net/ndp/t_ndp.sh
--- a/tests/net/ndp/t_ndp.sh    Tue Sep 03 15:38:52 2019 +0000
+++ b/tests/net/ndp/t_ndp.sh    Tue Sep 03 19:07:50 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_ndp.sh,v 1.35 2019/08/19 03:20:27 ozaki-r Exp $
+#      $NetBSD: t_ndp.sh,v 1.36 2019/09/03 19:07:50 roy Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,6 +31,8 @@
 IP6SRC2=fc00::3
 IP6DST=fc00::2
 IP6NET=fc00::0
+IP6DST_FAIL1=fc00::99
+IP6DST_FAIL2=fc01::99
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -454,7 +456,38 @@
 
        hdr="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>"
        what="<DST,GATEWAY>"
-       addr="$IP6DST link#2"
+       addr="$IP6DST $macaddr_dst"
+       atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+               cat $file
+
+       # Test ping and a resulting routing message (RTM_MISS) on subnet
+       rump.route -n monitor -c 1 > $file &
+       pid=$!
+       sleep 1
+       # nd6_mmaxtries = 3, second between each try
+       atf_check -s exit:1 -o ignore -e ignore \
+               rump.ping6 -n -X 3 -c 3 $IP6DST_FAIL1
+       wait $pid
+       $DEBUG && cat $file
+
+       hdr="RTM_MISS.+<DONE>"
+       what="<DST,GATEWAY>"
+       addr="$IP6DST_FAIL1 link#2"
+       atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+               cat $file
+
+       # Test ping and a resulting routing message (RTM_MISS) off subnet
+       rump.route -n monitor -c 1 > $file &
+       pid=$!
+       sleep 1
+       atf_check -s exit:1 -o ignore -e ignore \
+               rump.ping6 -n -X 1 -c 1 $IP6DST_FAIL2
+       wait $pid
+       $DEBUG && cat $file
+
+       hdr="RTM_MISS.+<DONE>"
+       what="<DST>"
+       addr="$IP6DST_FAIL2"
        atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
                cat $file
 



Home | Main Index | Thread Index | Old Index