Correct the netflow 9 timestamp.

This commit is contained in:
Herbert Wolverson
2024-12-04 09:46:13 -06:00
parent a59a1b61c3
commit 5f46c14efc

View File

@@ -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,
}