]> git.ipfire.org Git - thirdparty/suricata.git/commit
pcap/file: improve time handling 4779/head
authorVictor Julien <victor@inliniac.net>
Fri, 28 Feb 2020 12:17:03 +0000 (13:17 +0100)
committerJeff Lucovsky <jeff@lucovsky.org>
Sun, 5 Apr 2020 19:11:36 +0000 (15:11 -0400)
commit308f06c40e9d052bb64c499a5bfa5573a7acdb29
tree95cfde186adf01ed65b55d1bb2303222c7bb9624
parent34ec7f0f4f9aef06c231f9266911395718e3bac3
pcap/file: improve time handling

This patch addresses two problems.

First, various parts of the engine, but most notably the flow manager (FM),
use a minimum of the time notion of the packet threads. This did not
however, take into account the scenario where one or more of these
threads would be inactive for prolonged times. This could lead to the
time used by the FM could get stale.

This is addressed by keeping track of the last time the per thread packet
timestamp was updated, and only considering it for the 'minimum' when it
is reasonably current.

Second, there was a minor race condition at start up, where the FM would
already inspect the hash table(s) while the packet threads weren't active
yet. Since FM gets the time from the packet threads, it would use a bogus
time of 0.

This is addressed by adding a wait loop to the start of the FM that waits
for 'time' to get ready.

(cherry picked from commit 1e9333288f06ddc2f469053205a5d6662bf32ed7)
src/flow-manager.c
src/tm-threads.c
src/tm-threads.h
src/util-time.c
src/util-time.h