aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2026-04-07 14:07:45 +0000
committerKristof Provost <kp@FreeBSD.org>2026-04-07 14:58:32 +0000
commit6642ba36f1860599a4c5562dc24f5dff080bbb42 (patch)
treedb82457c64f5579c4659e501ac2f6cf65321b6f9
parentcff675e83cdb6c9027e94df9d010439e42e27dee (diff)
pf tests: explicitly test zeroing counters within an anchor
While here fix the match pattern in the existing test. Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r--tests/sys/netpfil/pf/anchor.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index f321c742788e..df4a1660d797 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -352,8 +352,20 @@ counter_body()
# Generate traffic
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
atf_check -s exit:0 -e ignore \
- -o match:'[ Evaluations: 1 Packets: 2 Bytes: 168 States: 1 ]' \
+ -o match:'\[ Evaluations: 1 Packets: 2 Bytes: 168 States: 1 \]' \
jexec alcatraz pfctl -sr -vv
+
+ # Zero counters outside of the anchor
+ jexec alcatraz pfctl -sr -vv -z
+ atf_check -s exit:0 -e ignore \
+ -o match:'\[ Evaluations: 1 Packets: 2 Bytes: 168 States: 1 \]' \
+ jexec alcatraz pfctl -sr -vv -a "foo"
+
+ # Zero the anchor's counters
+ jexec alcatraz pfctl -sr -vv -z -a "foo"
+ atf_check -s exit:0 -e ignore \
+ -o match:'\[ Evaluations: 0 Packets: 0 Bytes: 0 States: 1 \]' \
+ jexec alcatraz pfctl -sr -vv -a "foo"
}
counter_cleanup()