git: aad8fb3e2be2 - main - tests: Add a test case for arp host lookups.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Oct 2023 16:40:22 UTC
The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=aad8fb3e2be27ed3a04531aa01913ab4b7616244 commit aad8fb3e2be27ed3a04531aa01913ab4b7616244 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-10-06 16:39:59 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-10-06 16:39:59 +0000 tests: Add a test case for arp host lookups. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D42108 --- tests/sys/netinet/arp.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh index 045ccd1dc7a7..9181d38b10b0 100755 --- a/tests/sys/netinet/arp.sh +++ b/tests/sys/netinet/arp.sh @@ -120,12 +120,61 @@ pending_delete_if_cleanup() { } +atf_test_case "arp_lookup_host" "cleanup" +arp_lookup_host_head() { + atf_set descr 'Test looking up a specific host' + atf_set require.user root +} + +arp_lookup_host_body() { + + vnet_init + + jname="v4t-arp_lookup_host" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname}a ${epair0}a + vnet_mkjail ${jname}b ${epair0}b + + ipa=198.51.100.1 + ipb=198.51.100.2 + + atf_check -o ignore \ + ifconfig -j ${jname}a ${epair0}a inet ${ipa}/24 + atf_check -o ignore \ + ifconfig -j ${jname}b ${epair0}b inet ${ipb}/24 + + # get jail b's MAC address + eth="$(ifconfig -j ${jname}b ${epair0}b | + sed -nE "s/^\tether ([0-9a-f:]*)$/\1/p")" + + # no entry yet + atf_check -s exit:1 -o match:"\(${ipb}\) -- no entry" \ + jexec ${jname}a arp -n ${ipb} + + # now ping jail b from jail a + atf_check -o ignore \ + jexec ${jname}a ping -c1 ${ipb} + + # should be populated + atf_check -o match:"\(${ipb}\) at $eth on ${epair0}a" \ + jexec ${jname}a arp -n ${ipb} + +} + +arp_lookup_host_cleanup() { + vnet_cleanup +} + + atf_init_test_cases() { atf_add_test_case "arp_add_success" atf_add_test_case "arp_del_success" atf_add_test_case "pending_delete_if" + atf_add_test_case "arp_lookup_host" } # end