git: 92c5dbbb131b - main - carp tests: unicast tests (IPv4)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Mar 2023 14:14:25 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae commit 92c5dbbb131bdc8d9e53555a32e9bcb2a4aa59ae Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-03-02 17:21:06 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-03-20 13:37:09 +0000 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 --- tests/sys/netinet/carp.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) 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"