]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
protodetect: run expected probing parser
authorPhilippe Antoine <pantoine@oisf.net>
Sat, 30 Dec 2023 20:36:07 +0000 (21:36 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 17 Apr 2024 05:17:02 +0000 (07:17 +0200)
When there is a protocol change, and a specific protocol is
expected, like WebSeocket, always run it, no matter the port.

src/app-layer-detect-proto.c

index 35fc39ced4635db170f11b1bc162ffcc6d46e6ef..c47a437659fdb54aa459db128a2c0c585953853a 100644 (file)
@@ -581,7 +581,10 @@ again_midstream:
         }
     }
 
-    if (dir == STREAM_TOSERVER && f->alproto_tc != ALPROTO_UNKNOWN) {
+    if (f->alproto_expect != ALPROTO_UNKNOWN) {
+        // needed for websocket which does not use ports
+        pe0 = AppLayerProtoDetectGetProbingParser(alpd_ctx.ctx_pp, ipproto, f->alproto_expect);
+    } else if (dir == STREAM_TOSERVER && f->alproto_tc != ALPROTO_UNKNOWN) {
         pe0 = AppLayerProtoDetectGetProbingParser(alpd_ctx.ctx_pp, ipproto, f->alproto_tc);
     } else if (dir == STREAM_TOCLIENT && f->alproto_ts != ALPROTO_UNKNOWN) {
         pe0 = AppLayerProtoDetectGetProbingParser(alpd_ctx.ctx_pp, ipproto, f->alproto_ts);