Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net Test implicit removals of ARP/NDP entries
details: https://anonhg.NetBSD.org/src/rev/561dfd745001
branches: trunk
changeset: 354583:561dfd745001
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Jun 22 10:06:33 2017 +0000
description:
Test implicit removals of ARP/NDP entries
One test case reproudces PR 51179.
diffstat:
tests/net/arp/t_arp.sh | 125 ++++++++++++++++++++++++++++++++++++++++++++++-
tests/net/ndp/t_ndp.sh | 130 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 253 insertions(+), 2 deletions(-)
diffs (truncated from 308 to 300 lines):
diff -r 78d06531af17 -r 561dfd745001 tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh Thu Jun 22 09:58:04 2017 +0000
+++ b/tests/net/arp/t_arp.sh Thu Jun 22 10:06:33 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_arp.sh,v 1.26 2017/06/21 09:05:31 ozaki-r Exp $
+# $NetBSD: t_arp.sh,v 1.27 2017/06/22 10:06:33 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -28,6 +28,8 @@
SOCKSRC=unix://commsock1
SOCKDST=unix://commsock2
IP4SRC=10.0.1.1
+IP4SRC2=10.0.1.5
+IP4NET=10.0.1.0
IP4DST=10.0.1.2
IP4DST_PROXYARP1=10.0.1.3
IP4DST_PROXYARP2=10.0.1.4
@@ -666,6 +668,124 @@
cleanup
}
+atf_test_case arp_purge_on_route_change cleanup
+arp_purge_on_route_change_head()
+{
+
+ atf_set "descr" "Tests if ARP entries are removed on route change"
+ atf_set "require.progs" "rump_server"
+}
+
+arp_purge_on_route_change_body()
+{
+
+ rump_server_start $SOCKSRC
+ rump_server_start $SOCKDST
+
+ setup_dst_server
+ setup_src_server
+
+ rump_server_add_iface $SOCKSRC shmif1 bus1
+ export RUMP_SERVER=$SOCKSRC
+ atf_check -s exit:0 rump.ifconfig shmif1 inet $IP4SRC2/24
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ $DEBUG && rump.netstat -nr -f inet
+ atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
+ $DEBUG && rump.arp -na
+ atf_check -s exit:0 -o ignore \
+ rump.route change -net $IP4NET -ifp shmif1
+ $DEBUG && rump.netstat -nr -f inet
+ $DEBUG && rump.arp -na
+ # The entry was already removed on route change
+ atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4DST
+
+ rump_server_destroy_ifaces
+}
+
+arp_purge_on_route_change_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case arp_purge_on_route_delete cleanup
+arp_purge_on_route_delete_head()
+{
+
+ atf_set "descr" "Tests if ARP entries are removed on route delete"
+ atf_set "require.progs" "rump_server"
+}
+
+arp_purge_on_route_delete_body()
+{
+
+ rump_server_start $SOCKSRC
+ rump_server_start $SOCKDST
+
+ setup_dst_server
+ setup_src_server
+
+ $DEBUG && rump.netstat -nr -f inet
+ atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
+ $DEBUG && rump.arp -na
+
+ atf_check -s exit:0 -o ignore rump.route delete -net $IP4NET
+ $DEBUG && rump.netstat -nr -f inet
+ $DEBUG && rump.arp -na
+
+ # The entry was already removed on route delete
+ atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4DST
+
+ rump_server_destroy_ifaces
+}
+
+arp_purge_on_route_delete_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case arp_purge_on_ifdown cleanup
+arp_purge_on_ifdown_head()
+{
+
+ atf_set "descr" "Tests if ARP entries are removed on interface down"
+ atf_set "require.progs" "rump_server"
+}
+
+arp_purge_on_ifdown_body()
+{
+
+ rump_server_start $SOCKSRC
+ rump_server_start $SOCKDST
+
+ setup_dst_server
+ setup_src_server
+
+ $DEBUG && rump.netstat -nr -f inet
+ atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
+ atf_check -s exit:0 -o match:'shmif0' rump.arp -n $IP4DST
+
+ # Shutdown the interface
+ atf_check -s exit:0 rump.ifconfig shmif0 down
+ $DEBUG && rump.netstat -nr -f inet
+ $DEBUG && rump.arp -na
+
+ atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4DST
+
+ rump_server_destroy_ifaces
+}
+
+arp_purge_on_ifdown_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case arp_cache_expiration_5s
@@ -678,4 +798,7 @@
atf_add_test_case arp_link_activation
atf_add_test_case arp_static
atf_add_test_case arp_rtm
+ atf_add_test_case arp_purge_on_route_change
+ atf_add_test_case arp_purge_on_route_delete
+ atf_add_test_case arp_purge_on_ifdown
}
diff -r 78d06531af17 -r 561dfd745001 tests/net/ndp/t_ndp.sh
--- a/tests/net/ndp/t_ndp.sh Thu Jun 22 09:58:04 2017 +0000
+++ b/tests/net/ndp/t_ndp.sh Thu Jun 22 10:06:33 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ndp.sh,v 1.23 2017/06/22 09:05:02 ozaki-r Exp $
+# $NetBSD: t_ndp.sh,v 1.24 2017/06/22 10:06:34 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -28,7 +28,9 @@
SOCKSRC=unix://commsock1
SOCKDST=unix://commsock2
IP6SRC=fc00::1
+IP6SRC2=fc00::3
IP6DST=fc00::2
+IP6NET=fc00::0
DEBUG=${DEBUG:-false}
TIMEOUT=1
@@ -465,6 +467,129 @@
cleanup
}
+atf_test_case ndp_purge_on_route_change cleanup
+ndp_purge_on_route_change_head()
+{
+
+ atf_set "descr" "Tests if NDP entries are removed on route change"
+ atf_set "require.progs" "rump_server"
+}
+
+ndp_purge_on_route_change_body()
+{
+
+ rump_server_start $SOCKSRC netinet6
+ rump_server_start $SOCKDST netinet6
+
+ setup_dst_server
+ setup_src_server
+
+ rump_server_add_iface $SOCKSRC shmif1 bus1
+ export RUMP_SERVER=$SOCKSRC
+ atf_check -s exit:0 rump.ifconfig shmif1 inet6 $IP6SRC2
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ $DEBUG && rump.netstat -nr -f inet6
+ atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
+ atf_check -s exit:0 -o match:'shmif0' rump.ndp -n $IP6DST
+
+ atf_check -s exit:0 -o ignore \
+ rump.route change -inet6 -net $IP6NET/64 -ifp shmif1
+ $DEBUG && rump.netstat -nr -f inet6
+ $DEBUG && rump.ndp -na
+ # The entry was already removed on route change
+ atf_check -s not-exit:0 -o ignore -e match:'no entry' \
+ rump.ndp -n $IP6DST
+
+ rump_server_destroy_ifaces
+}
+
+ndp_purge_on_route_change_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case ndp_purge_on_route_delete cleanup
+ndp_purge_on_route_delete_head()
+{
+
+ atf_set "descr" "Tests if NDP entries are removed on route delete"
+ atf_set "require.progs" "rump_server"
+}
+
+ndp_purge_on_route_delete_body()
+{
+
+ rump_server_start $SOCKSRC netinet6
+ rump_server_start $SOCKDST netinet6
+
+ setup_dst_server
+ setup_src_server
+
+ $DEBUG && rump.netstat -nr -f inet6
+ atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
+ atf_check -s exit:0 -o match:'shmif0' rump.ndp -n $IP6DST
+
+ atf_check -s exit:0 -o ignore rump.route delete -inet6 -net $IP6NET/64
+ $DEBUG && rump.netstat -nr -f inet6
+ $DEBUG && rump.ndp -na
+
+ # The entry was already removed on route delete
+ atf_check -s not-exit:0 -o ignore -e match:'no entry' \
+ rump.ndp -n $IP6DST
+
+ rump_server_destroy_ifaces
+}
+
+ndp_purge_on_route_delete_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case ndp_purge_on_ifdown cleanup
+ndp_purge_on_ifdown_head()
+{
+
+ atf_set "descr" "Tests if NDP entries are removed on interface down"
+ atf_set "require.progs" "rump_server"
+}
+
+ndp_purge_on_ifdown_body()
+{
+
+ rump_server_start $SOCKSRC netinet6
+ rump_server_start $SOCKDST netinet6
+
+ setup_dst_server
+ setup_src_server
+
+ $DEBUG && rump.netstat -nr -f inet6
+ atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
+ atf_check -s exit:0 -o match:'shmif0' rump.ndp -n $IP6DST
+
+ # Shutdown the interface
+ atf_check -s exit:0 rump.ifconfig shmif0 down
+ $DEBUG && rump.netstat -nr -f inet6
+ $DEBUG && rump.ndp -na
+
+ # The entry was already removed on ifconfig down
+ atf_check -s not-exit:0 -o ignore -e match:'no entry' \
+ rump.ndp -n $IP6DST
+
+ rump_server_destroy_ifaces
+}
+
+ndp_purge_on_ifdown_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case ndp_cache_expiration
Home |
Main Index |
Thread Index |
Old Index