]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/profiling: remove assertion
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 5 Jan 2024 12:59:54 +0000 (13:59 +0100)
committerVictor Julien <victor@inliniac.net>
Sat, 20 Jul 2024 08:37:58 +0000 (10:37 +0200)
Now a flow alproto can be changed by a call to AppLayerParserParse
when HTTP2 forces the flow to turn into DOH2.

src/app-layer.c
src/util-profiling.h

index 11b36f6a082cdd02d972d786a9b39b2c7399e2d5..94f99f44f83e0b37a59003b58e7522cdd5b70053 100644 (file)
@@ -554,7 +554,7 @@ static int TCPProtoDetect(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         PACKET_PROFILING_APP_START(app_tctx, f->alproto);
         int r = AppLayerParserParse(tv, app_tctx->alp_tctx, f, f->alproto,
                 flags, data, data_len);
-        PACKET_PROFILING_APP_END(app_tctx, f->alproto);
+        PACKET_PROFILING_APP_END(app_tctx);
         p->app_update_direction = (uint8_t)app_update_dir;
         if (r != 1) {
             StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
@@ -642,7 +642,7 @@ static int TCPProtoDetect(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
                     int r = AppLayerParserParse(tv, app_tctx->alp_tctx, f,
                             f->alproto, flags,
                             data, data_len);
-                    PACKET_PROFILING_APP_END(app_tctx, f->alproto);
+                    PACKET_PROFILING_APP_END(app_tctx);
                     p->app_update_direction = (uint8_t)app_update_dir;
                     if (r != 1) {
                         StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
@@ -751,7 +751,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, Packet
         PACKET_PROFILING_APP_START(app_tctx, f->alproto);
         r = AppLayerParserParse(tv, app_tctx->alp_tctx, f, f->alproto,
                 flags, data, data_len);
-        PACKET_PROFILING_APP_END(app_tctx, f->alproto);
+        PACKET_PROFILING_APP_END(app_tctx);
         p->app_update_direction = (uint8_t)app_update_dir;
         /* ignore parser result for gap */
         StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
@@ -837,7 +837,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, Packet
             PACKET_PROFILING_APP_START(app_tctx, f->alproto);
             r = AppLayerParserParse(tv, app_tctx->alp_tctx, f, f->alproto,
                                     flags, data, data_len);
-            PACKET_PROFILING_APP_END(app_tctx, f->alproto);
+            PACKET_PROFILING_APP_END(app_tctx);
             p->app_update_direction = (uint8_t)app_update_dir;
             if (r != 1) {
                 StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
@@ -963,7 +963,7 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
             PACKET_PROFILING_APP_START(tctx, f->alproto);
             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_END(tctx);
             p->app_update_direction = (uint8_t)UPDATE_DIR_PACKET;
         }
         PACKET_PROFILING_APP_STORE(tctx, p);
@@ -979,7 +979,7 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
         PACKET_PROFILING_APP_START(tctx, f->alproto);
         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_END(tctx);
         PACKET_PROFILING_APP_STORE(tctx, p);
         p->app_update_direction = (uint8_t)UPDATE_DIR_PACKET;
     }
index 564f62b5c78f966334c2b3fad937b9a89dd3cf62..094c6de6d209391dda15ff1f82df07d76d367fbe 100644 (file)
@@ -170,13 +170,12 @@ PktProfiling *SCProfilePacketStart(void);
         (dp)->alproto = (id);                                       \
     }
 
-#define PACKET_PROFILING_APP_END(dp, id)                            \
-    if (profiling_packets_enabled) {                                \
-        BUG_ON((id) != (dp)->alproto);                              \
-        (dp)->ticks_end = UtilCpuGetTicks();                        \
-        if ((dp)->ticks_start != 0 && (dp)->ticks_start < ((dp)->ticks_end)) {  \
-            (dp)->ticks_spent = ((dp)->ticks_end - (dp)->ticks_start);  \
-        }                                                           \
+#define PACKET_PROFILING_APP_END(dp)                                                               \
+    if (profiling_packets_enabled) {                                                               \
+        (dp)->ticks_end = UtilCpuGetTicks();                                                       \
+        if ((dp)->ticks_start != 0 && (dp)->ticks_start < ((dp)->ticks_end)) {                     \
+            (dp)->ticks_spent = ((dp)->ticks_end - (dp)->ticks_start);                             \
+        }                                                                                          \
     }
 
 #define PACKET_PROFILING_APP_PD_START(dp)                           \
@@ -340,7 +339,7 @@ void SCProfilingDump(void);
 #define PACKET_PROFILING_RESET(p)
 
 #define PACKET_PROFILING_APP_START(dp, id)
-#define PACKET_PROFILING_APP_END(dp, id)
+#define PACKET_PROFILING_APP_END(d)
 #define PACKET_PROFILING_APP_RESET(dp)
 #define PACKET_PROFILING_APP_STORE(dp, p)