From nobody Sat Jan 17 00:44:09 2026 X-Original-To: dev-commits-src-all@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 4dtHzG4CRhz6P7BZ for ; Sat, 17 Jan 2026 00:44:10 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dtHzF6ccdz4B7v for ; Sat, 17 Jan 2026 00:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768610649; 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=idzvkalbONUpuTSCYk5FtSIazuHaYQUdbAF+7glbqS0=; b=SPHI3mpQk2swLL3IGJGlFqeMLLu/cIMZBIIW2hnSkuRc3DmlBeYqSfs8ApM9WTxJCq+cBg ikHIPMh94XStQYhPBdfWUGT6QRz7DLA9rF2EFBYclxZxfHV0EBTetjENeZg2T+FsdAcXKC yejYa89iiZaO+GtQ3VYybCNb+FGWkYHuON0AL/aUo8R9O+6jxnB/+24T0GfY0b6BNVpigU HWsFKRi9ihwyH8sGYLNufkAvhSDH8DrzAhQU+grb98NkN5jYBp6f9B7PLCW306Q2LQEPZ5 stU4+ky0XAi0jxElPTz/3aC9yt8UbQXK7c/yv81a/PEfTRp0sUHeV6Vk6hvRKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768610650; 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=idzvkalbONUpuTSCYk5FtSIazuHaYQUdbAF+7glbqS0=; b=e6hGuxB/Dt/4++sQ4s6fFaeQ4dIbIy5xMwL1thT5VUW6rxCR8ZPWPLgxEfWpbFUD8HSxb7 75mADj8qb4PHRtw2Ggsf8kcxVZHrmX5NgoYMJNfgaXLtq9QX0SDpac1L4PsyBrj978TttV 2BzlURjAp6YWkiN80umakmLr5OKxaYzLymUQOvTAdZjr6SlpMTK9kCl28rtdnnxUix+mLV toz2o5Viq6JgHrUvp8xfhmFf0ePy+sTVtfrutEESy0SseNY1idk8fFiy4iBnd96Fo7tO1C /KkrPn07HNIx1k35qg4pdTyZeppwYFN0kP/SExS0nrrFijodS7TUKhxftImwNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768610650; a=rsa-sha256; cv=none; b=DBHu7Q3Zub+b51gDA1UapBTFbewX6puNdMHTBitWctw1HL1YksCNYJ8AuRsshQJz+Wkuqq NHBrzX9+pN8Fs/Twf2tTIeJHkeKnfJwTWjtWwvT+gyNfQVwif5MSqJRzZBV9t64qwfLIQv JPrLGhsvaZrjjOP8O7jW1zeKH2J6JsciOIGUP6gYFSY5LlE9/6Q+Kb0fHCpMmb9mxiCqw6 Mpyl9mBSCfZtunWhksPzkivyW70MUWhaQ7SsvLMZdShFG9OZl1nzbCeOGa4IG4hBD/Z48W MoQLpYDPw7QlAwP5uKny/gjKD4sXkIYHnFmdI91+p4ARS/FlxudRSmIL6C/pTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dtHzF60W0zdDG for ; Sat, 17 Jan 2026 00:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 438ea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 17 Jan 2026 00:44:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 7eac31c83ee3 - main - tests/ipfw: add a simple fuzzing test for ipfw tables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7eac31c83ee3fca6a2c19ee0aa21a310e0050f51 Auto-Submitted: auto-generated Date: Sat, 17 Jan 2026 00:44:09 +0000 Message-Id: <696adb59.438ea.792092cf@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7eac31c83ee3fca6a2c19ee0aa21a310e0050f51 commit 7eac31c83ee3fca6a2c19ee0aa21a310e0050f51 Author: Gleb Smirnoff AuthorDate: 2026-01-17 00:38:41 +0000 Commit: Gleb Smirnoff CommitDate: 2026-01-17 00:38:41 +0000 tests/ipfw: add a simple fuzzing test for ipfw tables Reviewed by: pouria, ae Differential Revision: https://reviews.freebsd.org/D54579 --- tests/sys/netpfil/ipfw/Makefile | 3 +- tests/sys/netpfil/ipfw/table.sh | 96 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/ipfw/Makefile b/tests/sys/netpfil/ipfw/Makefile index d4dbdb00f251..92a8c9fdb2cd 100644 --- a/tests/sys/netpfil/ipfw/Makefile +++ b/tests/sys/netpfil/ipfw/Makefile @@ -3,7 +3,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netpfil/ipfw ATF_TESTS_SH+= fwd \ - divert + divert \ + table ${PACKAGE}FILES+= fwd_inetd.conf diff --git a/tests/sys/netpfil/ipfw/table.sh b/tests/sys/netpfil/ipfw/table.sh new file mode 100755 index 000000000000..5ce1c22f8e7d --- /dev/null +++ b/tests/sys/netpfil/ipfw/table.sh @@ -0,0 +1,96 @@ +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2026 Gleb Smirnoff +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/../common/utils.subr + +atf_test_case "fuzz" "cleanup" +fuzz_head() +{ + atf_set descr 'Create couple tables and fuzzes them' + atf_set require.user root +} + +fuzz_body() +{ + firewall_init "ipfw" + + epair=$(vnet_mkepair) + vnet_mkjail sender ${epair}a + jexec sender ifconfig ${epair}a 192.0.2.0/31 up + jexec sender route add 10.0.0.0/8 192.0.2.1 + + vnet_mkjail receiver ${epair}b + jexec receiver ifconfig lo0 127.0.0.1/8 up + jexec receiver ifconfig ${epair}b 192.0.2.1/31 up + jexec receiver route add 10.0.0.0/8 -blackhole -iface lo0 + + jexec receiver ipfw add 100 count ip from any to table\(tb0\) + jexec receiver ipfw add 200 count ip from any to table\(tb1\) + + ( jexec sender sh -c \ + 'while true; do \ + oct=$(od -An -N1 -tu1 < /dev/urandom); \ + oct=$(echo $oct); \ + ping -c 5 -i .01 -W .01 10.0.0.${oct} >/dev/null; \ + done' ) & + pinger=$! + + ( jexec receiver sh -c \ + 'while true; do \ + set -- $(od -An -N2 -tu1 < /dev/urandom); \ + ipfw -q table tb$(($1 % 2)) add 10.0.0.$2; \ + done' ) & + adder=$! + + ( jexec receiver sh -c \ + 'while true; do \ + set -- $(od -An -N2 -tu1 < /dev/urandom); \ + ipfw -q table tb$(($1 % 2)) del 10.0.0.$2; \ + done' ) & + deleter=$! + + ( jexec receiver sh -c \ + 'while true; do \ + ipfw table tb0 swap tb1; \ + sleep .25; \ + done' ) & + swapper=$! + + sleep 30 + kill $pinger + kill $adder + kill $deleter + kill $swapper +} + +fuzz_cleanup() +{ + firewall_cleanup $1 +} + +atf_init_test_cases() +{ + atf_add_test_case "fuzz" +}