From a68e19d998acf2ae5239d7c798008c144761f5a5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 16 Oct 2014 11:17:06 +0200 Subject: [PATCH] stream: add counter for failed pseudo setups Stream pseudo packets are taken from the packet pool, which can be empty. In this case a pseudo packet will not be created and processed. This patch adds a counter "tcp.pseudo_failed" to track this. --- src/stream-tcp.c | 4 ++++ src/stream-tcp.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/stream-tcp.c b/src/stream-tcp.c index b6f001c1cf..aac662e0a6 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -4640,6 +4640,9 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data) stt->counter_tcp_pseudo = SCPerfTVRegisterCounter("tcp.pseudo", tv, SC_PERF_TYPE_UINT64, "NULL"); + stt->counter_tcp_pseudo_failed = SCPerfTVRegisterCounter("tcp.pseudo_failed", tv, + SC_PERF_TYPE_UINT64, + "NULL"); stt->counter_tcp_invalid_checksum = SCPerfTVRegisterCounter("tcp.invalid_checksum", tv, SC_PERF_TYPE_UINT64, "NULL"); @@ -5489,6 +5492,7 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread Packet *np = StreamTcpPseudoSetup(p, GET_PKT_DATA(p), GET_PKT_LEN(p)); if (np == NULL) { SCLogDebug("The packet received from packet allocation is NULL"); + SCPerfCounterIncr(stt->counter_tcp_pseudo_failed, tv->sc_perf_pca); SCReturn; } PKT_SET_SRC(np, PKT_SRC_STREAM_TCP_STREAM_END_PSEUDO); diff --git a/src/stream-tcp.h b/src/stream-tcp.h index 71c9f1858a..b8a31855af 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -85,6 +85,8 @@ typedef struct StreamTcpThread_ { uint16_t counter_tcp_ssn_memcap; /** pseudo packets processed */ uint16_t counter_tcp_pseudo; + /** pseudo packets failed to setup */ + 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 */