git: 2a2918a4a2ef - stable/15 - pf tests: test pfTablesTblCount in snmp_pf

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 27 Nov 2026 12:23:23 UTC
The branch stable/15 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2a2918a4a2ef72cf33a008b403d200070c233a80

commit 2a2918a4a2ef72cf33a008b403d200070c233a80
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-11-18 16:48:48 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-27 12:22:39 +0000

    pf tests: test pfTablesTblCount in snmp_pf
    
    This works fine on main, but not on stable/15 so add a test.
    
    PR:     300818
    MFC after:      3 days
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 5131335c7d48eaec427aa9ed27862ca56e3e95bc)
---
 tests/sys/netpfil/pf/snmp.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/sys/netpfil/pf/snmp.sh b/tests/sys/netpfil/pf/snmp.sh
index 37cc4b75cf92..c30bdb21e783 100644
--- a/tests/sys/netpfil/pf/snmp.sh
+++ b/tests/sys/netpfil/pf/snmp.sh
@@ -100,6 +100,19 @@ table_body()
 	atf_check -s exit:0 -o match:'pfTablesTblNumber.0 = 1' \
 	    bsnmpwalk -s public@192.0.2.1 -i pf_tree.def begemot
 
+	# With one address in it
+	atf_check -s exit:0 -o match:'pfTablesTblCount.* = 1' \
+	    bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables
+
+	jexec alcatraz pfctl -T add -t foo 198.51.100.0/24
+
+	# Give bsnmp time to refresh the table
+	sleep 6
+
+	# And now there are two
+	atf_check -s exit:0 -o match:'pfTablesTblCount.* = 2' \
+	    bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables
+
 	# We have the 'foo' table
 	atf_check -s exit:0 -o match:'pfTablesTblDescr.* = foo' \
 	    bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables