]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
nflog/time: Fixup timestamp handling
authorJeff Lucovsky <jlucovsky@oisf.net>
Tue, 7 Mar 2023 13:59:12 +0000 (08:59 -0500)
committerVictor Julien <vjulien@oisf.net>
Sat, 11 Mar 2023 06:31:37 +0000 (07:31 +0100)
Issue: 5818

This commit corrects the timestamp handling for the packet to work with
the SCTime_t struct.

src/source-nflog.c

index b2129b54f5a104e3bdf9fd11a238350a5bf99a44..622e3df300d675339411884d39fb11b2b3694896 100644 (file)
@@ -178,13 +178,13 @@ static int NFLOGCallback(struct nflog_g_handle *gh, struct nfgenmsg *msg,
     } else if (ret == -1)
         SET_PKT_LEN(p, 0);
 
-    ret = nflog_get_timestamp(nfa, &p->ts);
+    struct timeval tv;
+    ret = nflog_get_timestamp(nfa, &tv);
     if (ret != 0) {
-        struct timeval tv;
-        memset(&tv, 0, sizeof(struct timeval));
+        memset(&tv, 0, sizeof(tv));
         gettimeofday(&tv, NULL);
-        p->ts = SCTIME_FROM_TIMEVAL(&tv);
     }
+    p->ts = SCTIME_FROM_TIMEVAL(&tv);
 
     p->datalink = DLT_RAW;