]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pfring/time: Track stat output with SCTime_t
authorJeff Lucovsky <jlucovsky@oisf.net>
Sun, 29 Jan 2023 14:28:38 +0000 (09:28 -0500)
committerVictor Julien <vjulien@oisf.net>
Mon, 6 Mar 2023 07:23:14 +0000 (08:23 +0100)
Issue: 5818

This commit changes the datatype of the tracking value for the last time
stats were dumped.

Changing the type also eliminates a comparison between values with
different signs.

src/source-pfring.c

index 36b1c26ac9a4dae15a35019bc5ac42f1dabea92c..61423e2232798c539a6ea98342bec97d067234fa 100644 (file)
@@ -347,7 +347,7 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot)
     Packet *p = NULL;
     struct pfring_pkthdr hdr;
     TmSlot *s = (TmSlot *)slot;
-    time_t last_dump = 0;
+    SCTime_t last_dump = SCTIME_INITIALIZER;
     u_int buffer_size;
     u_char *pkt_buffer;
 
@@ -422,9 +422,9 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot)
             }
 
             /* Trigger one dump of stats every second */
-            if (SCTIME_SECS(p->ts) != last_dump) {
+            if (SCTIME_CMP_NEQ(p->ts, last_dump)) {
                 PfringDumpCounters(ptv);
-                last_dump = SCTIME_SECS(p->ts);
+                last_dump = p->ts;
             }
         } else if (unlikely(r == 0)) {
             if (suricata_ctl_flags & SURICATA_STOP) {