Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2022 14:22:35 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 79a0d63986a1 - stable/13 - pf tests: Test adding counters to an existing table
Message-ID:  <202202191422.21JEMZit071861@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=79a0d63986a1efdbff8e568719ea15527cf12610

commit 79a0d63986a1efdbff8e568719ea15527cf12610
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-02-01 17:27:40 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-02-19 08:43:33 +0000

    pf tests: Test adding counters to an existing table
    
    MFC after:      2 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D34132
    
    (cherry picked from commit 109418996514111d887b6790c617cbc7cc3f41a5)
---
 tests/sys/netpfil/pf/table.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 692d622bd86a..320522eaacbd 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -242,6 +242,42 @@ pr259689_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "precreate" "cleanup"
+precreate_head()
+{
+	atf_set descr 'Test creating a table without counters, then loading rules that add counters'
+	atf_set require.user root
+}
+
+precreate_body()
+{
+	pft_init
+
+set -x
+	vnet_mkjail alcatraz
+
+	jexec alcatraz pfctl -t foo -T add 192.0.2.1
+	jexec alcatraz pfctl -t foo -T show
+
+	pft_set_rules noflush alcatraz \
+		"table <foo> counters persist" \
+		"pass in from <foo>"
+
+	# Expect all counters to be zero
+	atf_check -s exit:0 -e ignore \
+	    -o match:'In/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \
+	    -o match:'In/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \
+	    -o match:'Out/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \
+	    -o match:'Out/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \
+	    jexec alcatraz pfctl -t foo -T show -vv
+
+}
+
+precreate_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "v4_counters"
@@ -250,4 +286,5 @@ atf_init_test_cases()
 	atf_add_test_case "network"
 	atf_add_test_case "automatic"
 	atf_add_test_case "pr259689"
+	atf_add_test_case "precreate"
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202191422.21JEMZit071861>