]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow-bypass: only start thread on demand
authorEric Leblond <eric@regit.org>
Fri, 29 Sep 2017 20:24:08 +0000 (22:24 +0200)
committerEric Leblond <eric@regit.org>
Tue, 6 Feb 2018 15:57:55 +0000 (16:57 +0100)
src/runmode-af-packet.c
src/runmodes.c
src/runmodes.h

index 6ad2e7339ad23c05d649248eb36e46b2eb79b1a4..454499d9c0c348391fdd84ecc4a7fc4531e0c390 100644 (file)
@@ -404,6 +404,7 @@ static void *ParseAFPConfig(const char *iface)
             SCLogConfig("Using bypass kernel functionality for AF_PACKET (iface %s)",
                     aconf->iface);
             aconf->flags |= AFP_BYPASS;
+            RunModeEnablesBypassManager();
         }
     }
 
index 1435956adf84f3a8eadfda4464df9500343431bd..53b8bbda63e2ba25ef17894d5e1315b69acfe2a3 100644 (file)
@@ -381,11 +381,27 @@ void RunModeDispatch(int runmode, const char *custom_mode)
         /* spawn management threads */
         FlowManagerThreadSpawn();
         FlowRecyclerThreadSpawn();
-        BypassedFlowManagerThreadSpawn();
+        if (RunModeNeedsBypassManager()) {
+            BypassedFlowManagerThreadSpawn();
+        }
         StatsSpawnThreads();
     }
 }
 
+static int g_runmode_needs_bypass = 0;
+
+void RunModeEnablesBypassManager(void)
+{
+    g_runmode_needs_bypass = 1;
+}
+
+int RunModeNeedsBypassManager(void)
+{
+    return g_runmode_needs_bypass;
+}
+
+
+
 /**
  * \brief Registers a new runmode.
  *
index 0329c638b296cd1aba7ddafc5035c6f1f0979d82..f0bb7735f57f6269c70cbaa81bbc539fd70424be 100644 (file)
@@ -90,6 +90,9 @@ int RunModeOutputFiledataEnabled(void);
 /** bool indicating if run mode is offline */
 bool IsRunModeOffline(int run_mode_to_check);
 
+void RunModeEnablesBypassManager(void);
+int RunModeNeedsBypassManager(void);
+
 #include "runmode-pcap.h"
 #include "runmode-pcap-file.h"
 #include "runmode-pfring.h"