Skip to contentSkip to conversation

Set timestamp in NFLOG for INPUT and OUTPUT.

PATCH Applied Eric Leblond 2 participants 2 messages May 19, 2008 – Jun 1, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 Set timestamp in NFLOG for INPUT and OUTPUT.

---
 input/packet/ulogd_inppkt_NFLOG.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
input/packet/ulogd_inppkt_NFLOG.c +8 -7
index f258473..8d08bd8 100644
@@ -344,13 +344,14 @@ interp_packet(struct ulogd_pluginstance *upi, struct nflog_data *ldata)
 
 	/* god knows why timestamp_usec contains crap if timestamp_sec
 	 * == 0 if (pkt->timestamp_sec || pkt->timestamp_usec) { */
-	if (nflog_get_timestamp(ldata, &ts) == 0 && ts.tv_sec) {
-		/* FIXME: convert endianness */
-		ret[NFLOG_KEY_OOB_TIME_SEC].u.value.ui32 = ts.tv_sec & 0xffffffff;
-		ret[NFLOG_KEY_OOB_TIME_SEC].flags |= ULOGD_RETF_VALID;
-		ret[NFLOG_KEY_OOB_TIME_USEC].u.value.ui32 = ts.tv_usec & 0xffffffff;
-		ret[NFLOG_KEY_OOB_TIME_USEC].flags |= ULOGD_RETF_VALID;
-	}
+	if (! (nflog_get_timestamp(ldata, &ts) == 0 && ts.tv_sec))
+		gettimeofday(&ts, NULL);
+
+	/* FIXME: convert endianness */
+	ret[NFLOG_KEY_OOB_TIME_SEC].u.value.ui32 = ts.tv_sec & 0xffffffff;
+	ret[NFLOG_KEY_OOB_TIME_SEC].flags |= ULOGD_RETF_VALID;
+	ret[NFLOG_KEY_OOB_TIME_USEC].u.value.ui32 = ts.tv_usec & 0xffffffff;
+	ret[NFLOG_KEY_OOB_TIME_USEC].flags |= ULOGD_RETF_VALID;
 
 	ret[NFLOG_KEY_OOB_MARK].u.value.ui32 = mark;
 	ret[NFLOG_KEY_OOB_MARK].flags |= ULOGD_RETF_VALID;
Signature · 1 line
1.5.4.3
maintainer Applied
#1 lore raw
Quoted 1 line · Eric Leblond

Applied. Please add a short description (even if it is the same of the subject) in the body of the email.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers