git: e8eb3096d8d1 - main - pf: Fix missing connection rate for DIOCGETSRCNODES

From: Kajetan Staszkiewicz <ks_at_FreeBSD.org>
Date: Thu, 21 Nov 2024 14:28:04 UTC
The branch main has been updated by ks:

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

commit e8eb3096d8d140edc506aab40761d1f00bf3e9e8
Author:     Kajetan Staszkiewicz <ks@FreeBSD.org>
AuthorDate: 2024-11-21 14:23:42 +0000
Commit:     Kajetan Staszkiewicz <ks@FreeBSD.org>
CommitDate: 2024-11-21 14:27:28 +0000

    pf: Fix missing connection rate for DIOCGETSRCNODES
    
    The function pf_src_node_copy() copies struct pf_ksrc_node to its ioctl
    counterpart. It was missing copying of the conn_rate field, even though
    the code for adjusting the output for pfctl was in place.
    
    Add copying of conn_rate.
    
    Reviewed by:            kp
    Approved by:            kp (mentor)
    MFC after:              2 weeks
    Sponsored by:           InnoGames GmbH
    Differential Revision:  https://reviews.freebsd.org/D47679
---
 sys/netpfil/pf/pf_ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index c3f0166810ec..59c442698b95 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -1570,6 +1570,7 @@ pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out)
 		out->expire = 0;
 
 	/* Adjust the connection rate estimate. */
+	out->conn_rate = in->conn_rate;
 	diff = secs - in->conn_rate.last;
 	if (diff >= in->conn_rate.seconds)
 		out->conn_rate.count = 0;