]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
nflog: fix missing util-time include; cleanups
authorVictor Julien <vjulien@oisf.net>
Thu, 28 Jul 2022 19:38:46 +0000 (21:38 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 1 Aug 2022 06:06:24 +0000 (08:06 +0200)
src/runmode-nflog.c
src/runmode-nflog.h

index 90b28fa4f4742491595a61488bf00164c96ec089..fe795764c069bbd08a68c79769a76b966d1b6043 100644 (file)
 
 #include "source-nflog.h"
 
-const char *RunModeIdsNflogGetDefaultMode(void)
-{
-    return "autofp";
-}
-
-void RunModeIdsNflogRegister(void)
-{
-    RunModeRegisterNewRunMode(RUNMODE_NFLOG, "autofp",
-                              "Multi threaded nflog mode",
-                              RunModeIdsNflogAutoFp);
-    RunModeRegisterNewRunMode(RUNMODE_NFLOG, "single",
-                              "Single threaded nflog mode",
-                              RunModeIdsNflogSingle);
-    RunModeRegisterNewRunMode(RUNMODE_NFLOG, "workers",
-                              "Workers nflog mode",
-                              RunModeIdsNflogWorkers);
-    return;
-}
-
 #ifdef HAVE_NFLOG
+#include "util-time.h"
+
 static void NflogDerefConfig(void *data)
 {
     NflogGroupConfig *nflogconf = (NflogGroupConfig *)data;
@@ -165,23 +148,16 @@ static int NflogConfigGeThreadsCount(void *conf)
 }
 #endif
 
-int RunModeIdsNflogAutoFp(void)
+static int RunModeIdsNflogAutoFp(void)
 {
     SCEnter();
 
 #ifdef HAVE_NFLOG
-    int ret = 0;
-    char *live_dev = NULL;
-
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig,
-                                      NflogConfigGeThreadsCount,
-                                      "ReceiveNFLOG",
-                                      "DecodeNFLOG",
-                                      thread_name_autofp,
-                                      live_dev);
+    int ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig, NflogConfigGeThreadsCount,
+            "ReceiveNFLOG", "DecodeNFLOG", thread_name_autofp, NULL);
     if (ret != 0) {
         FatalError(SC_ERR_FATAL, "Unable to start runmode");
     }
@@ -192,23 +168,16 @@ int RunModeIdsNflogAutoFp(void)
     SCReturnInt(0);
 }
 
-int RunModeIdsNflogSingle(void)
+static int RunModeIdsNflogSingle(void)
 {
     SCEnter();
 
 #ifdef HAVE_NFLOG
-    int ret = 0;
-    char *live_dev = NULL;
-
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureSingle(ParseNflogConfig,
-                                      NflogConfigGeThreadsCount,
-                                      "ReceiveNFLOG",
-                                      "DecodeNFLOG",
-                                      thread_name_single,
-                                      live_dev);
+    int ret = RunModeSetLiveCaptureSingle(ParseNflogConfig, NflogConfigGeThreadsCount,
+            "ReceiveNFLOG", "DecodeNFLOG", thread_name_single, NULL);
     if (ret != 0) {
         FatalError(SC_ERR_FATAL, "Unable to start runmode");
     }
@@ -219,23 +188,16 @@ int RunModeIdsNflogSingle(void)
     SCReturnInt(0);
 }
 
-int RunModeIdsNflogWorkers(void)
+static int RunModeIdsNflogWorkers(void)
 {
     SCEnter();
 
 #ifdef HAVE_NFLOG
-    int ret = 0;
-    char *live_dev = NULL;
-
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig,
-                                       NflogConfigGeThreadsCount,
-                                       "ReceiveNFLOG",
-                                       "DecodeNFLOG",
-                                       thread_name_workers,
-                                       live_dev);
+    int ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig, NflogConfigGeThreadsCount,
+            "ReceiveNFLOG", "DecodeNFLOG", thread_name_workers, NULL);
     if (ret != 0) {
         FatalError(SC_ERR_FATAL, "Unable to start runmode");
     }
@@ -245,3 +207,19 @@ int RunModeIdsNflogWorkers(void)
 
     SCReturnInt(0);
 }
+
+const char *RunModeIdsNflogGetDefaultMode(void)
+{
+    return "autofp";
+}
+
+void RunModeIdsNflogRegister(void)
+{
+    RunModeRegisterNewRunMode(
+            RUNMODE_NFLOG, "autofp", "Multi threaded nflog mode", RunModeIdsNflogAutoFp);
+    RunModeRegisterNewRunMode(
+            RUNMODE_NFLOG, "single", "Single threaded nflog mode", RunModeIdsNflogSingle);
+    RunModeRegisterNewRunMode(
+            RUNMODE_NFLOG, "workers", "Workers nflog mode", RunModeIdsNflogWorkers);
+    return;
+}
index 2897f068180e6d94ac923a5463742704e96cd152..034a074cb99690981d6b018b36dc2a3b6004bce9 100644 (file)
@@ -23,9 +23,6 @@
 #ifndef __RUNMODE_NFLOG_H__
 #define __RUNMODE_NFLOG_H__
 
-int RunModeIdsNflogAutoFp(void);
-int RunModeIdsNflogSingle(void);
-int RunModeIdsNflogWorkers(void);
 void RunModeIdsNflogRegister(void);
 const char *RunModeIdsNflogGetDefaultMode(void);