]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Adds nflog option
authorGiuseppe Longo <giuseppelng@gmail.com>
Sat, 1 Feb 2014 10:34:33 +0000 (11:34 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 23 May 2014 10:42:52 +0000 (12:42 +0200)
src/suricata.c

index 69c4b474e28dfdc46dc6cc9cab0a6e46f7469ed0..013fac6194de7ecc95bb2006a1989ad9d0757137 100644 (file)
 #include "source-nfq.h"
 #include "source-nfq-prototypes.h"
 
+#include "source-nflog.h"
+
 #include "source-ipfw.h"
 
 #include "source-pcap.h"
@@ -857,6 +859,9 @@ void RegisterAllModules()
     TmModuleFileLoggerRegister();
     TmModuleFiledataLoggerRegister();
     TmModuleDebugList();
+    /* nflog */
+    TmModuleReceiveNFLOGRegister();
+    TmModuleDecodeNFLOGRegister();
 
 }
 
@@ -947,6 +952,14 @@ static TmEcode ParseInterfacesList(int run_mode, char *pcap_dev)
                 SCReturnInt(TM_ECODE_FAILED);
             }
         }
+#ifdef HAVE_NFLOG
+    } else if (run_mode == RUNMODE_NFLOG) {
+        int ret = LiveBuildDeviceListCustom("nflog", "group");
+        if (ret == 0) {
+            SCLogError(SC_ERR_INITIALIZATION, "No group found in config for nflog");
+            SCReturnInt(TM_ECODE_FAILED);
+        }
+#endif
     }
 
     SCReturnInt(TM_ECODE_OK);
@@ -1086,6 +1099,9 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
         {"mpipe", optional_argument, 0, 0},
 #endif
         {"set", required_argument, 0, 0},
+#ifdef HAVE_NFLOG
+        {"nflog", optional_argument, 0, 0},
+#endif
         {NULL, 0, NULL, 0}
     };
 
@@ -1170,6 +1186,16 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                         "configure when building.");
                 return TM_ECODE_FAILED;
 #endif
+            } else if (strcmp((long_opts[option_index]).name, "nflog") == 0) {
+#ifdef HAVE_NFLOG
+                if (suri->run_mode == RUNMODE_UNKNOWN) {
+                    suri->run_mode = RUNMODE_NFLOG;
+                    LiveBuildDeviceListCustom("nflog", "group");
+                }
+#else
+                SCLogError(SC_ERR_NFLOG_NOSUPPORT, "NFLOG not enabled.");
+                return TM_ECODE_FAILED;
+#endif /* HAVE_NFLOG */
             } else if (strcmp((long_opts[option_index]).name , "pcap") == 0) {
                 if (suri->run_mode == RUNMODE_UNKNOWN) {
                     suri->run_mode = RUNMODE_PCAP_DEV;