From nobody Wed Sep 25 15:26:37 2024 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 4XDLDY1zvgz5XM4L; Wed, 25 Sep 2024 15:26:37 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XDLDY1Y5Fz4QWg; Wed, 25 Sep 2024 15:26:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727277997; 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=QZOVeIXDuudh5gaugYljbsR1ypnKdOboz4mE49qJQto=; b=dxsseyHixk7VYA9temPr8RZjeenNvMWX08KwmDBvqPN4YI9IaT8dH5pQjNFmHCerTnH7zN 7xAM5I0klYDWcCqo82/CuRxlBYEY98tftYAGDPqdC0nf1kdMI6hgBGnwJTrc1l0eXzoRsh Chu/x+yU7NJwlqQoZNfLqXteFj5JfAm4qnLsjrEQFdrNK8qFUMunvcVUBQN0esYimh0d// hf7ODgfajNDO5uUVpa4b+PCg53K+Q0clpmYAiBV3db4acrGZWGhWgQmJOvKV/OxgOGwwpJ Nc2EQyUzkFWoXG0DDv/YZVBmY4s8XE2o+z3myPHfcM75e5lQ7eYYWsqGD7tp1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727277997; 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=QZOVeIXDuudh5gaugYljbsR1ypnKdOboz4mE49qJQto=; b=rHEetQppATeSOugry6kv96fyr84pbGT7jcjonmpKKkxPj3p5GTxvMi59b4r84e36d3ccYS tuyAtSVVmcFGOSWAn/SNCEX++6922HzUO+kv78oEV9L9H7c4WFmpMpGD5JkKJWAEsJ4kg+ W6KunnnE4doe+skM/+d00sMZAth3EyiUpAX28TsI9cs0C0AOCZd7M3cmJmitEzDmWhJyJ1 G6c+WmGUxTzUBzZPH4SYJ4BLleuQrYjQcZOg6D5WoBIwgdB2jsHzj7odSpFdp/VFtORTju n3ONTMZjmMCww9H4sAoMowEbJRayk/09CK7U4aXfdW4IOdCDnLiw3rOT/Xdh5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727277997; a=rsa-sha256; cv=none; b=PDbPtFAzQLgwAFcjEU5ONfLsKuhEifJ0glb0myBBwxstRxZbqaUW+mSK8/MUAR8IkHdJIT GLgDOBG71IsVt+H16HjldwNqxpwP1ANvIIJd78zLqjxRbMST8G3Mvp7yLyZWTcp3wvDOfn 2UQ/UuTBPPVcyW+Tr9G8P5nuaCeDGgrLrnzKZx0cH6tAEvO20znkH40CtQSgqgu3HIWbeg R+i/PEcXgXrXMujB84YWVLm7k2i9jcm+4Nts0+WK063ffAamIMkDmOZ6VN6LNlykGRzZBU vncM35VJHuqIUIcZHAYw3fGNN90oJ+cVv9Y88ew5jrhLKylQO7TQo0gWJZxr5A== 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 4XDLDY192VzJKf; Wed, 25 Sep 2024 15:26:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48PFQb5N061466; Wed, 25 Sep 2024 15:26:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48PFQbZD061463; Wed, 25 Sep 2024 15:26:37 GMT (envelope-from git) Date: Wed, 25 Sep 2024 15:26:37 GMT Message-Id: <202409251526.48PFQbZD061463@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: 67bd1d072190 - main - pf tests: Add max states test 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67bd1d0721908c8ae386723873e422a3f4156932 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=67bd1d0721908c8ae386723873e422a3f4156932 commit 67bd1d0721908c8ae386723873e422a3f4156932 Author: Kajetan Staszkiewicz AuthorDate: 2024-09-25 12:39:38 +0000 Commit: Kristof Provost CommitDate: 2024-09-25 15:26:17 +0000 pf tests: Add max states test Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D46774 --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/max_states.sh | 61 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 8444c92fb8d5..38548336377a 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -24,6 +24,7 @@ ATF_TESTS_SH+= altq \ macro \ map_e \ match \ + max_states \ mbuf \ modulate \ names \ diff --git a/tests/sys/netpfil/pf/max_states.sh b/tests/sys/netpfil/pf/max_states.sh new file mode 100755 index 000000000000..677d6f473d97 --- /dev/null +++ b/tests/sys/netpfil/pf/max_states.sh @@ -0,0 +1,61 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2024 Kajetan Staszkiewicz +# +# 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)/utils.subr + + +max_states_head() +{ + atf_set descr 'Max states per rule' + atf_set require.user root +} + +max_states_body() +{ + setup_router_dummy_ipv6 + + pft_set_rules router \ + "block" \ + "pass quick inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" \ + "pass in on ${epair_tester}b keep state (max 3)" \ + "pass out on ${epair_server}a keep state" + + # The exact limit is off by 1 + ping_dummy_check_request exit:0 --ping-type=tcpsyn --send-sport=4201 + ping_dummy_check_request exit:0 --ping-type=tcpsyn --send-sport=4202 + ping_dummy_check_request exit:1 --ping-type=tcpsyn --send-sport=4203 +} + +max_states_cleanup() +{ + pft_cleanup +} + + +atf_init_test_cases() +{ + atf_add_test_case "max_states" +}