Hi, it seems like r343295 broke "SOURCE TRACKING NODES" section in 'pfctl -vvs all' output. Steps to reproduce: - use pf.conf similar to this: set skip on lo0 block drop all pass out keep state (max-src-conn 6) - ping example.com - check pfctl -vvs all output: SOURCE TRACKING NODES: ? -> ? ( states 3735929054, connections 3735929054, rate 3735929.0/3735929054s ) age 1037758:04:14, 13644642147974742460 pkts, 13644642147974742460 bytes If I revert r343295, the output is correct: SOURCE TRACKING NODES: 10.0.2.15 -> 0.0.0.0 ( states 2, connections 0, rate 0.0/0s ) age 00:00:02, 4 pkts, 296 bytes, filter rule 1 BR/Marko
I think I see what the problem is. Can you confirm this fixes your problem? diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c6f9f8451be..bd988e81db2 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3754,6 +3754,8 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td break; } + nr = 0; + p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK); for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++) {
A commit references this bug: Author: kp Date: Fri Mar 8 09:33:16 UTC 2019 New revision: 344921 URL: https://svnweb.freebsd.org/changeset/base/344921 Log: pf: Fix DIOCGETSRCNODES r343295 broke DIOCGETSRCNODES by failing to reset 'nr' after counting the number of source tracking nodes. This meant that we never copied the information to userspace, leading to '? -> ?' output from pfctl. PR: 236368 MFC after: 1 week Changes: head/sys/netpfil/pf/pf_ioctl.c
(In reply to Kristof Provost from comment #1) Yes, this fixes the issue. Thanks. BR/Marko
A commit references this bug: Author: kp Date: Fri Mar 15 11:01:50 UTC 2019 New revision: 345175 URL: https://svnweb.freebsd.org/changeset/base/345175 Log: MFC r344921: pf: Fix DIOCGETSRCNODES r343295 broke DIOCGETSRCNODES by failing to reset 'nr' after counting the number of source tracking nodes. This meant that we never copied the information to userspace, leading to '? -> ?' output from pfctl. PR: 236368 Changes: _U stable/12/ stable/12/sys/netpfil/pf/pf_ioctl.c
A commit references this bug: Author: kp Date: Fri Mar 15 11:01:53 UTC 2019 New revision: 345176 URL: https://svnweb.freebsd.org/changeset/base/345176 Log: MFC r344921: pf: Fix DIOCGETSRCNODES r343295 broke DIOCGETSRCNODES by failing to reset 'nr' after counting the number of source tracking nodes. This meant that we never copied the information to userspace, leading to '? -> ?' output from pfctl. PR: 236368 Changes: _U stable/11/ stable/11/sys/netpfil/pf/pf_ioctl.c