From db42981a3ddc1a9789f86ed422e8f89eb38eb955 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 6 Oct 2011 19:24:46 +0200 Subject: [PATCH] Fix suricata start when no interface is given. When no interface was specified on command line, the workers and single mode where not able to start due to the fact there was no registered interfaces. --- src/runmode-pfring.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/runmode-pfring.c b/src/runmode-pfring.c index b1c002ece3..3938e1c3a1 100644 --- a/src/runmode-pfring.c +++ b/src/runmode-pfring.c @@ -38,6 +38,7 @@ #include "util-cpu.h" #include "util-affinity.h" #include "util-runmodes.h" +#include "util-device.h" static const char *default_mode_auto = NULL; static const char *default_mode_autofp = NULL; @@ -308,7 +309,6 @@ int PfringConfLevel() if (ConfGet("pfring.interface", &def_dev) != 1) { return PFRING_CONF_V2; } else { - SCLogInfo("Using 1.0 style configuration for pfring"); return PFRING_CONF_V1; } return PFRING_CONF_V2; @@ -323,12 +323,15 @@ static int GetDevAndParser(char **live_dev, ConfigIfaceParserFunc *parser) if (PfringConfLevel() > PFRING_CONF_V1) { *parser = ParsePfringConfig; } else { + SCLogInfo("Using 1.0 style configuration for pfring"); *parser = OldParsePfringConfig; /* In v1: try to get interface name from config */ - if (live_dev == NULL) { + if (*live_dev == NULL) { if (ConfGet("pfring.interface", live_dev) == 1) { SCLogInfo("Using interface %s", *live_dev); + LiveRegisterDevice(*live_dev); } else { + SCLogInfo("No interface found, problem incoming"); *live_dev = NULL; } } @@ -494,7 +497,7 @@ int RunModeIdsPfringWorkers(DetectEngineCtx *de_ctx) exit(EXIT_FAILURE); } - SCLogInfo("RunModeIdsPfringSingle initialised"); + SCLogInfo("RunModeIdsPfringWorkers initialised"); #endif /* HAVE_PFRING */ return 0;