]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer/profile: fix udp protocol detection profiling
authorVictor Julien <victor@inliniac.net>
Sat, 16 Mar 2019 17:04:16 +0000 (18:04 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 18 Mar 2019 12:02:08 +0000 (13:02 +0100)
src/app-layer.c

index 280151c5846da3ba3054a7d02f02e9c514eb6c43..7de157cf43ed63b77fefd25b5370e3317ca4aee6 100644 (file)
@@ -673,6 +673,8 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
         flags |= STREAM_TOCLIENT;
     }
 
+    AppLayerProfilingReset(tctx);
+
     /* if the protocol is still unknown, run detection */
     if (f->alproto == ALPROTO_UNKNOWN) {
         SCLogDebug("Detecting AL proto on udp mesg (len %" PRIu32 ")",
@@ -680,8 +682,7 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
 
         PACKET_PROFILING_APP_PD_START(tctx);
         f->alproto = AppLayerProtoDetectGetProto(tctx->alpd_tctx,
-                                  f,
-                                  p->payload, p->payload_len,
+                                  f, p->payload, p->payload_len,
                                   IPPROTO_UDP, flags);
         PACKET_PROFILING_APP_PD_END(tctx);
 
@@ -692,12 +693,12 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
             r = AppLayerParserParse(tv, tctx->alp_tctx, f, f->alproto,
                                     flags, p->payload, p->payload_len);
             PACKET_PROFILING_APP_END(tctx, f->alproto);
-            PACKET_PROFILING_APP_STORE(tctx, p);
         } else {
             f->alproto = ALPROTO_FAILED;
             AppLayerIncFlowCounter(tv, f);
             SCLogDebug("ALPROTO_UNKNOWN flow %p", f);
         }
+        PACKET_PROFILING_APP_STORE(tctx, p);
         /* we do only inspection in one direction, so flag both
          * sides as done here */
         FlagPacketFlow(p, f, STREAM_TOSERVER);