From 3aa9ff52a808a180fbb5c046565a73e68484a7ad Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 14 Dec 2023 11:31:37 +0100 Subject: [PATCH] stats: incr app-proto flow counter for detection-only Ticket: 6633 (cherry picked from commit 3103505cb0fa87f18b63434a94c1b3814f5b8003) --- src/app-layer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app-layer.c b/src/app-layer.c index b031afce8a..794e8e84d3 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -510,6 +510,20 @@ static int TCPProtoDetect(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, if (r != 1) { StreamTcpUpdateAppLayerProgress(ssn, direction, data_len); } + if (r == 0) { + if (*alproto_otherdir == ALPROTO_UNKNOWN) { + TcpStream *opposing_stream; + if (*stream == &ssn->client) { + opposing_stream = &ssn->server; + } else { + opposing_stream = &ssn->client; + } + if (StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(opposing_stream)) { + // can happen in detection-only + AppLayerIncFlowCounter(tv, f); + } + } + } if (r < 0) { goto parser_error; } -- 2.47.2