last_pkt_time = ntohl(*(const time_t*)data)/1000;
// last_pkt_time (LAST_SWITCHED) is defined as the system uptime
- // at which the flow was seen. If this is == to the current uptime
+ // at which the flow was seen. If this is >= to the current uptime
// something has gone wrong - use the NetFlow header unix time instead.
if (last_pkt_time >= sys_uptime)
record.last_pkt_second = unix_secs;
if ( first_packet > MAX_TIME or last_packet > MAX_TIME or first_packet > last_packet )
return false;
+ // also invalid flow time values, but we can recover from these malformed times
+ if (ntohl(precord->flow_first)/1000 >= header.sys_uptime)
+ first_packet = header.unix_secs;
+
+ if (ntohl(precord->flow_last)/1000 >= header.sys_uptime)
+ last_packet = header.unix_secs;
+
NetFlowSessionRecord record = {};
// Invalid source IP address provided