From 9d48283d60284eb62fd32d2d8113cbf0beca28b3 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Thu, 16 Mar 2023 11:16:24 +0100 Subject: [PATCH] carp tests: test manually switch between backup and master There's been at least one issue where we failed to correctly enter NET_EPOCH that was triggered in this scenario. Add a test case for it to make it easier to detect issues like this in the future. Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39115 --- tests/sys/netinet/carp.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index d31a17ed6beb..9afe9d2ea8c1 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -263,10 +263,35 @@ nd6_ns_source_mac_cleanup() } +atf_test_case "switch" "cleanup" +switch_head() +{ + atf_set descr 'Switch between master and backup' + atf_set require.user root +} + +switch_body() +{ + carp_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + ifconfig ${epair}a vhid 1 advskew 100 192.0.2.1/24 + ifconfig ${epair}a vhid 1 state backup + ifconfig ${epair}a vhid 1 state master +} + +switch_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic_v4" atf_add_test_case "basic_v6" atf_add_test_case "negative_demotion" atf_add_test_case "nd6_ns_source_mac" + atf_add_test_case "switch" }