diff --git a/examples/plugins/altemplate/src/template.rs b/examples/plugins/altemplate/src/template.rs index da05a5057b..de3f16993d 100644 --- a/examples/plugins/altemplate/src/template.rs +++ b/examples/plugins/altemplate/src/template.rs @@ -27,7 +27,7 @@ use std::collections::VecDeque; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; use suricata::applayer::{ - state_get_tx_iterator, AppLayerEvent, AppLayerParserConfParserEnabled, AppLayerRegisterParser, + state_get_tx_iterator, AppLayerEvent, AppLayerRegisterParser, AppLayerRegisterProtocolDetection, AppLayerResult, AppLayerStateData, AppLayerTxData, RustParser, State, StreamSlice, Transaction, APP_LAYER_PARSER_EOF_TC, APP_LAYER_PARSER_EOF_TS, APP_LAYER_PARSER_OPT_ACCEPT_GAPS, @@ -38,8 +38,9 @@ use suricata::{ build_slice, cast_pointer, export_state_data_get, export_tx_data_get, SCLogError, SCLogNotice, }; use suricata_sys::sys::{ - AppLayerParserState, AppProto, Flow, SCAppLayerParserRegisterLogger, - SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, Flow, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, + SCAppLayerProtoDetectConfProtoDetectionEnabled, }; static mut TEMPLATE_MAX_TX: usize = 256; @@ -413,7 +414,7 @@ pub(super) unsafe extern "C" fn template_register_parser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_TEMPLATE = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.template.max-tx") { diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 1841376306..e46c58ee52 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -535,11 +535,6 @@ pub const _APP_LAYER_TX_INSPECTED_TS: u8 = BIT_U8!(2); pub const _APP_LAYER_TX_INSPECTED_TC: u8 = BIT_U8!(3); pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4); -/// cbindgen:ignore -extern "C" { - pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int; -} - #[repr(C)] pub struct AppLayerGetTxIterTuple { tx_ptr: *mut std::os::raw::c_void, diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index f30f4bae0d..022343306a 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -26,7 +26,8 @@ use std::collections::VecDeque; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; @@ -408,7 +409,7 @@ pub unsafe extern "C" fn SCRegisterTemplateParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_TEMPLATE = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.template.max-tx") { diff --git a/rust/src/bittorrent_dht/bittorrent_dht.rs b/rust/src/bittorrent_dht/bittorrent_dht.rs index 963fe099d8..32fb2274f6 100644 --- a/rust/src/bittorrent_dht/bittorrent_dht.rs +++ b/rust/src/bittorrent_dht/bittorrent_dht.rs @@ -16,8 +16,9 @@ */ use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCS, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, + SCAppLayerProtoDetectPMRegisterPatternCS, }; use crate::applayer::{self, *}; @@ -295,7 +296,7 @@ pub unsafe extern "C" fn SCRegisterBittorrentDhtUdpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_BITTORRENT_DHT = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 2c970dc347..4a5573651f 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -25,8 +25,8 @@ use nom7::error::{Error, ErrorKind}; use nom7::number::Endianness; use nom7::{Err, IResult, Needed}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, - SCAppLayerProtoDetectPMRegisterPatternCSwPP, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCSwPP, }; use std; use std::cmp; @@ -1252,7 +1252,7 @@ pub unsafe extern "C" fn SCRegisterDcerpcParser() { if register_pattern_probe() < 0 { return; } - if AppLayerParserConfParserEnabled( + if SCAppLayerParserConfParserEnabled( ip_proto_str.as_ptr(), parser.name, ) != 0 diff --git a/rust/src/dcerpc/dcerpc_udp.rs b/rust/src/dcerpc/dcerpc_udp.rs index 745f7c1f47..48cd6a6580 100644 --- a/rust/src/dcerpc/dcerpc_udp.rs +++ b/rust/src/dcerpc/dcerpc_udp.rs @@ -25,8 +25,8 @@ use crate::direction::{Direction, DIR_BOTH}; use crate::flow::Flow; use nom7::Err; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, - SCAppLayerProtoDetectPMRegisterPatternCSwPP, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCSwPP, }; use std; use std::ffi::CString; @@ -391,7 +391,7 @@ pub unsafe extern "C" fn SCRegisterDcerpcUdpParser() { if register_pattern_probe() < 0 { return; } - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } else { diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index 2e5a5fb4e4..b1303bd83c 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -16,7 +16,8 @@ */ use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, }; use crate::applayer::{self, *}; @@ -301,7 +302,7 @@ pub unsafe extern "C" fn SCRegisterDhcpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_DHCP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } else { diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index 6da3885abd..8d636d2ef7 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -32,7 +32,7 @@ use crate::frames::Frame; use nom7::number::streaming::be_u16; use nom7::{Err, IResult}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, DetectEngineThreadCtx, + AppLayerParserState, AppProto, DetectEngineThreadCtx, SCAppLayerParserConfParserEnabled, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; @@ -1314,7 +1314,7 @@ pub unsafe extern "C" fn SCRegisterDnsUdpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_DNS = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } @@ -1361,7 +1361,7 @@ pub unsafe extern "C" fn SCRegisterDnsTcpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_DNS = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } diff --git a/rust/src/enip/enip.rs b/rust/src/enip/enip.rs index 70a3d97044..f6c8f34e7d 100644 --- a/rust/src/enip/enip.rs +++ b/rust/src/enip/enip.rs @@ -30,9 +30,9 @@ use std::collections::VecDeque; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerParserRegisterParserAcceptableDataDirection, SCAppLayerParserStateIssetFlag, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserRegisterParserAcceptableDataDirection, + SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; pub(super) static mut ALPROTO_ENIP: AppProto = ALPROTO_UNKNOWN; @@ -650,7 +650,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_ENIP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust enip parser registered for UDP."); @@ -675,7 +675,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_ENIP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust enip parser registered for TCP."); diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index bb35a8d1db..5b77975513 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -39,7 +39,8 @@ use std::ffi::CString; use std::fmt; use std::io; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerForceProtocolChange, SCAppLayerParserRegisterLogger, + AppLayerParserState, AppProto, SCAppLayerForceProtocolChange, + SCAppLayerParserConfParserEnabled, SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; @@ -1574,7 +1575,7 @@ pub unsafe extern "C" fn SCRegisterHttp2Parser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_HTTP2 = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.http2.max-streams") { @@ -1611,7 +1612,7 @@ pub unsafe extern "C" fn SCRegisterHttp2Parser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_DOH2 = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } else { SCLogWarning!("DOH2 is not meant to be detection-only."); diff --git a/rust/src/ike/ike.rs b/rust/src/ike/ike.rs index b63cd82d0b..6038c9e167 100644 --- a/rust/src/ike/ike.rs +++ b/rust/src/ike/ike.rs @@ -33,7 +33,8 @@ use std; use std::collections::HashSet; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, }; #[derive(AppLayerEvent)] @@ -410,7 +411,7 @@ pub unsafe extern "C" fn SCRegisterIkeParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_IKE = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } diff --git a/rust/src/krb/krb5.rs b/rust/src/krb/krb5.rs index a778c80353..772bb24178 100644 --- a/rust/src/krb/krb5.rs +++ b/rust/src/krb/krb5.rs @@ -33,8 +33,8 @@ use nom7::{Err, IResult}; use std; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; #[derive(AppLayerEvent)] @@ -638,7 +638,7 @@ pub unsafe extern "C" fn SCRegisterKrb5Parser() { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); // store the allocated ID for the probe function ALPROTO_KRB5 = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_KRB5); @@ -656,7 +656,7 @@ pub unsafe extern "C" fn SCRegisterKrb5Parser() { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); // store the allocated ID for the probe function ALPROTO_KRB5 = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_KRB5); diff --git a/rust/src/ldap/ldap.rs b/rust/src/ldap/ldap.rs index b81afa8bca..0b7e078343 100644 --- a/rust/src/ldap/ldap.rs +++ b/rust/src/ldap/ldap.rs @@ -29,7 +29,8 @@ use std::collections::VecDeque; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade, }; @@ -706,7 +707,7 @@ pub unsafe extern "C" fn SCRegisterLdapTcpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_LDAP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.ldap.max-tx") { @@ -765,7 +766,7 @@ pub unsafe extern "C" fn SCRegisterLdapUdpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_LDAP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.ldap.max-tx") { diff --git a/rust/src/mdns/mdns.rs b/rust/src/mdns/mdns.rs index 0b3256ab3f..4c5d596e07 100644 --- a/rust/src/mdns/mdns.rs +++ b/rust/src/mdns/mdns.rs @@ -26,7 +26,10 @@ use crate::dns::dns; use crate::flow::Flow; use suricata_sys::sys::DetectEngineThreadCtx; -use suricata_sys::sys::{AppProto, AppProtoEnum, SCAppLayerProtoDetectConfProtoDetectionEnabled}; +use suricata_sys::sys::{ + AppProto, AppProtoEnum, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, +}; pub(super) static mut ALPROTO_MDNS: AppProto = ALPROTO_UNKNOWN; @@ -124,7 +127,7 @@ pub unsafe extern "C" fn SCRegisterMdnsParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_MDNS = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } diff --git a/rust/src/modbus/modbus.rs b/rust/src/modbus/modbus.rs index 39bc8638dd..9c277bd77c 100644 --- a/rust/src/modbus/modbus.rs +++ b/rust/src/modbus/modbus.rs @@ -26,7 +26,8 @@ use sawp::parser::{Direction, Parse}; use sawp::probe::{Probe, Status}; use sawp_modbus::{self, AccessType, ErrorFlags, Flags, Message}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabledDefault, }; @@ -450,7 +451,7 @@ pub unsafe extern "C" fn SCRegisterModbusParser() { { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_MODBUS = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MODBUS); diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index f3c72b659b..1b688eac06 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -31,7 +31,8 @@ use std; use std::collections::VecDeque; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, }; // Used as a special pseudo packet identifier to denote the first CONNECT @@ -790,7 +791,7 @@ pub unsafe extern "C" fn SCMqttRegisterParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_MQTT = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.mqtt.max-tx") { diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index 59ca1c6ff6..309d91c0fb 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -24,8 +24,9 @@ use std::ffi::CString; use nom7::{Err, Needed}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, - SCAppLayerProtoDetectPPParseConfPorts, SCAppLayerProtoDetectPPRegister, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPPParseConfPorts, + SCAppLayerProtoDetectPPRegister, }; use crate::applayer; @@ -2398,7 +2399,7 @@ pub unsafe extern "C" fn SCRegisterNfsParser() { Some(ffi_nfs_probe), ); } - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust nfs parser registered."); @@ -2474,7 +2475,7 @@ pub unsafe extern "C" fn SCRegisterNfsUdpParser() { Some(nfs_probe_udp_tc), ); } - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.nfs.max-tx") { diff --git a/rust/src/ntp/ntp.rs b/rust/src/ntp/ntp.rs index 1a5c9ac0cc..a94a4bf65d 100644 --- a/rust/src/ntp/ntp.rs +++ b/rust/src/ntp/ntp.rs @@ -29,7 +29,8 @@ use std::ffi::CString; use nom7::Err; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerProtoDetectConfProtoDetectionEnabled, }; #[derive(AppLayerEvent)] @@ -297,7 +298,7 @@ pub unsafe extern "C" fn SCRegisterNtpParser() { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); // store the allocated ID for the probe function ALPROTO_NTP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } } else { diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index 42720ca231..903b7df006 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -31,7 +31,8 @@ use std; use std::collections::VecDeque; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade, }; @@ -961,7 +962,7 @@ pub unsafe extern "C" fn SCRegisterPgsqlParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_PGSQL = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust pgsql parser registered."); diff --git a/rust/src/pop3/pop3.rs b/rust/src/pop3/pop3.rs index 4ce9d83aad..e912711c1a 100644 --- a/rust/src/pop3/pop3.rs +++ b/rust/src/pop3/pop3.rs @@ -29,9 +29,9 @@ use std::collections::VecDeque; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserSetStreamDepth, - SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, - SCAppLayerRequestProtocolTLSUpgrade, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag, + SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade, }; use sawp::error::Error as SawpError; @@ -518,7 +518,7 @@ pub unsafe extern "C" fn SCRegisterPop3Parser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_POP3 = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } let retval = conf_get("app-layer.protocols.pop3.stream-depth"); diff --git a/rust/src/quic/quic.rs b/rust/src/quic/quic.rs index 3a2fdf185f..9e5fc3824c 100644 --- a/rust/src/quic/quic.rs +++ b/rust/src/quic/quic.rs @@ -34,8 +34,8 @@ use crate::{ use std::collections::VecDeque; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; use tls_parser::TlsExtensionType; @@ -585,7 +585,7 @@ pub unsafe extern "C" fn SCRegisterQuicParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_QUIC = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust quic parser registered."); diff --git a/rust/src/rdp/rdp.rs b/rust/src/rdp/rdp.rs index bae570a032..89fb54017e 100644 --- a/rust/src/rdp/rdp.rs +++ b/rust/src/rdp/rdp.rs @@ -30,8 +30,8 @@ use nom7::Err; use std; use std::collections::VecDeque; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; use tls_parser::{parse_tls_plaintext, TlsMessage, TlsMessageHandshake, TlsRecordType}; @@ -533,7 +533,7 @@ pub unsafe extern "C" fn SCRegisterRdpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_RDP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RDP); diff --git a/rust/src/rfb/rfb.rs b/rust/src/rfb/rfb.rs index 80da7f1c29..9c033c5b0d 100644 --- a/rust/src/rfb/rfb.rs +++ b/rust/src/rfb/rfb.rs @@ -32,8 +32,9 @@ use std; use std::ffi::CString; use std::os::raw::c_char; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCI, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, + SCAppLayerProtoDetectPMRegisterPatternCI, }; pub(super) static mut ALPROTO_RFB: AppProto = ALPROTO_UNKNOWN; @@ -922,7 +923,7 @@ pub unsafe extern "C" fn SCRfbRegisterParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_RFB = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust rfb parser registered."); diff --git a/rust/src/sip/sip.rs b/rust/src/sip/sip.rs index 77c0f46aa2..5dd512af23 100755 --- a/rust/src/sip/sip.rs +++ b/rust/src/sip/sip.rs @@ -31,7 +31,8 @@ use std; use std::collections::VecDeque; use std::ffi::CString; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCS, }; @@ -595,7 +596,7 @@ pub unsafe extern "C" fn SCRegisterSipParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_SIP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if register_pattern_probe(core::IPPROTO_UDP) < 0 { @@ -617,7 +618,7 @@ pub unsafe extern "C" fn SCRegisterSipParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_SIP = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if register_pattern_probe(core::IPPROTO_TCP) < 0 { diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index 3f231ee436..663f54ff59 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -35,9 +35,10 @@ use nom7::error::{make_error, ErrorKind}; use lru::LruCache; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth, - SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCSwPP, - SCAppLayerProtoDetectPPParseConfPorts, SCAppLayerProtoDetectPPRegister, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserSetStreamDepth, SCAppLayerProtoDetectConfProtoDetectionEnabled, + SCAppLayerProtoDetectPMRegisterPatternCSwPP, SCAppLayerProtoDetectPPParseConfPorts, + SCAppLayerProtoDetectPPRegister, }; use std::num::NonZeroUsize; @@ -2390,7 +2391,7 @@ pub unsafe extern "C" fn SCRegisterSmbParser() { 0, MIN_REC_SIZE, Direction::ToServer as u8, Some(c_smb_probe_tcp), Some(c_smb_probe_tcp)); } - if AppLayerParserConfParserEnabled( + if SCAppLayerParserConfParserEnabled( ip_proto_str.as_ptr(), parser.name, ) != 0 diff --git a/rust/src/snmp/snmp.rs b/rust/src/snmp/snmp.rs index 5e164d9584..41bbffb7aa 100644 --- a/rust/src/snmp/snmp.rs +++ b/rust/src/snmp/snmp.rs @@ -35,7 +35,7 @@ use nom7::error::{ErrorKind, make_error}; use suricata_sys::sys::{ AppLayerParserState, AppProto, AppProtoNewProtoFromString, EveJsonTxLoggerRegistrationData, SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, - SCOutputEvePreRegisterLogger, SCOutputJsonLogDirection, SCSigTablePreRegister, + SCOutputEvePreRegisterLogger, SCOutputJsonLogDirection, SCSigTablePreRegister, SCAppLayerParserConfParserEnabled, }; #[derive(AppLayerEvent)] @@ -425,14 +425,14 @@ pub unsafe extern "C" fn SCRegisterSnmpParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { // port 161 _ = AppLayerRegisterProtocolDetection(&parser, 1); - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, ALPROTO_SNMP); } // port 162 let default_port_traps = CString::new("162").unwrap(); parser.default_port = default_port_traps.as_ptr(); let _ = AppLayerRegisterProtocolDetection(&parser, 1); - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, ALPROTO_SNMP); } SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SNMP); diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index 9c25fe5a19..99cb28f485 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -25,7 +25,8 @@ use nom7::Err; use std::ffi::CString; use std::sync::atomic::{AtomicBool, Ordering}; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateSetFlag, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerParserStateSetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; @@ -578,7 +579,7 @@ pub unsafe extern "C" fn SCRegisterSshParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_SSH = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH); diff --git a/rust/src/telnet/telnet.rs b/rust/src/telnet/telnet.rs index 4d7782cd62..86871eb8cc 100644 --- a/rust/src/telnet/telnet.rs +++ b/rust/src/telnet/telnet.rs @@ -23,8 +23,8 @@ use crate::frames::*; use std::ffi::CString; use nom7::IResult; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; use super::parser; @@ -549,7 +549,7 @@ pub unsafe extern "C" fn SCRegisterTelnetParser() { { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_TELNET = alproto; - if AppLayerParserConfParserEnabled( + if SCAppLayerParserConfParserEnabled( ip_proto_str.as_ptr(), parser.name, ) != 0 diff --git a/rust/src/websocket/websocket.rs b/rust/src/websocket/websocket.rs index 6d4e617568..343e69c1a0 100644 --- a/rust/src/websocket/websocket.rs +++ b/rust/src/websocket/websocket.rs @@ -31,8 +31,8 @@ use nom7::Needed; use flate2::Decompress; use flate2::FlushDecompress; use suricata_sys::sys::{ - AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, - SCAppLayerProtoDetectConfProtoDetectionEnabled, + AppLayerParserState, AppProto, SCAppLayerParserConfParserEnabled, + SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled, }; use std; @@ -432,7 +432,7 @@ pub unsafe extern "C" fn SCRegisterWebSocketParser() { if SCAppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_WEBSOCKET = alproto; - if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { + if SCAppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust websocket parser registered."); diff --git a/rust/sys/src/sys.rs b/rust/sys/src/sys.rs index 5e555a4d4c..60e3ece424 100644 --- a/rust/sys/src/sys.rs +++ b/rust/sys/src/sys.rs @@ -695,6 +695,12 @@ pub struct AppLayerParserState_ { _unused: [u8; 0], } pub type AppLayerParserState = AppLayerParserState_; +extern "C" { + #[doc = " \\brief Given a protocol name, checks if the parser is enabled in\n the conf file.\n\n \\param alproto_name Name of the app layer protocol.\n\n \\retval 1 If enabled.\n \\retval 0 If disabled."] + pub fn SCAppLayerParserConfParserEnabled( + ipproto: *const ::std::os::raw::c_char, alproto_name: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn SCAppLayerParserRegisterParserAcceptableDataDirection( ipproto: u8, alproto: AppProto, direction: u8, diff --git a/src/app-layer-dnp3.c b/src/app-layer-dnp3.c index 4fe796d58a..cfeb3051e4 100644 --- a/src/app-layer-dnp3.c +++ b/src/app-layer-dnp3.c @@ -1556,8 +1556,7 @@ void RegisterDNP3Parsers(void) SCReturn; } - if (AppLayerParserConfParserEnabled("tcp", proto_name)) - { + if (SCAppLayerParserConfParserEnabled("tcp", proto_name)) { SCLogConfig("Registering DNP3/tcp parsers."); AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_DNP3, STREAM_TOSERVER, @@ -1586,8 +1585,7 @@ void RegisterDNP3Parsers(void) AppLayerParserRegisterTxDataFunc(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetTxData); AppLayerParserRegisterStateDataFunc(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetStateData); - } - else { + } else { SCLogConfig("Parser disabled for protocol %s. " "Protocol detection still on.", proto_name); } diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 6ca2b3fc0e..c5f3bf48d1 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -1281,7 +1281,7 @@ void RegisterFTPParsers(void) AppLayerProtoDetectRegisterProtocol(ALPROTO_FTPDATA, proto_data_name); } - if (AppLayerParserConfParserEnabled("tcp", proto_name)) { + if (SCAppLayerParserConfParserEnabled("tcp", proto_name)) { AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOSERVER, FTPParseRequest); AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOCLIENT, diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index f19e1df631..edc04a78d9 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1593,7 +1593,7 @@ void HTPFreeConfig(void) SCEnter(); if (!SCAppLayerProtoDetectConfProtoDetectionEnabled("tcp", "http") || - !AppLayerParserConfParserEnabled("tcp", "http")) { + !SCAppLayerParserConfParserEnabled("tcp", "http")) { SCReturn; } @@ -2630,7 +2630,7 @@ void RegisterHTPParsers(void) return; } - if (AppLayerParserConfParserEnabled("tcp", proto_name)) { + if (SCAppLayerParserConfParserEnabled("tcp", proto_name)) { AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_HTTP1, HTPStateAlloc, HTPStateFree); AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_HTTP1, HTPStateTransactionFree); AppLayerParserRegisterGetTxFilesFunc(IPPROTO_TCP, ALPROTO_HTTP1, HTPGetTxFiles); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 43ba87242c..d8f58b1a83 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -342,8 +342,7 @@ void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx) /** \brief check if a parser is enabled in the config * Returns enabled always if: were running unittests */ -int AppLayerParserConfParserEnabled(const char *ipproto, - const char *alproto_name) +int SCAppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name) { SCEnter(); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 80b59a715a..d1a6bbdcbf 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -123,8 +123,7 @@ void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx); * \retval 1 If enabled. * \retval 0 If disabled. */ -int AppLayerParserConfParserEnabled(const char *ipproto, - const char *alproto_name); +int SCAppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name); enum ExceptionPolicy AppLayerErrorGetExceptionPolicy(void); diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index f25b076130..bf94d71c5a 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1873,7 +1873,7 @@ void RegisterSMTPParsers(void) return; } - if (AppLayerParserConfParserEnabled("tcp", proto_name)) { + if (SCAppLayerParserConfParserEnabled("tcp", proto_name)) { AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateAlloc, SMTPStateFree); AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_SMTP, STREAM_TOSERVER, diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 9ca4b10a2f..ba755b44bf 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -3216,7 +3216,7 @@ void RegisterSSLParsers(void) return; } - if (AppLayerParserConfParserEnabled("tcp", proto_name)) { + if (SCAppLayerParserConfParserEnabled("tcp", proto_name)) { AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_TLS, STREAM_TOSERVER, SSLParseClientRecord); diff --git a/src/app-layer-tftp.c b/src/app-layer-tftp.c index 618c44cd13..131906aaaf 100644 --- a/src/app-layer-tftp.c +++ b/src/app-layer-tftp.c @@ -184,7 +184,7 @@ void RegisterTFTPParsers(void) return; } - if (AppLayerParserConfParserEnabled("udp", proto_name)) { + if (SCAppLayerParserConfParserEnabled("udp", proto_name)) { SCLogDebug("Registering TFTP protocol parser."); @@ -223,8 +223,7 @@ void RegisterTFTPParsers(void) AppLayerParserRegisterTxDataFunc(IPPROTO_UDP, ALPROTO_TFTP, SCTftpGetTxData); AppLayerParserRegisterStateDataFunc(IPPROTO_UDP, ALPROTO_TFTP, SCTftpGetStateData); - } - else { + } else { SCLogDebug("TFTP protocol parsing disabled."); } }