From: Giuseppe Longo Date: Sat, 1 Feb 2014 10:34:33 +0000 (+0100) Subject: Adds nflog option X-Git-Tag: suricata-2.0.2~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4dda018ededee36f97b0d35d6a9cb1e5ffbd5219;p=thirdparty%2Fsuricata.git Adds nflog option --- diff --git a/src/suricata.c b/src/suricata.c index 69c4b474e2..013fac6194 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -101,6 +101,8 @@ #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;