git: b4bd97ec168e - main - netinet tests: basic garp test

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 20 Jan 2025 15:10:53 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b4bd97ec168e97360cf9511b975a20f677864661

commit b4bd97ec168e97360cf9511b975a20f677864661
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-20 13:27:05 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-20 13:28:39 +0000

    netinet tests: basic garp test
    
    Excercise the garp code.
    This doesn't actively verify anything, but is sufficient to trigger the
    panic reported in PR 284073, so it's a useful test case to keep.
    
    PR:             284073
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netinet/arp.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh
index 34946d42f250..c7744d5de938 100755
--- a/tests/sys/netinet/arp.sh
+++ b/tests/sys/netinet/arp.sh
@@ -229,6 +229,32 @@ static_cleanup() {
 	vnet_cleanup
 }
 
+atf_test_case "garp" "cleanup"
+garp_head() {
+	atf_set descr 'Basic gratuitous arp test'
+	atf_set require.user root
+}
+
+garp_body() {
+	vnet_init
+
+	j="v4t-garp"
+
+	epair=$(vnet_mkepair)
+
+	vnet_mkjail ${j} ${epair}a
+	atf_check -s exit:0 -o ignore \
+	    jexec ${j} sysctl net.link.ether.inet.garp_rexmit_count=3
+	jexec ${j} ifconfig ${epair}a inet 192.0.2.1/24 up
+
+	# Allow some time for the timer to actually fire
+	sleep 5
+}
+
+garp_cleanup() {
+	vnet_cleanup
+}
+
 
 atf_init_test_cases()
 {
@@ -238,6 +264,7 @@ atf_init_test_cases()
 	atf_add_test_case "pending_delete_if"
 	atf_add_test_case "arp_lookup_host"
 	atf_add_test_case "static"
+	atf_add_test_case "garp"
 }
 
 # end