From a01b3339c751fc5cd2f65031fdb7590aad528105 Mon Sep 17 00:00:00 2001 From: Mats Klepsland Date: Wed, 1 Oct 2014 16:34:30 +0200 Subject: [PATCH] runmode-pfring: Suppress errors when using DNA/ZC PF_RING DNA/ZC don't use cluster-id and cluster-type. Therefore, skip setting these values if DNA/ZC is being used. Bug #1048 --- src/runmode-pfring.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/runmode-pfring.c b/src/runmode-pfring.c index 358f25d56a..7d9b78498b 100644 --- a/src/runmode-pfring.c +++ b/src/runmode-pfring.c @@ -146,7 +146,12 @@ void *OldParsePfringConfig(const char *iface) SC_ATOMIC_RESET(pfconf->ref); (void) SC_ATOMIC_ADD(pfconf->ref, pfconf->threads); - if (ConfGet("pfring.cluster-id", &tmpclusterid) != 1) { + if (strncmp(pfconf->iface, "zc", 2) == 0) { + SCLogInfo("ZC interface detected, not setting cluster-id"); + } + else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { + SCLogInfo("DNA interface detected, not setting cluster-id"); + } else if (ConfGet("pfring.cluster-id", &tmpclusterid) != 1) { SCLogError(SC_ERR_INVALID_ARGUMENT,"Could not get cluster-id from config"); } else { pfconf->cluster_id = (uint16_t)atoi(tmpclusterid); @@ -154,7 +159,13 @@ void *OldParsePfringConfig(const char *iface) } #ifdef HAVE_PFRING_CLUSTER_TYPE - if (ConfGet("pfring.cluster-type", &tmpctype) != 1) { + if (strncmp(pfconf->iface, "zc", 2) == 0) { + SCLogInfo("ZC interface detected, not setting cluster type for PF_RING (iface %s)", + pfconf->iface); + } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { + SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)", + pfconf->iface); + } else if (ConfGet("pfring.cluster-type", &tmpctype) != 1) { SCLogError(SC_ERR_GET_CLUSTER_TYPE_FAILED,"Could not get cluster-type fron config"); } else if (strcmp(tmpctype, "cluster_round_robin") == 0) { SCLogInfo("Using round-robin cluster mode for PF_RING (iface %s)", @@ -271,7 +282,14 @@ void *ParsePfringConfig(const char *iface) SCLogDebug("Going to use command-line provided cluster-id %" PRId32, pfconf->cluster_id); } else { - if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-id", &tmpclusterid) != 1) { + + if (strncmp(pfconf->iface, "zc", 2) == 0) { + SCLogInfo("ZC interface detected, not setting cluster-id for PF_RING (iface %s)", + pfconf->iface); + } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { + SCLogInfo("DNA interface detected, not setting cluster-id for PF_RING (iface %s)", + pfconf->iface); + } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-id", &tmpclusterid) != 1) { SCLogError(SC_ERR_INVALID_ARGUMENT, "Could not get cluster-id from config"); } else { @@ -314,7 +332,13 @@ void *ParsePfringConfig(const char *iface) SCLogDebug("Going to use command-line provided cluster-type"); getctype = 1; } else { - if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-type", &tmpctype) != 1) { + if (strncmp(pfconf->iface, "zc", 2) == 0) { + SCLogInfo("ZC interface detected, not setting cluster type for PF_RING (iface %s)", + pfconf->iface); + } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { + SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)", + pfconf->iface); + } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-type", &tmpctype) != 1) { SCLogError(SC_ERR_GET_CLUSTER_TYPE_FAILED, "Could not get cluster-type fron config"); } else {