Add NANO_TO_SEC constant.

This commit is contained in:
Christian Deacon
2024-06-13 19:23:54 -04:00
parent a180aa3dc9
commit 1f66f7ab4e
2 changed files with 2 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
#define MAX_FILTERS 80 #define MAX_FILTERS 80
#define MAX_TRACK_IPS 100000 #define MAX_TRACK_IPS 100000
#define MAX_CPUS 256 #define MAX_CPUS 256
#define NANO_TO_SEC 1000000000
#ifdef __BPF__ #ifdef __BPF__
#define likely(x) __builtin_expect(!!(x), 1) #define likely(x) __builtin_expect(!!(x), 1)

View File

@@ -202,7 +202,7 @@ int xdp_prog_main(struct xdp_md *ctx)
if (ip_stats) if (ip_stats)
{ {
// Check for reset. // Check for reset.
if ((now - ip_stats->tracking) > 1000000000) if ((now - ip_stats->tracking) > NANO_TO_SEC)
{ {
ip_stats->pps = 0; ip_stats->pps = 0;
ip_stats->bps = 0; ip_stats->bps = 0;