git: 0c1a482b4e4f - stable/15 - libpfctl: fix tstats address count

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 19 Nov 2026 10:31:22 UTC
The branch stable/15 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0c1a482b4e4f8ad0e5efe5da75614ca240706057

commit 0c1a482b4e4f8ad0e5efe5da75614ca240706057
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-12-17 13:59:34 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-19 10:29:39 +0000

    libpfctl: fix tstats address count
    
    Reported by:    Marcos Mendoza <mmendoza@netgate.com>
    See also:       https://redmine.pfsense.org/issues/16588
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit ad7f49f98b1ae7504f69db897901a055613c8300)
---
 lib/libpfctl/libpfctl.c       | 3 ++-
 tests/sys/netpfil/pf/table.sh | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 35d2a31906bf..ea44becb4a36 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -3484,7 +3484,8 @@ static struct  snl_attr_parser ap_tstats[] = {
 	{ .type = PF_TS_MATCH, .off = _OUT(pfrts_match), .cb = snl_attr_get_uint64 },
 	{. type = PF_TS_NOMATCH, .off = _OUT(pfrts_nomatch), .cb = snl_attr_get_uint64 },
 	{ .type = PF_TS_TZERO, .off = _OUT(pfrts_tzero), .cb = snl_attr_get_uint64 },
-	{ .type = PF_TS_REFCNT, .off = _OUT(pfrts_cnt), . arg = (void *)PFR_REFCNT_MAX, .cb = snl_attr_get_uint64_into_int_array },
+	{ .type = PF_TS_CNT, .off = _OUT(pfrts_cnt), .cb = snl_attr_get_uint64 },
+	{ .type = PF_TS_REFCNT, .off = _OUT(pfrts_refcnt), . arg = (void *)PFR_REFCNT_MAX, .cb = snl_attr_get_uint64_into_int_array },
 };
 #undef _OUT
 SNL_DECLARE_PARSER(tstats_parser, struct genlmsghdr, snl_f_p_empty, ap_tstats);
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 213d63af8927..90c8849960a0 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -194,6 +194,10 @@ zero_one_body()
 
 	jexec alcatraz pfctl -t foo -T show -vv
 
+	atf_check -s exit:0 -e ignore \
+	    -o match:'Addresses:   2' \
+	    jexec alcatraz pfctl -vvsTables
+
 	atf_check -s exit:0 -e ignore \
 	    -o match:'In/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \
 	    -o match:'In/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \