From nobody Thu Jan 27 09:20:28 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AAB3519858E7; Thu, 27 Jan 2022 09:20:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jkw6j1y9kz3DjX; Thu, 27 Jan 2022 09:20:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643275229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+adIt6GzPH4LbIOWeK+zh9TxfcGTHtBEXr6HmXvRSrI=; b=J6jQJ+VFYCpAgcZbJbB0tobC2b4Ie7L4tGvv32APCNIiOdRmOlqrG65K7z6OJuIj877yNo js3F4ochp2Gmqf+bRgJVHww4ix3rwgebPysJ8e7m+tUUltFsWi46c6Yyoc2L5rab7hFjGT iDjIbklZ+biH8d0AnUiycM/wg18AT+TrAronxBiuGTj9pERxN6OcxeIYhWavw6JILHrLJb +7fiaWLRCfl0Nhdv2N3jY6K9TTgQJ4im+UfUIqnIlB6GwHTIAcwtsVU6dRqLrfXXDLa1hn lI4eEtzLwOJ58P0TaDhfQVvNiBNAVyIBnRKkVeYWZFQjhGv4CAejvJ0KbD3+bg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 984F8140B3; Thu, 27 Jan 2022 09:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20R9KSgQ032903; Thu, 27 Jan 2022 09:20:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20R9KSZE032902; Thu, 27 Jan 2022 09:20:28 GMT (envelope-from git) Date: Thu, 27 Jan 2022 09:20:28 GMT Message-Id: <202201270920.20R9KSZE032902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 74e6b014b488 - main - netpfil tests: test removing interfaces with pending dummynet packets List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74e6b014b48844a00d88a5197c68dee12d4d20b1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643275229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+adIt6GzPH4LbIOWeK+zh9TxfcGTHtBEXr6HmXvRSrI=; b=Ik3JneuhpSMRMUlTv3yXG03L6pPxE4W5BaB913IhwV2lMS9d18Z+UCqPJbw1us/deYSDLx /oopC+d4sbAGEK3Now3TndA8JR7BK+oSHqzy6Dq5jhW7CU1kvqTfwpG7051y7wcBjlsrig j0y3XzV8dkRvt6JcbfktVORrubXNvFHl8UgVSbG+uERhKbZeHBedf1zMnloqbnPCu9mgem lRZEJ0GehH9WE0xh2k9Ws2P23bgTrz5lGt7rFiDkCeiv1W7wemm7WEmcwuimbRY+r6JuXa 3aSO24sqbz4nYKfS0TAYutteEQ2XOL9eKivpoPexqUUmGi6KWvzGPwTpZxFQzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643275229; a=rsa-sha256; cv=none; b=gy8IJ5eok7G5yBJechtywfr7eyjYAqDiGqMjLyHJ0f0Opr6qg87goDNn3VwTBFcQrTb4A9 W+SwYzGZpdvaVvbed6PRDggaBTLkcNjlCuCdfBPc09mc0Lt8Q98/HaIxx8eBjF+Nf1/Opy Ds1SZXGcBvT0NAAA+QEloCKogceS8yiRAHOGqOBmpWfo4Hq9ohahpeZ1Tmi8EviAO5iLkk HliHOx8aH1KH9VagEcE7/gwvq4XkCtdg+rV7OTO23EOHjM7Rsv5//pfTFr74wK3sNDmrvG fC7sg0RZ394yrR7ZhJHDEYS0Axsgm+3vU81EXQypYuQNlInQiK9dbsy0IuIylw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=74e6b014b48844a00d88a5197c68dee12d4d20b1 commit 74e6b014b48844a00d88a5197c68dee12d4d20b1 Author: Kristof Provost AuthorDate: 2021-11-19 22:05:48 +0000 Commit: Kristof Provost 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 \