git: c90b9a5ebb40 - main - netpfil tests: add dummynet fq_codel test case

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 12:19:26 UTC
The branch main has been updated by kp:

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

commit c90b9a5ebb407e21404fd66b4e6ccb427c937f6b
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-11-11 10:55:59 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-11-11 10:55:59 +0000

    netpfil tests: add dummynet fq_codel test case
    
    fq_codel was broken due to a missing m_rcvif_serialize() in the enqueue
    path.
    Add a simple test case to ensure it at least passes traffic.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/common/dummynet.sh | 43 ++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh
index 609bf3daf6ad..8c3c9892edc8 100644
--- a/tests/sys/netpfil/common/dummynet.sh
+++ b/tests/sys/netpfil/common/dummynet.sh
@@ -163,6 +163,46 @@ pipe_v6_cleanup()
 	firewall_cleanup $1
 }
 
+codel_head()
+{
+	atf_set descr 'FQ_CODEL basic test'
+	atf_set require.user root
+}
+
+codel_body()
+{
+	fw=$1
+	firewall_init $fw
+	dummynet_init $fw
+
+	epair=$(vnet_mkepair)
+	vnet_mkjail alcatraz ${epair}b
+
+	ifconfig ${epair}a 192.0.2.1/24 up
+	jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up
+
+	# Sanity check
+	atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2
+
+	jexec alcatraz dnctl pipe 1 config  bw 10Mb queue 100 droptail
+	jexec alcatraz dnctl sched 1 config pipe 1 type fq_codel target 0ms interval 0ms quantum 1514 limit 10240 flows 1024 ecn
+	jexec alcatraz dnctl queue 1 config pipe 1 droptail
+
+	firewall_config alcatraz ${fw} \
+		"ipfw"	\
+			"ipfw add 1000 queue 1 ip from any to any" \
+		"pf"	\
+			"pass dnqueue 1"
+
+	# single ping succeeds just fine
+	atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+}
+
+codel_cleanup()
+{
+	firewall_cleanup $1
+}
+
 queue_head()
 {
 	atf_set descr 'Basic queue test'
@@ -435,6 +475,9 @@ setup_tests		\
 	pipe_v6		\
 		ipfw	\
 		pf	\
+	codel		\
+		ipfw	\
+		pf	\
 	queue		\
 		ipfw	\
 		pf	\