From nobody Tue Jan 16 08:52:06 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 4TDjS6605Nz579gL; Tue, 16 Jan 2024 08:52:06 +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 4TDjS62Srpz4Q59; Tue, 16 Jan 2024 08:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705395126; 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=O8IL3mPXlwXzgpG/fERfZZkYMllnPchdAXMtbDndkNc=; b=lqfwCkPR1Mbxi3tU7IYJoNGsJf9x64V1QEopw6SNlz6gQWCZ8O0P/JtRn/bEoMmFHUS5u/ 642Gcr9abmUz0Nri+4EPIs5HegZl+lSAT00M4+ubcfanOttSjBkABYXJiQVN1p8QgotYhn 95HBk8LfCJqNC59MBbFYm9LHOXJznl9bYq0IMnbnH24hrTo2xX/QKUS3/yR34jEGPum9Vn psPlkaoczPHE14igD6TassenYt3OFbiXyoJ9RErmv9NpycIcqkjkF8CXHCRV0x4l8OPwIC 1+EL1HjfHS3sY8iTuzva5Evyl/U//yPMPKBmkCPZERg3uoU/Ffa6Mrhfo9uUWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705395126; 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=O8IL3mPXlwXzgpG/fERfZZkYMllnPchdAXMtbDndkNc=; b=JIJ/aPnxHF2jK0BpVNzVH4J1qM2FhnuMI9yJZwYzs78cgWQqAHvfS8yqxs61fanRKUuPeK ZLXBck+pqZZn2p0/q9p66QAafk9wMSqVHUS9Qm5GIuBZzcYiZQA/EOlk861R9QX7snCik9 QibmGVi19B4/Qxxehf9BXpcdfqkCpiRlj3IbDofeGfWHAOKy8FeKW/XDghg9Dlfi+HFykY isx/jfGP4eL35UdbdrbcSsntVNp2rySYhInivMlQfDMc1puD+OWPNtSb+SF2pjfd1o6Yhn 8rpQzSztxk7dKK5nhDe72/V4+EB8esjU2P/V71CqKivNxG2vPuZOsrnuNIQuPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705395126; a=rsa-sha256; cv=none; b=by17h5xPZvnTc4+FRVeF0m4jNHY+oMKxGIQg7wgyiPAsoJBMGLh0WZq/uotqbFKvka2sYX V1LacwqA2EQCz0vEk+zZ+Ewsmgi+cUyEwcboXLSFQ5FVsL6NxFyxM9RR7E8r3Nn3Riq2ll zNhuozxRvOqI+WYB+nkOlvf6HxwOGr3zqdFXbFVkfwH4PLcc4MpN9mgAM7XSOfefyH82LO EIPKx6+sTSQF74By+ggOvzyw83E3yVA4YMgDRCGxRqOlKco9dPAyQqg3FU8rUF4Xe4un3I 8Vnf0oSnvjU2cjKIrx2hnfeb4ra2Eyo6C9NEablGMdowyAUK0N7hD4aICkN5qw== 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 4TDjS61ZcqzYvp; Tue, 16 Jan 2024 08:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40G8q6PK077491; Tue, 16 Jan 2024 08:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40G8q6rp077488; Tue, 16 Jan 2024 08:52:06 GMT (envelope-from git) Date: Tue, 16 Jan 2024 08:52:06 GMT Message-Id: <202401160852.40G8q6rp077488@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: d086b9f77c3f - main - pf tests: test per-rule pflow 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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: d086b9f77c3f72fc5e38a2a180ef53cd82b57f2f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d086b9f77c3f72fc5e38a2a180ef53cd82b57f2f commit d086b9f77c3f72fc5e38a2a180ef53cd82b57f2f Author: Kristof Provost AuthorDate: 2024-01-11 13:54:09 +0000 Commit: Kristof Provost CommitDate: 2024-01-16 08:45:55 +0000 pf tests: test per-rule pflow Test that we can enable pflow on a per-rule basis. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/pflow.sh | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/pflow.sh b/tests/sys/netpfil/pf/pflow.sh index 88478cfbfe84..3cef5f5a2d98 100644 --- a/tests/sys/netpfil/pf/pflow.sh +++ b/tests/sys/netpfil/pf/pflow.sh @@ -234,10 +234,59 @@ nat_cleanup() pft_cleanup } +atf_test_case "rule" "cleanup" +rule_head() +{ + atf_set descr 'Test per-rule pflow option' + atf_set require.user root + atf_set require.progs scapy +} + +rule_body() +{ + pflow_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + ifconfig ${epair}a alias 192.0.2.3/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "pass in from 192.0.2.2 keep state (pflow)" \ + "pass in from 192.0.2.3 keep state" + + pflow=$(jexec alcatraz pflowctl -c) + jexec alcatraz pflowctl -s ${pflow} dst 192.0.2.2:2055 + + # No flow is generated if we ping from 192.0.2.3 + ping -c 1 -S 192.0.2.3 192.0.2.1 + + atf_check -o match:"No data" \ + $(atf_get_srcdir)/pft_read_ipfix.py --recvif ${epair}a --port 2055 + + # But there is one if we ping from 192.0.2.2 + ping -c 1 -S 192.0.2.2 192.0.2.1 + + atf_check -o match:".*v=5.*" \ + $(atf_get_srcdir)/pft_read_ipfix.py --recvif ${epair}a --port 2055 +} + +rule_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "state_defaults" atf_add_test_case "v6" atf_add_test_case "nat" + atf_add_test_case "rule" }