From: Victor Julien Date: Sun, 15 Sep 2024 17:15:56 +0000 (+0200) Subject: time: thread time update after flow update X-Git-Tag: suricata-8.0.0-beta1~592 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c587e90ebccfe8883ea951e723be461dc58dcc06;p=thirdparty%2Fsuricata.git time: thread time update after flow update The flow worker needs to get the opportunity to run the flow update before globally making it's current timestamp available. This is to avoid another thread using the time to evict the flow that is about to get a legitimate update. Ticket: #7455. --- diff --git a/src/flow-worker.c b/src/flow-worker.c index 63de42a266..3c95fe8789 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -554,11 +554,6 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data) SCLogDebug("packet %"PRIu64, p->pcap_cnt); - /* update time */ - if (!(PKT_IS_PSEUDOPKT(p))) { - TimeSetByThread(tv->id, p->ts); - } - /* handle Flow */ if (p->flags & PKT_WANTS_FLOW) { FLOWWORKER_PROFILING_START(p, PROFILE_FLOWWORKER_FLOW); @@ -567,6 +562,10 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data) if (likely(p->flow != NULL)) { DEBUG_ASSERT_FLOW_LOCKED(p->flow); if (FlowUpdate(tv, fw, p) == TM_ECODE_DONE) { + /* update time */ + if (!(PKT_IS_PSEUDOPKT(p))) { + TimeSetByThread(tv->id, p->ts); + } goto housekeeping; } } @@ -581,6 +580,11 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data) DEBUG_VALIDATE_BUG_ON(p->pkt_src != PKT_SRC_FFR); } + /* update time */ + if (!(PKT_IS_PSEUDOPKT(p))) { + TimeSetByThread(tv->id, p->ts); + } + SCLogDebug("packet %"PRIu64" has flow? %s", p->pcap_cnt, p->flow ? "yes" : "no"); /* handle TCP and app layer */