]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
event: only sets APPLAYER_UNEXPECTED_PROTOCOL once
authorPhilippe Antoine <contact@catenacyber.fr>
Wed, 1 Jun 2022 13:04:34 +0000 (15:04 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 2 Jul 2022 05:42:49 +0000 (07:42 +0200)
If f->alproto == ALPROTO_UNKNOWN, we do not know the new protocol
yet, so we do not set the event yet.

(cherry picked from commit e6925300212277a7300f4a3aa9b5c745ee10e0df)

src/app-layer.c

index 08100e240ecd35afae4e24f79bac444d3813d43c..e0301b96891326ade316708e444b609dbad2f70f 100644 (file)
@@ -694,9 +694,8 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         SCLogDebug("protocol change, old %s, new %s",
                 AppProtoToString(f->alproto_orig), AppProtoToString(f->alproto));
 
-        if (f->alproto_expect != ALPROTO_UNKNOWN &&
-                f->alproto != f->alproto_expect)
-        {
+        if (f->alproto_expect != ALPROTO_UNKNOWN && f->alproto != ALPROTO_UNKNOWN &&
+                f->alproto != f->alproto_expect) {
             AppLayerDecoderEventsSetEventRaw(&p->app_layer_events,
                                              APPLAYER_UNEXPECTED_PROTOCOL);