aboutsummaryrefslogtreecommitdiff
path: root/sys/net/pfvar.h
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2023-12-07 13:35:11 +0000
committerKristof Provost <kp@FreeBSD.org>2024-01-16 08:45:54 +0000
commit0493260115db10164246762d6d4923880575e529 (patch)
tree19e4a4695828c13eb493259e644926baba1bbe06 /sys/net/pfvar.h
parent6bd36d1cf4e98f11661642331fddb5d30dced68d (diff)
downloadsrc-0493260115db10164246762d6d4923880575e529.tar.gz
src-0493260115db10164246762d6d4923880575e529.zip
pf: store state creation/expiration timestamps with milisecond precision
The primary beneficiary is pflow(4), which expects milisecond precision in timestamps. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43112
Diffstat (limited to 'sys/net/pfvar.h')
-rw-r--r--sys/net/pfvar.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 037286a756be..f0742c99a4a8 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1061,8 +1061,8 @@ struct pf_kstate {
struct pf_ksrc_node *nat_src_node;
u_int64_t packets[2];
u_int64_t bytes[2];
- u_int32_t creation;
- u_int32_t expire;
+ u_int64_t creation;
+ u_int64_t expire;
u_int32_t pfsync_time;
struct pf_rule_actions act;
u_int16_t tag;
@@ -2238,6 +2238,22 @@ pf_release_staten(struct pf_kstate *s, u_int n)
return (0);
}
+static __inline uint64_t
+pf_get_uptime(void)
+{
+ struct timeval t;
+ microuptime(&t);
+ return ((t.tv_sec * 1000) + (t.tv_usec / 1000));
+}
+
+static __inline uint64_t
+pf_get_time(void)
+{
+ struct timeval t;
+ microtime(&t);
+ return ((t.tv_sec * 1000) + (t.tv_usec / 1000));
+}
+
extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t);
extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *,
u_int, int *);