From: Philippe Antoine Date: Fri, 5 Jan 2024 12:59:54 +0000 (+0100) Subject: util/profiling: remove assertion X-Git-Tag: suricata-8.0.0-beta1~986 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd5ad0d74a1d3b491a62e2b3ac885e749c105e8d;p=thirdparty%2Fsuricata.git util/profiling: remove assertion Now a flow alproto can be changed by a call to AppLayerParserParse when HTTP2 forces the flow to turn into DOH2. --- diff --git a/src/app-layer.c b/src/app-layer.c index 11b36f6a08..94f99f44f8 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -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; } diff --git a/src/util-profiling.h b/src/util-profiling.h index 564f62b5c7..094c6de6d2 100644 --- a/src/util-profiling.h +++ b/src/util-profiling.h @@ -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)