exceptions: s/DEBUG/QA_SIMULATION build flag

Task #7885
pull/14856/head
Juliana Fajardini 5 months ago committed by Victor Julien
parent 5edb5a5d1a
commit dc4d805908

@ -1373,7 +1373,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 == PcapPacketCntGet(p)) {
SCLogNotice("simulating memcap hit for packet %" PRIu64, PcapPacketCntGet(p));
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
@ -283,7 +283,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

@ -694,7 +694,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 == PcapPacketCntGet(p)) {
NoFlowHandleIPS(tv, fls, p);
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_memcap);

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

@ -75,6 +75,8 @@
static SCMutex segment_pool_memuse_mutex;
static uint64_t segment_pool_memuse = 0;
static uint64_t segment_pool_memcnt = 0;
#endif
#ifdef QA_SIMULATION
thread_local uint64_t t_pcapcnt = UINT64_MAX;
#endif
@ -162,7 +164,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);

@ -221,9 +221,9 @@ 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
extern thread_local uint64_t t_pcapcnt;
#if defined(DEBUG) || defined(QA_SIMULATION)
static uint64_t ssn_pool_cnt = 0; /** counts ssns, protected by ssn_pool_mutex */
extern thread_local uint64_t t_pcapcnt;
#endif
TcpStreamCnf stream_config;
@ -950,12 +950,12 @@ static TcpSession *StreamTcpNewSession(ThreadVars *tv, StreamTcpThread *stt, Pac
#endif
StatsCounterIncr(&tv->stats, 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);
@ -963,6 +963,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) {
@ -6122,9 +6123,9 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueueNoLock *pq)
: "noflow",
PktSrcToString(p->pkt_src));
#ifdef DEBUG
#ifdef QA_SIMULATION
t_pcapcnt = PcapPacketCntGet(p);
#endif /* DEBUG */
#endif
if (!(PacketIsTCP(p))) {
return TM_ECODE_OK;

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