Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/arp Add tests for GARP without DAD
details: https://anonhg.NetBSD.org/src/rev/2d90c5239afa
branches: trunk
changeset: 360903:2d90c5239afa
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Apr 06 09:23:36 2018 +0000
description:
Add tests for GARP without DAD
Additionally make the existing tests for GARP more explicit.
diffstat:
tests/net/arp/t_arp.sh | 93 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 82 insertions(+), 11 deletions(-)
diffs (164 lines):
diff -r 9974644cee51 -r 2d90c5239afa tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh Fri Apr 06 09:22:38 2018 +0000
+++ b/tests/net/arp/t_arp.sh Fri Apr 06 09:23:36 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_arp.sh,v 1.35 2018/04/06 09:21:57 ozaki-r Exp $
+# $NetBSD: t_arp.sh,v 1.36 2018/04/06 09:23:36 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -41,6 +41,7 @@
atf_test_case arp_cache_expiration_10s cleanup
atf_test_case arp_command cleanup
atf_test_case arp_garp cleanup
+atf_test_case arp_garp_without_dad cleanup
atf_test_case arp_cache_overwriting cleanup
atf_test_case arp_proxy_arp_pub cleanup
atf_test_case arp_proxy_arp_pubproxy cleanup
@@ -71,6 +72,13 @@
atf_set "require.progs" "rump_server"
}
+arp_garp_without_dad_head()
+{
+
+ atf_set "descr" "Tests for GARP with DAD disabled"
+ atf_set "require.progs" "rump_server"
+}
+
arp_cache_overwriting_head()
{
atf_set "descr" "Tests for behavior of overwriting ARP caches"
@@ -297,45 +305,100 @@
echo $pkt
}
-arp_garp_body()
+test_garp_common()
{
+ local no_dad=$1
local pkt=
rump_server_start $SOCKSRC
export RUMP_SERVER=$SOCKSRC
+ if $no_dad; then
+ atf_check -s exit:0 -o match:'3 -> 0' \
+ rump.sysctl -w net.inet.ip.dad_count=0
+ fi
+
# Setup an interface
rump_server_add_iface $SOCKSRC shmif0 bus1
atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24
- atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias
atf_check -s exit:0 rump.ifconfig shmif0 up
$DEBUG && rump.ifconfig shmif0
atf_check -s exit:0 sleep 1
extract_new_packets bus1 > ./out
+ #
+ # Assign an address to an interface without IFF_UP
+ #
# A GARP packet is sent for the primary address
pkt=$(make_pkt_str_arpreq 10.0.0.1 10.0.0.1)
atf_check -s exit:0 -o match:"$pkt" cat ./out
- # No GARP packet is sent for the alias address
+
+ atf_check -s exit:0 rump.ifconfig shmif0 down
+ atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias
+
+ atf_check -s exit:0 sleep 1
+ extract_new_packets bus1 > ./out
+
+ # A GARP packet is sent for the alias address
pkt=$(make_pkt_str_arpreq 10.0.0.2 10.0.0.2)
- atf_check -s exit:0 -o not-match:"$pkt" cat ./out
+ atf_check -s exit:0 -o match:"$pkt" cat ./out
+
+ # Clean up
+ atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 delete
+ atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 delete
+
+ #
+ # Assign an address to an interface with IFF_UP
+ #
+ atf_check -s exit:0 rump.ifconfig shmif0 up
+
+ # Primary address
+ atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24
- atf_check -s exit:0 rump.ifconfig -w 10
- atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24
+ atf_check -s exit:0 sleep 1
+ extract_new_packets bus1 > ./out
+
+ pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3)
+ if $no_dad; then
+ # A GARP packet is sent
+ atf_check -s exit:0 -o match:"$pkt" cat ./out
+ else
+ # No GARP packet is sent
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
+ fi
+
+ # Alias address
atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias
- # No GARP packets are sent during IFF_UP
+ atf_check -s exit:0 sleep 1
extract_new_packets bus1 > ./out
- pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3)
- atf_check -s exit:0 -o not-match:"$pkt" cat ./out
+
pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4)
- atf_check -s exit:0 -o not-match:"$pkt" cat ./out
+ if $no_dad; then
+ # A GARP packet is sent
+ atf_check -s exit:0 -o match:"$pkt" cat ./out
+ else
+ # No GARP packet is sent
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
+ fi
rump_server_destroy_ifaces
}
+arp_garp_body()
+{
+
+ test_garp_common false
+}
+
+arp_garp_without_dad_body()
+{
+
+ test_garp_common true
+}
+
arp_cache_overwriting_body()
{
local bonus=2
@@ -583,6 +646,13 @@
cleanup
}
+arp_garp_without_dad_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
arp_cache_overwriting_cleanup()
{
$DEBUG && dump
@@ -879,6 +949,7 @@
atf_add_test_case arp_cache_expiration_10s
atf_add_test_case arp_command
atf_add_test_case arp_garp
+ atf_add_test_case arp_garp_without_dad
atf_add_test_case arp_cache_overwriting
atf_add_test_case arp_proxy_arp_pub
atf_add_test_case arp_proxy_arp_pubproxy
Home |
Main Index |
Thread Index |
Old Index