CVS commit: src/tests/net/carp

2023-09-19 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Sep 19 11:55:14 UTC 2023

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Don't expect the net/carp/t_basic/carp_handover_ipv6_halt_nocarpdevip
and carp_handover_ipv6_ifdown_nocarpdevip test cases to fail.  At
least on the TNF i386 and amd64 testbeds, they pass more often than
not since the commit of src/sys/netinet/ip_carp.c 1.119 by mlelstv on
2023.04.07.06.44.08.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2023-09-19 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Sep 19 11:55:14 UTC 2023

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Don't expect the net/carp/t_basic/carp_handover_ipv6_halt_nocarpdevip
and carp_handover_ipv6_ifdown_nocarpdevip test cases to fail.  At
least on the TNF i386 and amd64 testbeds, they pass more often than
not since the commit of src/sys/netinet/ip_carp.c 1.119 by mlelstv on
2023.04.07.06.44.08.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.8 src/tests/net/carp/t_basic.sh:1.9
--- src/tests/net/carp/t_basic.sh:1.8	Mon Aug 19 03:22:05 2019
+++ src/tests/net/carp/t_basic.sh	Tue Sep 19 11:55:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.8 2019/08/19 03:22:05 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.9 2023/09/19 11:55:14 gson Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -328,9 +328,6 @@ add_test_case()
 		name="${name}_nocarpdevip"
 		desc="$desc without carpdev IP"
 	fi
-	if [ $ipproto = ipv6 -a $carpdevip = no ]; then
-		expected_failure_code="atf_expect_fail 'nd6 needs to be fixed';"
-	fi
 
 	atf_test_case ${name} cleanup
 	eval "



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:34:48 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test CARP handover on setups without having IPs on carpdev (shmif)

Note that tests for IPv6 don't pass yet; nd6 needs to handle CARP
correctly like arp does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:34:48 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test CARP handover on setups without having IPs on carpdev (shmif)

Note that tests for IPv6 don't pass yet; nd6 needs to handle CARP
correctly like arp does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.5 src/tests/net/carp/t_basic.sh:1.6
--- src/tests/net/carp/t_basic.sh:1.5	Thu May 18 06:33:49 2017
+++ src/tests/net/carp/t_basic.sh	Thu May 18 06:34:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.5 2017/05/18 06:33:49 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.6 2017/05/18 06:34:48 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -42,6 +42,7 @@ setup_carp()
 {
 	local sock=$1
 	local master=$2
+	local carpdevip=$3
 	local carpif= ip= advskew=
 
 	if $master; then
@@ -60,10 +61,17 @@ setup_carp()
 		rump.sysctl -w net.inet.carp.log=1
 	fi
 	atf_check -s exit:0 rump.ifconfig $carpif create
-	atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
-	atf_check -s exit:0 rump.ifconfig $carpif \
-	vhid 175 advskew $advskew advbase 1 pass s3cret \
-	$IP_CARP netmask 255.255.255.0
+	if [ $carpdevip = yes ]; then
+		atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
+		atf_check -s exit:0 rump.ifconfig $carpif \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		$IP_CARP netmask 255.255.255.0
+	else
+		atf_check -s exit:0 rump.ifconfig shmif0 up
+		atf_check -s exit:0 rump.ifconfig $carpif \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		carpdev shmif0 $IP_CARP netmask 255.255.255.0
+	fi
 	atf_check -s exit:0 rump.ifconfig -w 10
 }
 
@@ -92,6 +100,7 @@ wait_handover()
 test_carp_handover_ipv4()
 {
 	local op=$1
+	local carpdevip=$2
 
 	rump_server_start $SOCK_CLIENT
 	rump_server_start $SOCK_MASTER
@@ -101,18 +110,20 @@ test_carp_handover_ipv4()
 	rump_server_add_iface $SOCK_MASTER shmif0 $BUS
 	rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
 
-	setup_carp $SOCK_MASTER true
-	setup_carp $SOCK_BACKUP false
+	setup_carp $SOCK_MASTER true $carpdevip
+	setup_carp $SOCK_BACKUP false $carpdevip
 
 	export RUMP_SERVER=$SOCK_CLIENT
 	atf_check -s exit:0 rump.ifconfig shmif0 $IP_CLIENT/24 up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
-	# Check that the primary addresses are up
-	atf_check -s exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
-	atf_check -s exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP
+	if [ $carpdevip = yes ]; then
+		# Check that the primary addresses are up
+		atf_check -s exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+		atf_check -s exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP
+	fi
 
 	# Give carp a while to croak
 	sleep 4
@@ -141,8 +152,12 @@ test_carp_handover_ipv4()
 	sleep 1
 
 	# Check that primary is now dead
-	atf_check -s not-exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+	if [ $carpdevip = yes ]; then
+		atf_check -s not-exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+	else
+		# XXX how to check?
+	fi
 
 	# Do it in installments. carp will cluck meanwhile
 	wait_handover
@@ -167,6 +182,7 @@ setup_carp6()
 {
 	local sock=$1
 	local master=$2
+	local carpdevip=$3
 	local carpif= ip= advskew=
 
 	if $master; then
@@ -185,9 +201,16 @@ setup_carp6()
 		rump.sysctl -w net.inet.carp.log=1
 	fi
 	atf_check -s exit:0 rump.ifconfig $carpif create
-	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
-	atf_check -s exit:0 rump.ifconfig $carpif inet6 \
-	vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
+	if [ $carpdevip = yes ]; then
+		atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
+		atf_check -s exit:0 rump.ifconfig $carpif inet6 \
+		vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
+	else
+		atf_check -s exit:0 rump.ifconfig shmif0 up
+		atf_check -s exit:0 rump.ifconfig $carpif inet6 \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		carpdev shmif0 $IP6_CARP
+	fi
 	atf_check -s exit:0 rump.ifconfig -w 10
 }
 
@@ -216,6 +239,7 @@ wait_carp6_handover()
 test_carp_handover_ipv6()
 {
 	local op=$1
+	local carpdevip=$2
 
 	rump_server_start $SOCK_CLIENT netinet6
 	rump_server_start $SOCK_MASTER netinet6
@@ -225,18 +249,20 @@ test_carp_handover_ipv6()
 	rump_server_add_iface $SOCK_MASTER shmif0 $BUS
 	rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
 
-	setup_carp6 $SOCK_MASTER true
-	setup_carp6 $SOCK_BACKUP false
+	setup_carp6 $SOCK_MASTER true $carpdevip
+	setup_carp6 $SOCK_BACKUP false $carpdevip
 
 	export RUMP_SERVER=$SOCK_CLIENT
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_CLIENT up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
-	# 

CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:49 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Reduce duplicated codes (DRY)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.4 src/tests/net/carp/t_basic.sh:1.5
--- src/tests/net/carp/t_basic.sh:1.4	Mon Feb 27 08:26:53 2017
+++ src/tests/net/carp/t_basic.sh	Thu May 18 06:33:49 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.4 2017/02/27 08:26:53 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.5 2017/05/18 06:33:49 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -31,21 +31,7 @@ SOCK_BACKUP=unix://carp_backup
 BUS=bus_carp
 TIMEOUT=3
 
-atf_test_case carp_handover_halt cleanup
-carp_handover_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on halt"
-	atf_set "require.progs" "rump_server"
-}
-
-atf_test_case carp_handover_ifdown cleanup
-carp_handover_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on ifconfig down"
-	atf_set "require.progs" "rump_server"
-}
+DEBUG=${DEBUG:-false}
 
 IP_CLIENT=10.1.1.240
 IP_MASTER=10.1.1.1
@@ -103,7 +89,7 @@ wait_handover()
 	fi
 }
 
-test_carp_handover()
+test_carp_handover_ipv4()
 {
 	local op=$1
 
@@ -172,48 +158,6 @@ test_carp_handover()
 	fi
 }
 
-carp_handover_halt_body()
-{
-
-	test_carp_handover halt
-}
-
-carp_handover_ifdown_body()
-{
-
-	test_carp_handover ifdown
-}
-
-carp_handover_halt_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-carp_handover_ifdown_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-atf_test_case carp6_handover_halt cleanup
-carp6_handover_halt_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on halt (IPv6)"
-	atf_set "require.progs" "rump_server"
-}
-
-atf_test_case carp6_handover_ifdown cleanup
-carp6_handover_ifdown_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on ifconfig down (IPv6)"
-	atf_set "require.progs" "rump_server"
-}
-
 IP6_CLIENT=fd00:1::240
 IP6_MASTER=fd00:1::1
 IP6_BACKUP=fd00:1::2
@@ -269,7 +213,7 @@ wait_carp6_handover()
 	fi
 }
 
-test_carp6_handover()
+test_carp_handover_ipv6()
 {
 	local op=$1
 
@@ -338,37 +282,41 @@ test_carp6_handover()
 	fi
 }
 
-carp6_handover_halt_body()
+add_test_case()
 {
+	local ipproto=$1
+	local halt=$2
 
-	test_carp6_handover halt
-}
+	name="carp_handover_${ipproto}_${halt}"
+	desc="Tests for CARP (${ipproto}) handover on ${halt}"
 
-carp6_handover_ifdown_body()
-{
-
-	test_carp6_handover ifdown
-}
-
-carp6_handover_halt_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-carp6_handover_ifdown_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
+	atf_test_case ${name} cleanup
+	eval "			\
+	${name}_head() {	\
+	atf_set \"descr\" \"$desc\";			\
+	atf_set \"require.progs\" \"rump_server\";	\
+	};			\
+	${name}_body() {	\
+	test_carp_handover_${ipproto} $halt;		\
+	if [ $halt != halt ]; then			\
+	 rump_server_destroy_ifaces;		\
+	fi		\
+	};			\
+	${name}_cleanup() {	\
+	$DEBUG && dump;	\
+	cleanup;	\
+	}			\
+	"
+	atf_add_test_case ${name}
 }
 
 atf_init_test_cases()
 {
+	local proto= halt=
 
-	atf_add_test_case carp_handover_halt
-	atf_add_test_case carp_handover_ifdown
-	atf_add_test_case carp6_handover_halt
-	atf_add_test_case carp6_handover_ifdown
+	for proto in ipv4 ipv6; do
+		for halt in halt ifdown; do
+			add_test_case $proto $halt
+		done
+	done
 }



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:49 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Reduce duplicated codes (DRY)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-02-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 27 07:25:59 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test handovers on interface down as well as server halt


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.2 src/tests/net/carp/t_basic.sh:1.3
--- src/tests/net/carp/t_basic.sh:1.2	Mon Feb 27 07:24:26 2017
+++ src/tests/net/carp/t_basic.sh	Mon Feb 27 07:25:59 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.2 2017/02/27 07:24:26 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.3 2017/02/27 07:25:59 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -31,11 +31,19 @@ SOCK_BACKUP=unix://carp_backup
 BUS=bus_carp
 TIMEOUT=3
 
-atf_test_case carp_handover cleanup
+atf_test_case carp_handover_halt cleanup
 carp_handover_head()
 {
 
-	atf_set "descr" "Tests for CARP handover"
+	atf_set "descr" "Tests for CARP handover on halt"
+	atf_set "require.progs" "rump_server"
+}
+
+atf_test_case carp_handover_ifdown cleanup
+carp_handover_head()
+{
+
+	atf_set "descr" "Tests for CARP handover on ifconfig down"
 	atf_set "require.progs" "rump_server"
 }
 
@@ -95,8 +103,9 @@ wait_handover()
 	fi
 }
 
-carp_handover_body()
+test_carp_handover()
 {
+	local op=$1
 
 	rump_server_start $SOCK_CLIENT
 	rump_server_start $SOCK_MASTER
@@ -138,7 +147,11 @@ carp_handover_body()
 	rump.ping -n -w $TIMEOUT -c 1 $IP_CARP
 
 	# KILLING SPREE
-	env RUMP_SERVER=$SOCK_MASTER rump.halt
+	if [ $op = halt ]; then
+		env RUMP_SERVER=$SOCK_MASTER rump.halt
+	elif [ $op = ifdown ]; then
+		env RUMP_SERVER=$SOCK_MASTER rump.ifconfig shmif0 down
+	fi
 	sleep 1
 
 	# Check that primary is now dead
@@ -153,20 +166,51 @@ carp_handover_body()
 	$DEBUG && rump.ifconfig
 	atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
 	rump.ifconfig carp1
+
+	if [ $op = ifdown ]; then
+		rump_server_destroy_ifaces
+	fi
+}
+
+carp_handover_halt_body()
+{
+
+	test_carp_handover halt
+}
+
+carp_handover_ifdown_body()
+{
+
+	test_carp_handover ifdown
+}
+
+carp_handover_halt_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
 }
 
-carp_handover_cleanup()
+carp_handover_ifdown_cleanup()
 {
 
 	$DEBUG && dump
 	cleanup
 }
 
-atf_test_case carp6_handover cleanup
-carp6_handover_head()
+atf_test_case carp6_handover_halt cleanup
+carp6_handover_halt_head()
 {
 
-	atf_set "descr" "Tests for CARP handover (IPv6)"
+	atf_set "descr" "Tests for CARP handover on halt (IPv6)"
+	atf_set "require.progs" "rump_server"
+}
+
+atf_test_case carp6_handover_ifdown cleanup
+carp6_handover_ifdown_head()
+{
+
+	atf_set "descr" "Tests for CARP handover on ifconfig down (IPv6)"
 	atf_set "require.progs" "rump_server"
 }
 
@@ -225,8 +269,9 @@ wait_carp6_handover()
 	fi
 }
 
-carp6_handover_body()
+test_carp6_handover()
 {
+	local op=$1
 
 	atf_expect_fail 'The implementation of CARP on IPv6 is incomplete yet.'
 
@@ -270,7 +315,11 @@ carp6_handover_body()
 	rump.ping6 -n -X $TIMEOUT -c 1 $IP6_CARP
 
 	# KILLING SPREE
-	env RUMP_SERVER=$SOCK_MASTER rump.halt
+	if [ $op = halt ]; then
+		env RUMP_SERVER=$SOCK_MASTER rump.halt
+	elif [ $op = ifdown ]; then
+		env RUMP_SERVER=$SOCK_MASTER rump.ifconfig shmif0 down
+	fi
 	sleep 1
 
 	# Check that primary is now dead
@@ -285,9 +334,32 @@ carp6_handover_body()
 	$DEBUG && rump.ifconfig
 	atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
 	rump.ifconfig carp1
+
+	if [ $op = ifdown ]; then
+		rump_server_destroy_ifaces
+	fi
+}
+
+carp6_handover_halt_body()
+{
+
+	test_carp6_handover halt
+}
+
+carp6_handover_ifdown_body()
+{
+
+	test_carp6_handover ifdown
+}
+
+carp6_handover_halt_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
 }
 
-carp6_handover_cleanup()
+carp6_handover_ifdown_cleanup()
 {
 
 	$DEBUG && dump
@@ -297,6 +369,8 @@ carp6_handover_cleanup()
 atf_init_test_cases()
 {
 
-	atf_add_test_case carp_handover
-	atf_add_test_case carp6_handover
+	atf_add_test_case carp_handover_halt
+	atf_add_test_case carp_handover_ifdown
+	atf_add_test_case carp6_handover_halt
+	atf_add_test_case carp6_handover_ifdown
 }



CVS commit: src/tests/net/carp

2017-02-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 27 07:25:59 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test handovers on interface down as well as server halt


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-02-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 27 07:24:26 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Add a test case for CARP on IPv6

The test case fails expectedly because the implementation of CARP on IPv6
is incomplete yet.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.1 src/tests/net/carp/t_basic.sh:1.2
--- src/tests/net/carp/t_basic.sh:1.1	Mon Jan 16 08:18:11 2017
+++ src/tests/net/carp/t_basic.sh	Mon Feb 27 07:24:26 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.1 2017/01/16 08:18:11 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.2 2017/02/27 07:24:26 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -29,14 +29,9 @@ SOCK_CLIENT=unix://carp_client
 SOCK_MASTER=unix://carp_master
 SOCK_BACKUP=unix://carp_backup
 BUS=bus_carp
-IP_CLIENT=10.1.1.240
-IP_MASTER=10.1.1.1
-IP_BACKUP=10.1.1.2
-IP_CARP=10.1.1.100
 TIMEOUT=3
 
 atf_test_case carp_handover cleanup
-
 carp_handover_head()
 {
 
@@ -44,6 +39,11 @@ carp_handover_head()
 	atf_set "require.progs" "rump_server"
 }
 
+IP_CLIENT=10.1.1.240
+IP_MASTER=10.1.1.1
+IP_BACKUP=10.1.1.2
+IP_CARP=10.1.1.100
+
 setup_carp()
 {
 	local sock=$1
@@ -61,6 +61,10 @@ setup_carp()
 	fi
 
 	export RUMP_SERVER=$sock
+	if $DEBUG; then
+		atf_check -s exit:0 -o match:'0.->.1' \
+		rump.sysctl -w net.inet.carp.log=1
+	fi
 	atf_check -s exit:0 rump.ifconfig $carpif create
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
 	atf_check -s exit:0 rump.ifconfig $carpif \
@@ -158,8 +162,141 @@ carp_handover_cleanup()
 	cleanup
 }
 
+atf_test_case carp6_handover cleanup
+carp6_handover_head()
+{
+
+	atf_set "descr" "Tests for CARP handover (IPv6)"
+	atf_set "require.progs" "rump_server"
+}
+
+IP6_CLIENT=fd00:1::240
+IP6_MASTER=fd00:1::1
+IP6_BACKUP=fd00:1::2
+IP6_CARP=fd00:1::100
+
+setup_carp6()
+{
+	local sock=$1
+	local master=$2
+	local carpif= ip= advskew=
+
+	if $master; then
+		carpif=carp0
+		ip=$IP6_MASTER
+		advskew=0
+	else
+		carpif=carp1
+		ip=$IP6_BACKUP
+		advskew=200
+	fi
+
+	export RUMP_SERVER=$sock
+	if $DEBUG; then
+		atf_check -s exit:0 -o match:'0.->.1' \
+		rump.sysctl -w net.inet.carp.log=1
+	fi
+	atf_check -s exit:0 rump.ifconfig $carpif create
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
+	atf_check -s exit:0 rump.ifconfig $carpif inet6 \
+	vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
+	atf_check -s exit:0 rump.ifconfig -w 10
+}
+
+wait_carp6_handover()
+{
+	local i=0
+
+	export RUMP_SERVER=$SOCK_CLIENT
+
+	while [ $i -ne 5 ]; do
+		$DEBUG && echo "Trying ping6 $IP6_CARP"
+		rump.ping6 -n -X 1 -c 1 $IP6_CARP >/dev/null
+		if [ $? = 0 ]; then
+			$DEBUG && echo "Passed ping $IP6_CARP"
+			break;
+		fi
+		$DEBUG && echo "Failed ping6 $IP6_CARP"
+		i=$((i + 1))
+	done
+
+	if [ $i -eq 5 ]; then
+		atf_fail "Failed to failover (5 sec)"
+	fi
+}
+
+carp6_handover_body()
+{
+
+	atf_expect_fail 'The implementation of CARP on IPv6 is incomplete yet.'
+
+	rump_server_start $SOCK_CLIENT netinet6
+	rump_server_start $SOCK_MASTER netinet6
+	rump_server_start $SOCK_BACKUP netinet6
+
+	rump_server_add_iface $SOCK_CLIENT shmif0 $BUS
+	rump_server_add_iface $SOCK_MASTER shmif0 $BUS
+	rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
+
+	setup_carp6 $SOCK_MASTER true
+	setup_carp6 $SOCK_BACKUP false
+
+	export RUMP_SERVER=$SOCK_CLIENT
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_CLIENT up
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	# Check that the primary addresses are up
+	atf_check -s exit:0 -o ignore \
+	rump.ping6 -n -X $TIMEOUT -c 1 $IP6_MASTER
+	atf_check -s exit:0 -o ignore \
+	rump.ping6 -n -X $TIMEOUT -c 1 $IP6_BACKUP
+
+	# Give carp a while to croak
+	sleep 4
+
+	# Check state
+	export RUMP_SERVER=$SOCK_MASTER
+	$DEBUG && rump.ifconfig
+	atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
+	rump.ifconfig carp0
+	export RUMP_SERVER=$SOCK_BACKUP
+	$DEBUG && rump.ifconfig
+	atf_check -s exit:0 -o match:'carp: BACKUP carpdev shmif0' \
+	rump.ifconfig carp1
+	export RUMP_SERVER=$SOCK_CLIENT
+
+	# Check that the shared IP works
+	atf_check -s exit:0 -o ignore \
+	rump.ping6 -n -X $TIMEOUT -c 1 $IP6_CARP
+
+	# KILLING SPREE
+	env RUMP_SERVER=$SOCK_MASTER rump.halt
+	sleep 1
+
+	# Check that primary is now dead
+	atf_check -s not-exit:0 -o ignore \
+	rump.ping6 -n -X $TIMEOUT -c 1 $IP6_MASTER
+
+	# Do it in installments. carp will cluck meanwhile
+	wait_carp6_handover
+
+	# Check state
+	export RUMP_SERVER=$SOCK_BACKUP
+	$DEBUG && rump.ifconfig
+	atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
+	rump.ifconfig carp1
+}
+
+carp6_handover_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
 	atf_add_test_case 

CVS commit: src/tests/net/carp

2017-02-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 27 07:24:26 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Add a test case for CARP on IPv6

The test case fails expectedly because the implementation of CARP on IPv6
is incomplete yet.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:40:19 UTC 2016

Modified Files:
src/tests/net/carp: Makefile

Log Message:
No underscore needed


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:40:19 UTC 2016

Modified Files:
src/tests/net/carp: Makefile

Log Message:
No underscore needed


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/Makefile
diff -u src/tests/net/carp/Makefile:1.4 src/tests/net/carp/Makefile:1.5
--- src/tests/net/carp/Makefile:1.4	Mon Aug  8 14:34:02 2016
+++ src/tests/net/carp/Makefile	Mon Aug  8 14:40:19 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2016/08/08 14:34:02 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.5 2016/08/08 14:40:19 pgoyette Exp $
 #
 
 .include 
@@ -8,6 +8,6 @@ TESTSDIR=	${TESTSBASE}/net/carp
 TESTS_C=	t_basic
 
 LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpdev
-LDADD+=		-lrumpnet -lrump -lrumpuser -lrump_vfs -lpthread
+LDADD+=		-lrumpnet -lrump -lrumpuser -lrumpvfs -lpthread
 
 .include 



CVS commit: src/tests/net/carp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:34:02 UTC 2016

Modified Files:
src/tests/net/carp: Makefile

Log Message:
We also need librump_vfs

While here, remove duplicate entry for librump


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/carp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:22:43 UTC 2016

Modified Files:
src/tests/net/carp: Makefile

Log Message:
And yet another one


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/carp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/Makefile
diff -u src/tests/net/carp/Makefile:1.2 src/tests/net/carp/Makefile:1.3
--- src/tests/net/carp/Makefile:1.2	Tue Jun 10 04:28:40 2014
+++ src/tests/net/carp/Makefile	Mon Aug  8 14:22:43 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2014/06/10 04:28:40 he Exp $
+#	$NetBSD: Makefile,v 1.3 2016/08/08 14:22:43 pgoyette Exp $
 #
 
 .include 
@@ -7,7 +7,7 @@ TESTSDIR=	${TESTSBASE}/net/carp
 
 TESTS_C=	t_basic
 
-LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net
+LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpdev
 LDADD+=		-lrumpnet -lrump -lrumpuser -lrump -lpthread
 
 .include 



CVS commit: src/tests/net/carp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:22:43 UTC 2016

Modified Files:
src/tests/net/carp: Makefile

Log Message:
And yet another one


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/carp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 13:13:31 UTC 2011

Modified Files:
src/tests/net/carp: t_basic.c

Log Message:
fix fallout from including signal.h in rump_syscallargs.h


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.c
diff -u src/tests/net/carp/t_basic.c:1.4 src/tests/net/carp/t_basic.c:1.5
--- src/tests/net/carp/t_basic.c:1.4	Sun Nov  7 12:51:21 2010
+++ src/tests/net/carp/t_basic.c	Sun Jun 26 09:13:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_basic.c,v 1.4 2010/11/07 17:51:21 jmmv Exp $	*/
+/*	$NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_basic.c,v 1.4 2010/11/07 17:51:21 jmmv Exp $);
+__RCSID($NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -49,6 +49,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include signal.h
 
 #include ../config/netconfig.c
 #include ../../h_macros.h



CVS commit: src/tests/net/carp

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 13:13:31 UTC 2011

Modified Files:
src/tests/net/carp: t_basic.c

Log Message:
fix fallout from including signal.h in rump_syscallargs.h


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2010-08-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 11 13:10:03 UTC 2010

Modified Files:
src/tests/net/carp: t_basic.c

Log Message:
Put some sleeps between forking the hosts.  Otherwise a race may
be triggered which appears to cause one host to go berzerk with
sending carp advertisements and ignore ping requests.

I'll get to the bottom of this eventually, but this is a stopgap
to prevent the test from failing, hopefully -- the race doesn't
appear to trigger for me even with 0.1s on a loaded machine, so
0.5s should be better than fine.

(hi jmmv ;)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/carp/t_basic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.c
diff -u src/tests/net/carp/t_basic.c:1.1 src/tests/net/carp/t_basic.c:1.2
--- src/tests/net/carp/t_basic.c:1.1	Tue Aug 10 21:55:28 2010
+++ src/tests/net/carp/t_basic.c	Wed Aug 11 13:10:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_basic.c,v 1.1 2010/08/10 21:55:28 pooka Exp $	*/
+/*	$NetBSD: t_basic.c,v 1.2 2010/08/11 13:10:03 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_basic.c,v 1.1 2010/08/10 21:55:28 pooka Exp $);
+__RCSID($NetBSD: t_basic.c,v 1.2 2010/08/11 13:10:03 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -155,6 +155,8 @@
 		break;
 	}
 
+	usleep(50);
+
 	/* fork backup */
 	switch (cpid = fork()) {
 	case -1:
@@ -168,6 +170,8 @@
 		break;
 	}
 
+	usleep(50);
+
 	rump_init();
 	netcfg_rump_makeshmif(THEBUS, ifname);
 	netcfg_rump_if(ifname, 10.1.1.240, 255.255.255.0);



CVS commit: src/tests/net/carp

2010-08-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 11 13:10:03 UTC 2010

Modified Files:
src/tests/net/carp: t_basic.c

Log Message:
Put some sleeps between forking the hosts.  Otherwise a race may
be triggered which appears to cause one host to go berzerk with
sending carp advertisements and ignore ping requests.

I'll get to the bottom of this eventually, but this is a stopgap
to prevent the test from failing, hopefully -- the race doesn't
appear to trigger for me even with 0.1s on a loaded machine, so
0.5s should be better than fine.

(hi jmmv ;)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/carp/t_basic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.