diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 68102c2ad1..b1411a7b0b 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1360,7 +1360,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow &stream_slice); HandleStreamFrames(f, stream_slice, input, input_len, flags); -#ifdef DEBUG +#ifdef QA_SIMULATION if (((stream_slice.flags & STREAM_TOSERVER) && stream_slice.offset >= g_eps_applayer_error_offset_ts)) { SCLogNotice("putting parser %s into an error state from toserver offset %" PRIu64, diff --git a/src/defrag-hash.c b/src/defrag-hash.c index 98921b8021..107d355ef5 100644 --- a/src/defrag-hash.c +++ b/src/defrag-hash.c @@ -468,7 +468,7 @@ static void DefragExceptionPolicyStatsIncr( */ static DefragTracker *DefragTrackerGetNew(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p) { -#ifdef DEBUG +#ifdef QA_SIMULATION if (g_eps_defrag_memcap != UINT64_MAX && g_eps_defrag_memcap == p->pcap_cnt) { SCLogNotice("simulating memcap hit for packet %" PRIu64, p->pcap_cnt); ExceptionPolicyApply(p, defrag_config.memcap_policy, PKT_DROP_REASON_DEFRAG_MEMCAP); diff --git a/src/detect-engine-alert.c b/src/detect-engine-alert.c index a6dd332554..85608c9a6b 100644 --- a/src/detect-engine-alert.c +++ b/src/detect-engine-alert.c @@ -29,7 +29,7 @@ #include "flow.h" #include "flow-private.h" -#ifdef DEBUG +#ifdef QA_SIMULATION #include "util-exception-policy.h" #endif @@ -282,7 +282,7 @@ static inline uint16_t AlertQueueExpandDo(DetectEngineThreadCtx *det_ctx, uint16 */ static uint16_t AlertQueueExpand(DetectEngineThreadCtx *det_ctx) { -#ifdef DEBUG +#ifdef QA_SIMULATION if (unlikely(g_eps_is_alert_queue_fail_mode)) return det_ctx->alert_queue_capacity; #endif diff --git a/src/flow-hash.c b/src/flow-hash.c index 632e5668b7..66777d349c 100644 --- a/src/flow-hash.c +++ b/src/flow-hash.c @@ -693,7 +693,7 @@ static inline void NoFlowHandleIPS(ThreadVars *tv, FlowLookupStruct *fls, Packet static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p) { const bool emerg = ((SC_ATOMIC_GET(flow_flags) & FLOW_EMERGENCY) != 0); -#ifdef DEBUG +#ifdef QA_SIMULATION if (g_eps_flow_memcap != UINT64_MAX && g_eps_flow_memcap == p->pcap_cnt) { NoFlowHandleIPS(tv, fls, p); StatsIncr(tv, fls->dtv->counter_flow_memcap); diff --git a/src/source-pcap-file-helper.c b/src/source-pcap-file-helper.c index 18278602d6..a2c6043475 100644 --- a/src/source-pcap-file-helper.c +++ b/src/source-pcap-file-helper.c @@ -61,7 +61,7 @@ void CleanupPcapFileFileVars(PcapFileFileVars *pfv) void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt) { SCEnter(); -#ifdef DEBUG +#ifdef QA_SIMULATION if (unlikely((pcap_g.cnt + 1ULL) == g_eps_pcap_packet_loss)) { SCLogNotice("skipping packet %" PRIu64, g_eps_pcap_packet_loss); pcap_g.cnt++; diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 77556c5d73..387740c452 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -163,7 +163,7 @@ uint64_t StreamTcpReassembleMemuseGlobalCounter(void) */ int StreamTcpReassembleCheckMemcap(uint64_t size) { -#ifdef DEBUG +#ifdef QA_SIMULATION if (unlikely((g_eps_stream_reassembly_memcap != UINT64_MAX && g_eps_stream_reassembly_memcap == t_pcapcnt))) { SCLogNotice("simulating memcap reached condition for packet %" PRIu64, t_pcapcnt); diff --git a/src/stream-tcp.c b/src/stream-tcp.c index c535b89e1f..4aefef9177 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -220,7 +220,7 @@ extern int g_detect_disabled; PoolThread *ssn_pool = NULL; static SCMutex ssn_pool_mutex = SCMUTEX_INITIALIZER; /**< init only, protect initializing and growing pool */ -#ifdef DEBUG +#if defined(DEBUG) || defined(QA_SIMULATION) static uint64_t ssn_pool_cnt = 0; /** counts ssns, protected by ssn_pool_mutex */ #endif @@ -948,12 +948,12 @@ static TcpSession *StreamTcpNewSession(ThreadVars *tv, StreamTcpThread *stt, Pac #endif StatsIncr(tv, stt->counter_tcp_ssn_from_pool); } -#ifdef DEBUG +#if defined(DEBUG) || defined(QA_SIMULATION) SCMutexLock(&ssn_pool_mutex); if (p->flow->protoctx != NULL) ssn_pool_cnt++; SCMutexUnlock(&ssn_pool_mutex); - +#ifdef QA_SIMULATION if (unlikely((g_eps_stream_ssn_memcap != UINT64_MAX && g_eps_stream_ssn_memcap == t_pcapcnt))) { SCLogNotice("simulating memcap reached condition for packet %" PRIu64, t_pcapcnt); @@ -961,6 +961,7 @@ static TcpSession *StreamTcpNewSession(ThreadVars *tv, StreamTcpThread *stt, Pac StreamTcpSsnMemcapExceptionPolicyStatsIncr(tv, stt, stream_config.ssn_memcap_policy); return NULL; } +#endif #endif ssn = (TcpSession *)p->flow->protoctx; if (ssn == NULL) { diff --git a/src/util-exception-policy.c b/src/util-exception-policy.c index f3404b54c6..1f3160b111 100644 --- a/src/util-exception-policy.c +++ b/src/util-exception-policy.c @@ -390,7 +390,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co } } -#ifndef DEBUG +#ifndef QA_SIMULATION int ExceptionSimulationCommandLineParser(const char *name, const char *arg) { diff --git a/src/util-exception-policy.h b/src/util-exception-policy.h index 9d3dcc4260..64edb27974 100644 --- a/src/util-exception-policy.h +++ b/src/util-exception-policy.h @@ -38,7 +38,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co const char *default_str, bool (*isExceptionPolicyValid)(enum ExceptionPolicy)); extern enum ExceptionPolicy g_eps_master_switch; -#ifdef DEBUG +#ifdef QA_SIMULATION extern uint64_t g_eps_applayer_error_offset_ts; extern uint64_t g_eps_applayer_error_offset_tc; extern uint64_t g_eps_pcap_packet_loss;