exceptions: s/DEBUG/QA_SIMULATION build flag

Task #7885

(cherry picked from commit dc4d805908)
pull/14892/head
Juliana Fajardini 5 months ago committed by Victor Julien
parent f7cb04bfff
commit f6093b6729

@ -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,

@ -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);

@ -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

@ -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);

@ -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++;

@ -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);

@ -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) {

@ -390,7 +390,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co
}
}
#ifndef DEBUG
#ifndef QA_SIMULATION
int ExceptionSimulationCommandLineParser(const char *name, const char *arg)
{

@ -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;

Loading…
Cancel
Save