]> git.ipfire.org Git - thirdparty/suricata.git/commit
flow: modify lastts update logic
authorVictor Julien <victor@inliniac.net>
Sat, 24 Jan 2015 12:46:25 +0000 (13:46 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 4 Feb 2015 10:28:11 +0000 (11:28 +0100)
commit5587372ce15cf3ead98867e1daf3dd010529b4ad
treedb9b34d7629c7eb4b9d1114921683d51b0799499
parenta0732d3db23538689af9432e012d26241996b99b
flow: modify lastts update logic

In the lastts timeval struct field in the flow the timestamp of the
last packet to update is recorded. This allows for tracking the timeout
of the flow. So far, this value was updated under the flow lock and also
read under the flow lock.

This patch moves the updating of this field to the FlowGetFlowFromHash
function, where it updated at the point where both the Flow and the
Flow Hash Row lock are held. This guarantees that the field is only
updated when both locks are held.

This makes reading the field safe when either lock is held, which is the
purpose of this patch.

The flow manager, while holding the flow hash row lock, can now safely
read the lastts value. This allows it to do the flow timeout check
without actually locking the flow.
src/flow-hash.c
src/flow.c
src/flow.h