flow: update lastts in FlowHandlePacketUpdate

This allows to make it conditional to the state of packet and
then trigger modified behavior.
pull/2302/head
Eric Leblond 9 years ago committed by Victor Julien
parent 5b71b5834f
commit 4cf887b4f7

@ -489,8 +489,6 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, DecodeThreadVars *dtv, const Packet *p
f->fb = fb;
FlowUpdateState(f, FLOW_STATE_NEW);
/* update the last seen timestamp of this flow */
COPY_TIMESTAMP(&p->ts,&f->lastts);
FlowReference(dest, f);
FBLOCK_UNLOCK(fb);
@ -526,8 +524,6 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, DecodeThreadVars *dtv, const Packet *p
f->fb = fb;
FlowUpdateState(f, FLOW_STATE_NEW);
/* update the last seen timestamp of this flow */
COPY_TIMESTAMP(&p->ts,&f->lastts);
FlowReference(dest, f);
FBLOCK_UNLOCK(fb);
@ -562,8 +558,6 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, DecodeThreadVars *dtv, const Packet *p
}
}
/* update the last seen timestamp of this flow */
COPY_TIMESTAMP(&p->ts,&f->lastts);
FlowReference(dest, f);
FBLOCK_UNLOCK(fb);
@ -582,8 +576,6 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, DecodeThreadVars *dtv, const Packet *p
}
}
/* update the last seen timestamp of this flow */
COPY_TIMESTAMP(&p->ts,&f->lastts);
FlowReference(dest, f);
FBLOCK_UNLOCK(fb);

@ -42,6 +42,8 @@
#include "util-validate.h"
#include "flow-util.h"
typedef DetectEngineThreadCtx *DetectEngineThreadCtxPtr;
typedef struct FlowWorkerThreadData_ {

@ -223,6 +223,13 @@ void FlowHandlePacketUpdate(Flow *f, Packet *p)
{
SCLogDebug("packet %"PRIu64" -- flow %p", p->pcap_cnt, f);
int state = SC_ATOMIC_GET(f->flow_state);
if (state != FLOW_STATE_CAPTURE_BYPASSED) {
/* update the last seen timestamp of this flow */
COPY_TIMESTAMP(&p->ts, &f->lastts);
}
/* update flags and counters */
if (FlowGetPacketDirection(f, p) == TOSERVER) {
f->todstpktcnt++;

Loading…
Cancel
Save