git: 74e6b014b488 - main - netpfil tests: test removing interfaces with pending dummynet packets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Jan 2022 09:20:28 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=74e6b014b48844a00d88a5197c68dee12d4d20b1 commit 74e6b014b48844a00d88a5197c68dee12d4d20b1 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-11-19 22:05:48 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-01-27 08:36:09 +0000 netpfil tests: test removing interfaces with pending dummynet packets Dummynet queues packets with an associated struct ifnet pointer. Ensure that things do not explode if that interface goes away with packets still in the queue. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33065 --- tests/sys/netpfil/common/dummynet.sh | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 448bb79a46f9..99d4f22ca366 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -28,6 +28,53 @@ . $(atf_get_srcdir)/utils.subr . $(atf_get_srcdir)/runner.subr +interface_removal_head() +{ + atf_set descr 'Test removing interfaces with dummynet delayed traffic' + atf_set require.user root +} + +interface_removal_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 delay 1500 + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 pipe 1 ip from any to any" \ + "pf" \ + "pass dnpipe 1" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Send traffic that'll still be pending when we remove the interface + ping -c 5 -s 1200 192.0.2.2 & + sleep 1 # Give ping the chance to start. + + # Remove the interface, but keep the jail around for a bit + ifconfig ${epair}a destroy + + sleep 3 +} + +interface_removal_cleanup() +{ + firewall_cleanup $1 +} + pipe_head() { atf_set descr 'Basic pipe test' @@ -374,6 +421,9 @@ nat_cleanup() } setup_tests \ + interface_removal \ + ipfw \ + pf \ pipe \ ipfw \ pf \