Fix coding style and use SC* function.

This patch fixes the coding style and uses Suricata function instead
of plain lic version.
remotes/origin/master-1.1.x
Eric Leblond 14 years ago
parent f998fda4dd
commit d3d99ffa13

@ -123,7 +123,7 @@ void *ParsePcapConfig(const char *iface)
SCLogDebug("could not get bpf or none specified");
} else {
/* TODO free this */
aconf->bpf_filter = strdup(tmpbpf);
aconf->bpf_filter = SCStrdup(tmpbpf);
}
} else {
SCLogInfo("BPF filter set from command line or via old 'bpf-filter' option.");

@ -95,7 +95,7 @@ void *OldParsePfringConfig(const char *iface)
char *tmpclusterid;
#ifdef HAVE_PFRING_CLUSTER_TYPE
char *tmpctype = NULL;
char * default_ctype = strdup("cluster_round_robin");
char * default_ctype = SCStrdup("cluster_round_robin");
#endif
if (iface == NULL) {
@ -173,7 +173,7 @@ void *ParsePfringConfig(const char *iface)
#ifdef HAVE_PFRING_CLUSTER_TYPE
char *tmpctype = NULL;
/* TODO free me */
char * default_ctype = strdup("cluster_round_robin");
char * default_ctype = SCStrdup("cluster_round_robin");
int getctype = 0;
#endif

@ -364,7 +364,7 @@ TmEcode ReceivePcapThreadInit(ThreadVars *tv, void *initdata, void **data) {
/* set bpf filter if we have one */
if (pcapconfig->bpf_filter) {
ptv->bpf_filter = strdup(pcapconfig->bpf_filter);
ptv->bpf_filter = SCStrdup(pcapconfig->bpf_filter);
if(pcap_compile(ptv->pcap_handle,&ptv->filter,ptv->bpf_filter,1,0) < 0) {
SCLogError(SC_ERR_BPF,"bpf compilation error %s",pcap_geterr(ptv->pcap_handle));
SCFree(ptv);
@ -419,7 +419,7 @@ TmEcode ReceivePcapThreadInit(ThreadVars *tv, void *initdata, void **data) {
/* set bpf filter if we have one */
if (pcapconfig->bpf_filter) {
ptv->bpf_filter = strdup(pcapconfig->bpf_filter);
ptv->bpf_filter = SCStrdup(pcapconfig->bpf_filter);
SCLogInfo("using bpf-filter \"%s\"", ptv->bpf_filter);
if(pcap_compile(ptv->pcap_handle,&ptv->filter, ptv->bpf_filter,1,0) < 0) {

@ -283,7 +283,7 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, void *initdata, void **data) {
ptv->tv = tv;
ptv->threads = 1;
ptv->interface = strdup(pfconf->iface);
ptv->interface = SCStrdup(pfconf->iface);
ptv->pd = pfring_open(ptv->interface, LIBPFRING_PROMISC, (uint32_t)default_packet_size, LIBPFRING_REENTRANT);
if (ptv->pd == NULL) {
@ -302,7 +302,7 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, void *initdata, void **data) {
ptv->cluster_id = pfconf->cluster_id;
#ifdef HAVE_PFRING_CLUSTER_TYPE
ptv->ctype = (cluster_type)strdup((char *)pfconf->ctype);
ptv->ctype = (cluster_type)SCStrdup((char *)pfconf->ctype);
rc = pfring_set_cluster(ptv->pd, ptv->cluster_id, ptv->ctype);
#else
rc = pfring_set_cluster(ptv->pd, ptv->cluster_id);

@ -52,7 +52,7 @@
#include "util-runmodes.h"
int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc configparser, char *recv_mod_name,
ConfigIfaceParserFunc ConfigParser, char *recv_mod_name,
char *decode_mod_name, char *thread_name,
const char *live_dev)
{
@ -71,7 +71,7 @@ int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
}
SCLogDebug("live_dev %s", live_dev);
aconf = configparser(live_dev);
aconf = ConfigParser(live_dev);
if (aconf == NULL) {
printf("Single dev: Failed to allocate config\n");
exit(EXIT_FAILURE);
@ -114,7 +114,7 @@ int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
}
SCLogDebug("live_dev %s", live_dev);
aconf = configparser(live_dev);
aconf = ConfigParser(live_dev);
if (aconf == NULL) {
printf("Failed to allocate config for %s (%d)\n",
live_dev, thread);
@ -375,7 +375,7 @@ int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
}
int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc configparser,
ConfigIfaceParserFunc ConfigParser,
ConfigIfaceThreadsCountFunc mod_threads_count,
char *recv_mod_name,
char *decode_mod_name, char *thread_name,
@ -410,7 +410,7 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
SCLogDebug("live_dev %s", live_dev);
aconf = configparser(live_dev);
aconf = ConfigParser(live_dev);
if (aconf == NULL) {
printf("Failed to allocate config for %s (%d)\n",
live_dev, thread);
@ -470,7 +470,7 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
}
SCLogDebug("live_dev %s", live_dev);
aconf = configparser(live_dev);
aconf = ConfigParser(live_dev);
if (aconf == NULL) {
printf("Multidev: Failed to allocate config for %s (%d)\n",
live_dev, lthread);
@ -568,7 +568,7 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
}
int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc configparser,
ConfigIfaceParserFunc ConfigParser,
ConfigIfaceThreadsCountFunc mod_threads_count,
char *recv_mod_name,
char *decode_mod_name, char *thread_name,
@ -586,10 +586,10 @@ int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
}
if (live_dev != NULL) {
aconf = configparser(live_dev);
aconf = ConfigParser(live_dev);
} else {
char *live_dev_c = LiveGetDevice(0);
aconf = configparser(live_dev_c);
aconf = ConfigParser(live_dev_c);
}
threads_count = mod_threads_count(aconf);

Loading…
Cancel
Save