]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
afl: add define to disable mgt threads
authorVictor Julien <victor@inliniac.net>
Sat, 5 Dec 2015 13:29:14 +0000 (14:29 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 12 Apr 2016 13:19:59 +0000 (15:19 +0200)
The inherent non-deterministic nature of the management threads
creates variable test cases.

src/counters.c
src/flow-manager.c
src/suricata-common.h

index add05fca7904b696eee0f5b1db08490a5a387185..5e6d558c46fe379739ab1f20614809eb1b9fe90c 100644 (file)
@@ -221,6 +221,10 @@ static ConfNode *GetConfig(void) {
 static void StatsInitCtx(void)
 {
     SCEnter();
+#ifdef AFLFUZZ_DISABLE_MGTTHREADS
+    stats_enabled = FALSE;
+    SCReturn;
+#endif
     ConfNode *stats = GetConfig();
     if (stats != NULL) {
         const char *enabled = ConfNodeLookupChildValue(stats, "enabled");
index 4cd53aacd558d124e37684825528634f8d519ff4..9b9920eb4d1b004aa31eeab48322788b28fca069 100644 (file)
@@ -105,6 +105,9 @@ typedef struct FlowTimeoutCounters_ {
  */
 void FlowDisableFlowManagerThread(void)
 {
+#ifdef AFLFUZZ_DISABLE_MGTTHREADS
+    return;
+#endif
     ThreadVars *tv = NULL;
     int cnt = 0;
 
@@ -708,6 +711,9 @@ static uint64_t FlowGetMemuse(void)
 /** \brief spawn the flow manager thread */
 void FlowManagerThreadSpawn()
 {
+#ifdef AFLFUZZ_DISABLE_MGTTHREADS
+    return;
+#endif
     intmax_t setting = 1;
     (void)ConfGetInt("flow.managers", &setting);
 
@@ -868,6 +874,9 @@ int FlowRecyclerReadyToShutdown(void)
 /** \brief spawn the flow recycler thread */
 void FlowRecyclerThreadSpawn()
 {
+#ifdef AFLFUZZ_DISABLE_MGTTHREADS
+    return;
+#endif
     intmax_t setting = 1;
     (void)ConfGetInt("flow.recyclers", &setting);
 
@@ -917,6 +926,9 @@ void FlowRecyclerThreadSpawn()
  */
 void FlowDisableFlowRecyclerThread(void)
 {
+#ifdef AFLFUZZ_DISABLE_MGTTHREADS
+    return;
+#endif
     ThreadVars *tv = NULL;
     int cnt = 0;
 
index 4910c4185d7c5592aef72b3b363b6bd78a88c443..ff8d51472529b10aeef1c8dac5dbda4241091507 100644 (file)
 #endif
 
 #define AFLFUZZ_NO_RANDOM 1
+#define AFLFUZZ_DISABLE_MGTTHREADS 1
 
 /* we need this to stringify the defines which are supplied at compiletime see:
    http://gcc.gnu.org/onlinedocs/gcc-3.4.1/cpp/Stringification.html#Stringification */