From 5f46c14efcb3d5b221efff3ecadb78eacd581831 Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Wed, 4 Dec 2024 09:46:13 -0600 Subject: [PATCH] Correct the netflow 9 timestamp. --- .../throughput_tracker/flow_data/netflow9/protocol/header.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rust/lqosd/src/throughput_tracker/flow_data/netflow9/protocol/header.rs b/src/rust/lqosd/src/throughput_tracker/flow_data/netflow9/protocol/header.rs index fec54c27..2dc8dc5f 100644 --- a/src/rust/lqosd/src/throughput_tracker/flow_data/netflow9/protocol/header.rs +++ b/src/rust/lqosd/src/throughput_tracker/flow_data/netflow9/protocol/header.rs @@ -1,4 +1,4 @@ -use lqos_utils::unix_time::time_since_boot; +use lqos_utils::unix_time::{time_since_boot, unix_now}; use nix::sys::time::TimeValLike; #[repr(C)] @@ -15,12 +15,13 @@ impl Netflow9Header { /// Create a new Netflow 9 header pub(crate) fn new(flow_sequence: u32, record_count_including_templates: u16) -> Self { let uptime = time_since_boot().unwrap(); + let unix_secs = unix_now().unwrap_or(0); Self { version: (9u16).to_be(), count: record_count_including_templates.to_be(), sys_uptime: (uptime.num_milliseconds() as u32).to_be(), - unix_secs: (uptime.num_seconds() as u32).to_be(), + unix_secs: (unix_secs as u32).to_be(), package_sequence: flow_sequence.to_be(), source_id: 0, }