]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stats: incr app-proto flow counter for detection-only
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 14 Dec 2023 10:31:37 +0000 (11:31 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 19 Dec 2023 08:51:20 +0000 (09:51 +0100)
Ticket: 6633

src/app-layer.c

index 102319042bcc31c5245c408d73945c5bb8dc0eb1..e159b932afc38f92ed1a1682b4df672952505924 100644 (file)
@@ -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;
         }