aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/netinet/carp.sh
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2023-03-02 17:21:06 +0000
committerKristof Provost <kp@FreeBSD.org>2023-03-20 13:37:09 +0000
commit92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae (patch)
tree8968c527796fa7c87445c3c462c523f14d0907a6 /tests/sys/netinet/carp.sh
parent137818006de5bb0be0b6562a0d601977f85c6867 (diff)
downloadsrc-92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae.tar.gz
src-92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae.zip
carp tests: unicast tests (IPv4)
Test the new unicast carp mode for IPv4. There's a routing hop between the peers, to ensure that the TTL check is correctly disabled for unicast carp. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38941
Diffstat (limited to 'tests/sys/netinet/carp.sh')
-rwxr-xr-xtests/sys/netinet/carp.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh
index 9afe9d2ea8c1..22f1aa3ac0e3 100755
--- a/tests/sys/netinet/carp.sh
+++ b/tests/sys/netinet/carp.sh
@@ -106,6 +106,64 @@ basic_v4_cleanup()
vnet_cleanup
}
+
+atf_test_case "unicast_v4" "cleanup"
+unicast_v4_head()
+{
+ atf_set descr 'Unicast CARP test (IPv4)'
+ atf_set require.user root
+}
+
+unicast_v4_body()
+{
+ carp_init
+
+ bridge=$(vnet_mkbridge)
+ epair_one=$(vnet_mkepair)
+ epair_two=$(vnet_mkepair)
+
+ vnet_mkjail carp_uni_v4_one ${bridge} ${epair_one}a ${epair_two}a
+ vnet_mkjail carp_uni_v4_two ${epair_one}b
+ vnet_mkjail carp_uni_v4_three ${epair_two}b
+
+ jexec carp_uni_v4_one ifconfig ${bridge} 192.0.2.4/29 up
+ jexec carp_uni_v4_one sysctl net.inet.ip.forwarding=1
+ jexec carp_uni_v4_one ifconfig ${bridge} addm ${epair_one}a \
+ addm ${epair_two}a
+ jexec carp_uni_v4_one ifconfig ${epair_one}a up
+ jexec carp_uni_v4_one ifconfig ${epair_two}a up
+ jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.1/25
+ jexec carp_uni_v4_one ifconfig ${bridge} inet alias 198.51.100.129/25
+
+ jexec carp_uni_v4_two ifconfig ${epair_one}b 198.51.100.2/25 up
+ jexec carp_uni_v4_two route add default 198.51.100.1
+ jexec carp_uni_v4_two ifconfig ${epair_one}b add vhid 1 \
+ peer 198.51.100.130 192.0.2.1/29
+
+ jexec carp_uni_v4_three ifconfig ${epair_two}b 198.51.100.130/25 up
+ jexec carp_uni_v4_three route add default 198.51.100.129
+ jexec carp_uni_v4_three ifconfig ${epair_two}b add vhid 1 \
+ peer 198.51.100.2 192.0.2.1/29
+
+ # Sanity check
+ atf_check -s exit:0 -o ignore jexec carp_uni_v4_two \
+ ping -c 1 198.51.100.130
+
+ wait_for_carp carp_uni_v4_two ${epair_one}b \
+ carp_uni_v4_three ${epair_two}b
+
+ atf_check -s exit:0 -o ignore jexec carp_uni_v4_one \
+ ping -c 3 192.0.2.1
+
+ jexec carp_uni_v4_two ifconfig
+ jexec carp_uni_v4_three ifconfig
+}
+
+unicast_v4_cleanup()
+{
+ vnet_cleanup
+}
+
atf_test_case "basic_v6" "cleanup"
basic_v6_head()
{
@@ -290,6 +348,7 @@ switch_cleanup()
atf_init_test_cases()
{
atf_add_test_case "basic_v4"
+ atf_add_test_case "unicast_v4"
atf_add_test_case "basic_v6"
atf_add_test_case "negative_demotion"
atf_add_test_case "nd6_ns_source_mac"