diff --git a/src/runmode-pfring.c b/src/runmode-pfring.c index de4ed65a76..02cad36b33 100644 --- a/src/runmode-pfring.c +++ b/src/runmode-pfring.c @@ -106,7 +106,7 @@ void *OldParsePfringConfig(const char *iface) char *tmpclusterid; #ifdef HAVE_PFRING_CLUSTER_TYPE char *tmpctype = NULL; - char * default_ctype = SCStrdup("cluster_round_robin"); + cluster_type default_ctype = CLUSTER_ROUND_ROBIN; #endif if (iface == NULL) { @@ -120,7 +120,7 @@ void *OldParsePfringConfig(const char *iface) pfconf->threads = 1; pfconf->cluster_id = 1; #ifdef HAVE_PFRING_CLUSTER_TYPE - pfconf->ctype = (cluster_type)default_ctype; + pfconf->ctype = default_ctype; #endif pfconf->DerefFunc = PfringDerefConfig; SC_ATOMIC_INIT(pfconf->ref); @@ -190,8 +190,7 @@ void *ParsePfringConfig(const char *iface) char *tmpclusterid; #ifdef HAVE_PFRING_CLUSTER_TYPE char *tmpctype = NULL; - /* TODO free me */ - char * default_ctype = SCStrdup("cluster_round_robin"); + cluster_type default_ctype = CLUSTER_ROUND_ROBIN; int getctype = 0; #endif @@ -276,11 +275,11 @@ void *ParsePfringConfig(const char *iface) if (strcmp(tmpctype, "cluster_round_robin") == 0) { SCLogInfo("Using round-robin cluster mode for PF_RING (iface %s)", pfconf->iface); - pfconf->ctype = (cluster_type)tmpctype; + pfconf->ctype = CLUSTER_ROUND_ROBIN; } else if (strcmp(tmpctype, "cluster_flow") == 0) { SCLogInfo("Using flow cluster mode for PF_RING (iface %s)", pfconf->iface); - pfconf->ctype = (cluster_type)tmpctype; + pfconf->ctype = CLUSTER_FLOW; } else { SCLogError(SC_ERR_INVALID_CLUSTER_TYPE, "invalid cluster-type %s", diff --git a/src/source-pfring.c b/src/source-pfring.c index 1fdccec574..5f1b5c5019 100644 --- a/src/source-pfring.c +++ b/src/source-pfring.c @@ -276,7 +276,6 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, void *initdata, void **data) { int rc; u_int32_t version = 0; char *tmpclusterid; - char *tmpctype; PfringIfaceConfig *pfconf = (PfringIfaceConfig *) initdata; @@ -313,7 +312,7 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, void *initdata, void **data) { ptv->cluster_id = pfconf->cluster_id; #ifdef HAVE_PFRING_CLUSTER_TYPE - ptv->ctype = (cluster_type)SCStrdup((char *)pfconf->ctype); + ptv->ctype = pfconf->ctype; rc = pfring_set_cluster(ptv->pd, ptv->cluster_id, ptv->ctype); #else rc = pfring_set_cluster(ptv->pd, ptv->cluster_id); @@ -383,10 +382,6 @@ TmEcode ReceivePfringThreadDeinit(ThreadVars *tv, void *data) { PfringThreadVars *ptv = (PfringThreadVars *)data; if (ptv->interface) SCFree(ptv->interface); -#ifdef HAVE_PFRING_CLUSTER_TYPE - if (ptv->ctype) - SCFree((char *)ptv->ctype); -#endif pfring_remove_from_cluster(ptv->pd); pfring_close(ptv->pd); return TM_ECODE_OK; diff --git a/src/source-pfring.h b/src/source-pfring.h index f39d8d8334..14ce12254d 100644 --- a/src/source-pfring.h +++ b/src/source-pfring.h @@ -53,4 +53,8 @@ void TmModuleDecodePfringRegister (void); int PfringConfGetThreads(void); void PfringLoadConfig(void); +/* We don't have to use an enum that sucks in our code */ +#define CLUSTER_FLOW 0 +#define CLUSTER_ROUND_ROBIN 1 + #endif /* __SOURCE_PFRING_H__ */