From: Victor Julien Date: Tue, 25 Apr 2023 08:22:11 +0000 (+0200) Subject: stream: update no-flow checks X-Git-Tag: suricata-6.0.13~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e275a1e28e759619ba2003ba2946b463dd9d2fd5;p=thirdparty%2Fsuricata.git stream: update no-flow checks (cherry picked from commit 0360cb654293c333e3be70204705fa7ec328512e) --- diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 2a921b31df..c17e42a07a 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -5476,6 +5476,11 @@ int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueueNoLock *pq) { + DEBUG_VALIDATE_BUG_ON(p->flow == NULL); + if (unlikely(p->flow == NULL)) { + return TM_ECODE_OK; + } + StreamTcpThread *stt = (StreamTcpThread *)data; SCLogDebug("p->pcap_cnt %"PRIu64, p->pcap_cnt); @@ -5487,11 +5492,6 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueueNoLock *pq) return TM_ECODE_OK; } - if (p->flow == NULL) { - StatsIncr(tv, stt->counter_tcp_no_flow); - return TM_ECODE_OK; - } - HandleThreadId(tv, p, stt); /* only TCP packets with a flow from here */ @@ -5531,7 +5531,6 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data) stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", tv); stt->counter_tcp_pseudo_failed = StatsRegisterCounter("tcp.pseudo_failed", tv); stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", tv); - stt->counter_tcp_no_flow = StatsRegisterCounter("tcp.no_flow", tv); stt->counter_tcp_syn = StatsRegisterCounter("tcp.syn", tv); stt->counter_tcp_synack = StatsRegisterCounter("tcp.synack", tv); stt->counter_tcp_rst = StatsRegisterCounter("tcp.rst", tv); diff --git a/src/stream-tcp.h b/src/stream-tcp.h index 48b32a4fb6..6bea83bb06 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -91,8 +91,6 @@ typedef struct StreamTcpThread_ { uint16_t counter_tcp_pseudo_failed; /** packets rejected because their csum is invalid */ uint16_t counter_tcp_invalid_checksum; - /** TCP packets with no associated flow */ - uint16_t counter_tcp_no_flow; /** sessions reused */ uint16_t counter_tcp_reused_ssn; /** syn pkts */