Skip to content

Commit f6093b6

Browse files
jufajardinivictorjulien
authored andcommitted
exceptions: s/DEBUG/QA_SIMULATION build flag
Task OISF#7885 (cherry picked from commit dc4d805)
1 parent f7cb04b commit f6093b6

9 files changed

Lines changed: 13 additions & 12 deletions

src/app-layer-parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow
13601360
&stream_slice);
13611361
HandleStreamFrames(f, stream_slice, input, input_len, flags);
13621362

1363-
#ifdef DEBUG
1363+
#ifdef QA_SIMULATION
13641364
if (((stream_slice.flags & STREAM_TOSERVER) &&
13651365
stream_slice.offset >= g_eps_applayer_error_offset_ts)) {
13661366
SCLogNotice("putting parser %s into an error state from toserver offset %" PRIu64,

src/defrag-hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static void DefragExceptionPolicyStatsIncr(
468468
*/
469469
static DefragTracker *DefragTrackerGetNew(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
470470
{
471-
#ifdef DEBUG
471+
#ifdef QA_SIMULATION
472472
if (g_eps_defrag_memcap != UINT64_MAX && g_eps_defrag_memcap == p->pcap_cnt) {
473473
SCLogNotice("simulating memcap hit for packet %" PRIu64, p->pcap_cnt);
474474
ExceptionPolicyApply(p, defrag_config.memcap_policy, PKT_DROP_REASON_DEFRAG_MEMCAP);

src/detect-engine-alert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "flow.h"
3030
#include "flow-private.h"
3131

32-
#ifdef DEBUG
32+
#ifdef QA_SIMULATION
3333
#include "util-exception-policy.h"
3434
#endif
3535

@@ -282,7 +282,7 @@ static inline uint16_t AlertQueueExpandDo(DetectEngineThreadCtx *det_ctx, uint16
282282
*/
283283
static uint16_t AlertQueueExpand(DetectEngineThreadCtx *det_ctx)
284284
{
285-
#ifdef DEBUG
285+
#ifdef QA_SIMULATION
286286
if (unlikely(g_eps_is_alert_queue_fail_mode))
287287
return det_ctx->alert_queue_capacity;
288288
#endif

src/flow-hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static inline void NoFlowHandleIPS(ThreadVars *tv, FlowLookupStruct *fls, Packet
693693
static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
694694
{
695695
const bool emerg = ((SC_ATOMIC_GET(flow_flags) & FLOW_EMERGENCY) != 0);
696-
#ifdef DEBUG
696+
#ifdef QA_SIMULATION
697697
if (g_eps_flow_memcap != UINT64_MAX && g_eps_flow_memcap == p->pcap_cnt) {
698698
NoFlowHandleIPS(tv, fls, p);
699699
StatsIncr(tv, fls->dtv->counter_flow_memcap);

src/source-pcap-file-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void CleanupPcapFileFileVars(PcapFileFileVars *pfv)
6161
void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt)
6262
{
6363
SCEnter();
64-
#ifdef DEBUG
64+
#ifdef QA_SIMULATION
6565
if (unlikely((pcap_g.cnt + 1ULL) == g_eps_pcap_packet_loss)) {
6666
SCLogNotice("skipping packet %" PRIu64, g_eps_pcap_packet_loss);
6767
pcap_g.cnt++;

src/stream-tcp-reassemble.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ uint64_t StreamTcpReassembleMemuseGlobalCounter(void)
163163
*/
164164
int StreamTcpReassembleCheckMemcap(uint64_t size)
165165
{
166-
#ifdef DEBUG
166+
#ifdef QA_SIMULATION
167167
if (unlikely((g_eps_stream_reassembly_memcap != UINT64_MAX &&
168168
g_eps_stream_reassembly_memcap == t_pcapcnt))) {
169169
SCLogNotice("simulating memcap reached condition for packet %" PRIu64, t_pcapcnt);

src/stream-tcp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ extern int g_detect_disabled;
220220

221221
PoolThread *ssn_pool = NULL;
222222
static SCMutex ssn_pool_mutex = SCMUTEX_INITIALIZER; /**< init only, protect initializing and growing pool */
223-
#ifdef DEBUG
223+
#if defined(DEBUG) || defined(QA_SIMULATION)
224224
static uint64_t ssn_pool_cnt = 0; /** counts ssns, protected by ssn_pool_mutex */
225225
#endif
226226

@@ -948,19 +948,20 @@ static TcpSession *StreamTcpNewSession(ThreadVars *tv, StreamTcpThread *stt, Pac
948948
#endif
949949
StatsIncr(tv, stt->counter_tcp_ssn_from_pool);
950950
}
951-
#ifdef DEBUG
951+
#if defined(DEBUG) || defined(QA_SIMULATION)
952952
SCMutexLock(&ssn_pool_mutex);
953953
if (p->flow->protoctx != NULL)
954954
ssn_pool_cnt++;
955955
SCMutexUnlock(&ssn_pool_mutex);
956-
956+
#ifdef QA_SIMULATION
957957
if (unlikely((g_eps_stream_ssn_memcap != UINT64_MAX &&
958958
g_eps_stream_ssn_memcap == t_pcapcnt))) {
959959
SCLogNotice("simulating memcap reached condition for packet %" PRIu64, t_pcapcnt);
960960
ExceptionPolicyApply(p, stream_config.ssn_memcap_policy, PKT_DROP_REASON_STREAM_MEMCAP);
961961
StreamTcpSsnMemcapExceptionPolicyStatsIncr(tv, stt, stream_config.ssn_memcap_policy);
962962
return NULL;
963963
}
964+
#endif
964965
#endif
965966
ssn = (TcpSession *)p->flow->protoctx;
966967
if (ssn == NULL) {

src/util-exception-policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co
390390
}
391391
}
392392

393-
#ifndef DEBUG
393+
#ifndef QA_SIMULATION
394394

395395
int ExceptionSimulationCommandLineParser(const char *name, const char *arg)
396396
{

src/util-exception-policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void ExceptionPolicySetStatsCounters(ThreadVars *tv, ExceptionPolicyCounters *co
3838
const char *default_str, bool (*isExceptionPolicyValid)(enum ExceptionPolicy));
3939

4040
extern enum ExceptionPolicy g_eps_master_switch;
41-
#ifdef DEBUG
41+
#ifdef QA_SIMULATION
4242
extern uint64_t g_eps_applayer_error_offset_ts;
4343
extern uint64_t g_eps_applayer_error_offset_tc;
4444
extern uint64_t g_eps_pcap_packet_loss;

0 commit comments

Comments
 (0)