Do not use underscored config vars internally.

remotes/origin/master
Nikolay Denev 15 years ago committed by Victor Julien
parent 6819ec8b54
commit 139768dd58

@ -838,8 +838,8 @@ OutputCtx *AlertPreludeInitCtx(ConfNode *conf)
if (prelude_profile_name == NULL)
prelude_profile_name = DEFAULT_PRELUDE_PROFILE;
log_packet_content = ConfNodeLookupChildValue(conf, "log_packet_content");
log_packet_header = ConfNodeLookupChildValue(conf, "log_packet_header");
log_packet_content = ConfNodeLookupChildValue(conf, "log-packet-content");
log_packet_header = ConfNodeLookupChildValue(conf, "log-packet-header");
ret = prelude_client_new(&client, prelude_profile_name);
if ( ret < 0 || ! client ) {

@ -892,7 +892,7 @@ void RegisterSSLParsers(void)
AppLayerRegisterStateFuncs(ALPROTO_TLS, SSLStateAlloc, SSLStateFree);
/* Get the value of no reassembly option from the config file */
if (ConfGetBool("tls.no_reassemble", &ssl_config.no_reassemble) != 1)
if (ConfGetBool("tls.no-reassemble", &ssl_config.no_reassemble) != 1)
ssl_config.no_reassemble = 1;
return;

@ -75,7 +75,7 @@ DetectEngineCtx *DetectEngineCtxInit(void) {
memset(de_ctx,0,sizeof(DetectEngineCtx));
if (ConfGetBool("engine.init_failure_fatal", (int *)&(de_ctx->failure_fatal)) != 1) {
if (ConfGetBool("engine.init-failure-fatal", (int *)&(de_ctx->failure_fatal)) != 1) {
SCLogDebug("ConfGetBool could not load the value.");
}

@ -838,22 +838,22 @@ void FlowInitConfig(char quiet)
/* If we have specific config, overwrite the defaults with them,
* otherwise, leave the default values */
intmax_t val = 0;
if (ConfGetInt("flow.emergency_recovery", &val) == 1) {
if (ConfGetInt("flow.emergency-recovery", &val) == 1) {
if (val <= 100 && val >= 1) {
flow_config.emergency_recovery = (uint8_t)val;
} else {
SCLogError(SC_ERR_INVALID_VALUE, "flow.emergency_recovery must be in the range of 1 and 100 (as percentage)");
SCLogError(SC_ERR_INVALID_VALUE, "flow.emergency-recovery must be in the range of 1 and 100 (as percentage)");
flow_config.emergency_recovery = FLOW_DEFAULT_EMERGENCY_RECOVERY;
}
} else {
SCLogDebug("flow.emergency_recovery, using default value");
SCLogDebug("flow.emergency-recovery, using default value");
flow_config.emergency_recovery = FLOW_DEFAULT_EMERGENCY_RECOVERY;
}
if (ConfGetInt("flow.prune_flows", &val) == 1) {
if (ConfGetInt("flow.prune-flows", &val) == 1) {
flow_config.flow_try_release = (uint8_t)val;
} else {
SCLogDebug("flow.flow.prune_flows, using default value");
SCLogDebug("flow.flow.prune-flows, using default value");
flow_config.flow_try_release = FLOW_DEFAULT_FLOW_PRUNE;
}
@ -871,7 +871,7 @@ void FlowInitConfig(char quiet)
exit(EXIT_FAILURE);
}
}
if ((ConfGet("flow.hash_size", &conf_val)) == 1)
if ((ConfGet("flow.hash-size", &conf_val)) == 1)
{
if (ByteExtractStringUint32(&configval, 10, strlen(conf_val),
conf_val) > 0) {
@ -885,7 +885,7 @@ void FlowInitConfig(char quiet)
flow_config.prealloc = configval;
}
}
SCLogDebug("Flow config from suricata.yaml: memcap: %"PRIu64", hash_size: "
SCLogDebug("Flow config from suricata.yaml: memcap: %"PRIu64", hash-size: "
"%"PRIu32", prealloc: %"PRIu32, flow_config.memcap,
flow_config.hash_size, flow_config.prealloc);
@ -1113,11 +1113,11 @@ void FlowInitFlowProto(void)
new = ConfNodeLookupChildValue(proto, "new");
established = ConfNodeLookupChildValue(proto, "established");
closed = ConfNodeLookupChildValue(proto, "closed");
emergency_new = ConfNodeLookupChildValue(proto, "emergency_new");
emergency_new = ConfNodeLookupChildValue(proto, "emergency-new");
emergency_established = ConfNodeLookupChildValue(proto,
"emergency_established");
"emergency-established");
emergency_closed = ConfNodeLookupChildValue(proto,
"emergency_closed");
"emergency-closed");
if (new != NULL &&
ByteExtractStringUint32(&configval, 10, strlen(new), new) > 0) {
@ -1164,11 +1164,11 @@ void FlowInitFlowProto(void)
new = ConfNodeLookupChildValue(proto, "new");
established = ConfNodeLookupChildValue(proto, "established");
closed = ConfNodeLookupChildValue(proto, "closed");
emergency_new = ConfNodeLookupChildValue(proto, "emergency_new");
emergency_new = ConfNodeLookupChildValue(proto, "emergency-new");
emergency_established = ConfNodeLookupChildValue(proto,
"emergency_established");
"emergency-established");
emergency_closed = ConfNodeLookupChildValue(proto,
"emergency_closed");
"emergency-closed");
if (new != NULL &&
ByteExtractStringUint32(&configval, 10, strlen(new), new) > 0) {
@ -1214,9 +1214,9 @@ void FlowInitFlowProto(void)
if (proto != NULL) {
new = ConfNodeLookupChildValue(proto, "new");
established = ConfNodeLookupChildValue(proto, "established");
emergency_new = ConfNodeLookupChildValue(proto, "emergency_new");
emergency_new = ConfNodeLookupChildValue(proto, "emergency-new");
emergency_established = ConfNodeLookupChildValue(proto,
"emergency_established");
"emergency-established");
if (new != NULL &&
ByteExtractStringUint32(&configval, 10, strlen(new), new) > 0) {
@ -1248,9 +1248,9 @@ void FlowInitFlowProto(void)
if (proto != NULL) {
new = ConfNodeLookupChildValue(proto, "new");
established = ConfNodeLookupChildValue(proto, "established");
emergency_new = ConfNodeLookupChildValue(proto, "emergency_new");
emergency_new = ConfNodeLookupChildValue(proto, "emergency-new");
emergency_established = ConfNodeLookupChildValue(proto,
"emergency_established");
"emergency-established");
if (new != NULL &&
ByteExtractStringUint32(&configval, 10, strlen(new), new) > 0) {

@ -72,8 +72,8 @@ int RunModeErfDagAuto(DetectEngineCtx *de_ctx)
RunModeInitialize();
char *iface = NULL;
if (ConfGet("erf_dag.iface", &iface) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving pcap_file from Conf");
if (ConfGet("erf-dag.iface", &iface) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving erf-dag.iface from Conf");
exit(EXIT_FAILURE);
}
SCLogDebug("iface %s", iface);

@ -64,8 +64,8 @@ int RunModeErfFileAuto(DetectEngineCtx *de_ctx)
RunModeInitialize();
char *file = NULL;
if (ConfGet("erf_file.file", &file) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving erf_file.file "
if (ConfGet("erf-file.file", &file) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving erf-file.file "
"from Conf");
exit(EXIT_FAILURE);
}

@ -69,7 +69,7 @@ void RunModeFilePcapRegister(void)
int RunModeFilePcapSingle(DetectEngineCtx *de_ctx)
{
char *file = NULL;
if (ConfGet("pcap_file.file", &file) == 0) {
if (ConfGet("pcap-file.file", &file) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving pcap_file from Conf");
exit(EXIT_FAILURE);
}
@ -154,7 +154,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx)
uint16_t ncpus = UtilCpuGetNumProcessorsOnline();
char *file = NULL;
if (ConfGet("pcap_file.file", &file) == 0) {
if (ConfGet("pcap-file.file", &file) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving pcap_file from Conf");
exit(EXIT_FAILURE);
}
@ -407,7 +407,7 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx)
SCLogDebug("queues %s", queues);
char *file = NULL;
if (ConfGet("pcap_file.file", &file) == 0) {
if (ConfGet("pcap-file.file", &file) == 0) {
SCLogError(SC_ERR_RUNMODE, "Failed retrieving pcap_file from Conf");
exit(EXIT_FAILURE);
}

@ -178,7 +178,7 @@ int RunModeIdsPcapSingle(DetectEngineCtx *de_ctx)
RunModeInitialize();
TimeModeSetLive();
ConfGet("pcap.single_pcap_dev", &live_dev);
ConfGet("pcap.single-pcap-dev", &live_dev);
ret = RunModeSetLiveCaptureSingle(de_ctx,
ParsePcapConfig,
@ -226,7 +226,7 @@ int RunModeIdsPcapAuto(DetectEngineCtx *de_ctx)
RunModeInitialize();
TimeModeSetLive();
ConfGet("pcap.single_pcap_dev", &live_dev);
ConfGet("pcap.single-pcap-dev", &live_dev);
ret = RunModeSetLiveCaptureAuto(de_ctx,
ParsePcapConfig,
@ -270,7 +270,7 @@ int RunModeIdsPcapAutoFp(DetectEngineCtx *de_ctx)
RunModeInitialize();
TimeModeSetLive();
ConfGet("pcap.single_pcap_dev", &live_dev);
ConfGet("pcap.single-pcap-dev", &live_dev);
ret = RunModeSetLiveCaptureAutoFp(de_ctx,
ParsePcapConfig,

@ -436,16 +436,16 @@ float threading_detect_ratio = 1;
void RunModeInitialize(void)
{
threading_set_cpu_affinity = FALSE;
if ((ConfGetBool("threading.set_cpu_affinity", &threading_set_cpu_affinity)) == 0) {
if ((ConfGetBool("threading.set-cpu-affinity", &threading_set_cpu_affinity)) == 0) {
threading_set_cpu_affinity = FALSE;
}
/* try to get custom cpu mask value if needed */
if (threading_set_cpu_affinity == TRUE) {
AffinitySetupLoadFromConfig();
}
if ((ConfGetFloat("threading.detect_thread_ratio", &threading_detect_ratio)) != 1) {
if ((ConfGetFloat("threading.detect-thread-ratio", &threading_detect_ratio)) != 1) {
threading_detect_ratio = 1;
}
SCLogDebug("threading_detect_ratio %f", threading_detect_ratio);
SCLogDebug("threading.detect-thread-ratio %f", threading_detect_ratio);
}

@ -225,15 +225,15 @@ void NFQInitConfig(char quiet)
}
}
if ((ConfGetInt("nfq.repeat_mark", &value)) == 1) {
if ((ConfGetInt("nfq.repeat-mark", &value)) == 1) {
nfq_config.mark = (uint32_t)value;
}
if ((ConfGetInt("nfq.repeat_mask", &value)) == 1) {
if ((ConfGetInt("nfq.repeat-mask", &value)) == 1) {
nfq_config.mask = (uint32_t)value;
}
if ((ConfGetInt("nfq.route_queue", &value)) == 1) {
if ((ConfGetInt("nfq.route-queue", &value)) == 1) {
nfq_config.next_queue = ((uint32_t)value) << 16;
}

@ -337,7 +337,7 @@ void StreamTcpInitConfig(char quiet)
memset(&stream_config, 0, sizeof(stream_config));
/** set config defaults */
if ((ConfGetInt("stream.max_sessions", &value)) == 1) {
if ((ConfGetInt("stream.max-sessions", &value)) == 1) {
stream_config.max_sessions = (uint32_t)value;
} else {
if (RunmodeIsUnittests())
@ -346,10 +346,10 @@ void StreamTcpInitConfig(char quiet)
stream_config.max_sessions = STREAMTCP_DEFAULT_SESSIONS;
}
if (!quiet) {
SCLogInfo("stream \"max_sessions\": %"PRIu32"", stream_config.max_sessions);
SCLogInfo("stream \"max-sessions\": %"PRIu32"", stream_config.max_sessions);
}
if ((ConfGetInt("stream.prealloc_sessions", &value)) == 1) {
if ((ConfGetInt("stream.prealloc-sessions", &value)) == 1) {
stream_config.prealloc_sessions = (uint32_t)value;
} else {
if (RunmodeIsUnittests())
@ -358,7 +358,7 @@ void StreamTcpInitConfig(char quiet)
stream_config.prealloc_sessions = STREAMTCP_DEFAULT_PREALLOC;
}
if (!quiet) {
SCLogInfo("stream \"prealloc_sessions\": %"PRIu32"", stream_config.prealloc_sessions);
SCLogInfo("stream \"prealloc-sessions\": %"PRIu32"", stream_config.prealloc_sessions);
}
char *temp_stream_memcap_str;
@ -383,15 +383,15 @@ void StreamTcpInitConfig(char quiet)
SCLogInfo("stream \"midstream\" session pickups: %s", stream_config.midstream ? "enabled" : "disabled");
}
ConfGetBool("stream.async_oneside", &stream_config.async_oneside);
ConfGetBool("stream.async-oneside", &stream_config.async_oneside);
if (!quiet) {
SCLogInfo("stream \"async_oneside\": %s", stream_config.async_oneside ? "enabled" : "disabled");
SCLogInfo("stream \"async-oneside\": %s", stream_config.async_oneside ? "enabled" : "disabled");
}
int csum = 0;
if ((ConfGetBool("stream.checksum_validation", &csum)) == 1) {
if ((ConfGetBool("stream.checksum-validation", &csum)) == 1) {
if (csum == 1) {
stream_config.flags |= STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION;
}
@ -401,7 +401,7 @@ void StreamTcpInitConfig(char quiet)
}
if (!quiet) {
SCLogInfo("stream \"checksum_validation\": %s",
SCLogInfo("stream \"checksum-validation\": %s",
stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION ?
"enabled" : "disabled");
}
@ -453,12 +453,12 @@ void StreamTcpInitConfig(char quiet)
}
char *temp_stream_reassembly_toserver_chunk_size_str;
if (ConfGet("stream.reassembly.toserver_chunk_size",
if (ConfGet("stream.reassembly.toserver-chunk-size",
&temp_stream_reassembly_toserver_chunk_size_str) == 1) {
if (ParseSizeStringU16(temp_stream_reassembly_toserver_chunk_size_str,
&stream_config.reassembly_toserver_chunk_size) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
"stream.reassembly.toserver_chunk_size "
"stream.reassembly.toserver-chunk-size "
"from conf file - %s. Killing engine",
temp_stream_reassembly_toserver_chunk_size_str);
exit(EXIT_FAILURE);
@ -471,12 +471,12 @@ void StreamTcpInitConfig(char quiet)
stream_config.reassembly_toserver_chunk_size);
char *temp_stream_reassembly_toclient_chunk_size_str;
if (ConfGet("stream.reassembly.toclient_chunk_size",
if (ConfGet("stream.reassembly.toclient-chunk-size",
&temp_stream_reassembly_toclient_chunk_size_str) == 1) {
if (ParseSizeStringU16(temp_stream_reassembly_toclient_chunk_size_str,
&stream_config.reassembly_toclient_chunk_size) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
"stream.reassembly.toclient_chunk_size "
"stream.reassembly.toclient-chunk-size "
"from conf file - %s. Killing engine",
temp_stream_reassembly_toclient_chunk_size_str);
exit(EXIT_FAILURE);
@ -489,9 +489,9 @@ void StreamTcpInitConfig(char quiet)
stream_config.reassembly_toclient_chunk_size);
if (!quiet) {
SCLogInfo("stream.reassembly \"toserver_chunk_size\": %"PRIu16,
SCLogInfo("stream.reassembly \"toserver-chunk-size\": %"PRIu16,
stream_config.reassembly_toserver_chunk_size);
SCLogInfo("stream.reassembly \"toclient_chunk_size\": %"PRIu16,
SCLogInfo("stream.reassembly \"toclient-chunk-size\": %"PRIu16,
stream_config.reassembly_toclient_chunk_size);
}

@ -835,8 +835,8 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
} else if(strcmp((long_opts[option_index]).name, "init-errors-fatal") == 0) {
if (ConfSet("engine.init_failure_fatal", "1", 0) != 1) {
fprintf(stderr, "ERROR: Failed to set engine init_failure_fatal.\n");
if (ConfSet("engine.init-failure-fatal", "1", 0) != 1) {
fprintf(stderr, "ERROR: Failed to set engine init-failure-fatal.\n");
exit(EXIT_FAILURE);
}
}
@ -892,8 +892,8 @@ int main(int argc, char **argv)
}
else if(strcmp((long_opts[option_index]).name, "fatal-unittests") == 0) {
#ifdef UNITTESTS
if (ConfSet("unittests.failure_fatal", "1", 0) != 1) {
fprintf(stderr, "ERROR: Failed to set unittests failure_fatal.\n");
if (ConfSet("unittests.failure-fatal", "1", 0) != 1) {
fprintf(stderr, "ERROR: Failed to set unittests failure-fatal.\n");
exit(EXIT_FAILURE);
}
#else
@ -923,15 +923,15 @@ int main(int argc, char **argv)
}
else if (strcmp((long_opts[option_index]).name, "erf-in") == 0) {
run_mode = RUNMODE_ERF_FILE;
if (ConfSet("erf_file.file", optarg, 0) != 1) {
fprintf(stderr, "ERROR: Failed to set erf_file.file\n");
if (ConfSet("erf-file.file", optarg, 0) != 1) {
fprintf(stderr, "ERROR: Failed to set erf-file.file\n");
exit(EXIT_FAILURE);
}
}
else if (strcmp((long_opts[option_index]).name, "dag") == 0) {
#ifdef HAVE_DAG
run_mode = RUNMODE_DAG;
if (ConfSet("erf_dag.iface", optarg, 0) != 1) {
if (ConfSet("erf-dag.iface", optarg, 0) != 1) {
fprintf(stderr, "ERROR: Failed to set erf_dag.iface\n");
exit(EXIT_FAILURE);
}
@ -1077,8 +1077,8 @@ int main(int argc, char **argv)
usage(argv[0]);
exit(EXIT_SUCCESS);
}
if (ConfSet("pcap_file.file", optarg, 0) != 1) {
fprintf(stderr, "ERROR: Failed to set pcap_file.file\n");
if (ConfSet("pcap-file.file", optarg, 0) != 1) {
fprintf(stderr, "ERROR: Failed to set pcap-file.file\n");
exit(EXIT_FAILURE);
}
break;

@ -188,14 +188,14 @@ static void build_cpuset(char *name, ConfNode *node, cpu_set_t *cpu)
void AffinitySetupLoadFromConfig()
{
#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__
ConfNode *root = ConfGetNode("threading.cpu_affinity");
ConfNode *root = ConfGetNode("threading.cpu-affinity");
ConfNode *affinity;
AffinitySetupInit();
SCLogDebug("Load affinity from config\n");
if (root == NULL) {
SCLogInfo("can't get cpu_affinity node");
SCLogInfo("can't get cpu-affinity node");
return;
}
@ -205,7 +205,7 @@ void AffinitySetupLoadFromConfig()
ConfNode *nprio = NULL;
if (taf == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu_affinity type");
SCLogError(SC_ERR_INVALID_ARGUMENT, "unknown cpu-affinity type");
exit(EXIT_FAILURE);
} else {
SCLogInfo("Found affinity definition for \"%s\"",

@ -42,7 +42,7 @@ int32_t CoredumpLoadConfig (void)
uint32_t unlimited = 0;
size_t rlim_size = sizeof(rlim_t);
if (ConfGet ("coredump.max_dump", &dump_size_config) == 0) {
if (ConfGet ("coredump.max-dump", &dump_size_config) == 0) {
SCLogDebug ("core dump size not specified");
return 1;
}

@ -39,7 +39,7 @@ void SCAsn1LoadConfig() {
intmax_t value = 0;
/** set config defaults */
if ((ConfGetInt("asn1_max_frames", &value)) == 1) {
if ((ConfGetInt("asn1-max-frames", &value)) == 1) {
asn1_max_frames_config = (uint16_t)value;
SCLogDebug("Max stack frame set to %"PRIu16, asn1_max_frames_config);
}

@ -180,7 +180,7 @@ uint32_t UtRunTests(char *regex_arg) {
int ov[MAX_SUBSTRINGS];
int failure_fatal;
if (ConfGetBool("unittests.failure_fatal", &failure_fatal) != 1) {
if (ConfGetBool("unittests.failure-fatal", &failure_fatal) != 1) {
SCLogDebug("ConfGetBool could not load the value.");
failure_fatal = 0;
}

Loading…
Cancel
Save