offset: u16, direction: u8, ppfn: ProbeFn,
pp_min_depth: u16, pp_max_depth: u16) -> c_int;
pub fn AppLayerProtoDetectConfProtoDetectionEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
+ pub fn AppLayerProtoDetectConfProtoDetectionEnabledDefault(ipproto: *const c_char, proto: *const c_char, default: bool) -> c_int;
}
// Defined in app-layer-parser.h
};
let ip_proto_str = CString::new("tcp").unwrap();
- if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
+ if AppLayerProtoDetectConfProtoDetectionEnabledDefault(ip_proto_str.as_ptr(), parser.name, false) != 0 {
let alproto = AppLayerRegisterProtocolDetection(&parser, 1);
ALPROTO_MODBUS = alproto;
if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
f->alproto_tc = ALPROTO_UNKNOWN;
}
-int AppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto,
- const char *alproto)
+int AppLayerProtoDetectConfProtoDetectionEnabledDefault(
+ const char *ipproto, const char *alproto, bool default_enabled)
{
SCEnter();
node = ConfGetNode(param);
if (node == NULL) {
SCLogDebug("Entry for %s not found.", param);
- goto enabled;
+ if (default_enabled) {
+ goto enabled;
+ } else {
+ goto disabled;
+ }
}
}
SCReturnInt(enabled);
}
+int AppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto, const char *alproto)
+{
+ return AppLayerProtoDetectConfProtoDetectionEnabledDefault(ipproto, alproto, true);
+}
+
AppLayerProtoDetectThreadCtx *AppLayerProtoDetectGetCtxThread(void)
{
SCEnter();
int AppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto,
const char *alproto);
+/**
+ * \brief Given a protocol name, checks if proto detection is enabled in
+ * the conf file.
+ *
+ * \param alproto Name of the app layer protocol.
+ * \param default_enabled enable by default if not in the configuration file
+ *
+ * \retval 1 If enabled.
+ * \retval 0 If disabled.
+ */
+int AppLayerProtoDetectConfProtoDetectionEnabledDefault(
+ const char *ipproto, const char *alproto, bool default_enabled);
+
/**
* \brief Inits and returns an app layer protocol detection thread context.
const char *proto_name = "dnp3";
- if (AppLayerProtoDetectConfProtoDetectionEnabled("tcp", proto_name))
- {
+ if (AppLayerProtoDetectConfProtoDetectionEnabledDefault("tcp", proto_name, false)) {
AppLayerProtoDetectRegisterProtocol(ALPROTO_DNP3, proto_name);
if (RunmodeIsUnittests()) {
}
}
- }
- else {
+ } else {
SCLogConfig("Protocol detection and parser disabled for DNP3.");
SCReturn;
}
SCEnter();
const char *proto_name = "enip";
- if (AppLayerProtoDetectConfProtoDetectionEnabled("udp", proto_name))
- {
+ if (AppLayerProtoDetectConfProtoDetectionEnabledDefault("udp", proto_name, false)) {
AppLayerProtoDetectRegisterProtocol(ALPROTO_ENIP, proto_name);
if (RunmodeIsUnittests())
}
}
- } else
- {
+ } else {
SCLogConfig("Protocol detection and parser disabled for %s protocol.",
proto_name);
return;
SCEnter();
const char *proto_name = "enip";
- if (AppLayerProtoDetectConfProtoDetectionEnabled("tcp", proto_name))
- {
+ if (AppLayerProtoDetectConfProtoDetectionEnabledDefault("tcp", proto_name, false)) {
AppLayerProtoDetectRegisterProtocol(ALPROTO_ENIP, proto_name);
if (RunmodeIsUnittests())
}
}
- } else
- {
+ } else {
SCLogDebug("Protocol detection and parser disabled for %s protocol.",
proto_name);
return;
{
const char *proto_name = "http2";
- if (AppLayerProtoDetectConfProtoDetectionEnabled("tcp", proto_name)) {
+ if (AppLayerProtoDetectConfProtoDetectionEnabledDefault("tcp", proto_name, false)) {
AppLayerProtoDetectRegisterProtocol(ALPROTO_HTTP2, proto_name);
if (HTTP2RegisterPatternsForProtocolDetection() < 0)
return;