diff --git a/rust/cbindgen.toml b/rust/cbindgen.toml index ab466f09f7..2e3148ad35 100644 --- a/rust/cbindgen.toml +++ b/rust/cbindgen.toml @@ -125,6 +125,7 @@ exclude = [ "SIGMATCH_INFO_UINT64", "SIGMATCH_INFO_MULTI_UINT", "SIGMATCH_INFO_ENUM_UINT", + "SIGMATCH_INFO_BITFLAGS_UINT", "FtpCommand", ] diff --git a/rust/src/detect/mod.rs b/rust/src/detect/mod.rs index 0e22072ee1..e42217d25e 100644 --- a/rust/src/detect/mod.rs +++ b/rust/src/detect/mod.rs @@ -136,6 +136,7 @@ pub const SIGMATCH_INFO_UINT32: u32 = 0x20000; // BIT_U32(17) pub const SIGMATCH_INFO_UINT64: u32 = 0x40000; // BIT_U32(18) pub const SIGMATCH_INFO_MULTI_UINT: u32 = 0x80000; // BIT_U32(19) pub const SIGMATCH_INFO_ENUM_UINT: u32 = 0x100000; // BIT_U32(20) +pub const SIGMATCH_INFO_BITFLAGS_UINT: u32 = 0x200000; // BIT_U32(21) #[repr(u8)] diff --git a/rust/src/mqtt/detect.rs b/rust/src/mqtt/detect.rs index 1ff3b77753..98d0d86131 100644 --- a/rust/src/mqtt/detect.rs +++ b/rust/src/mqtt/detect.rs @@ -24,8 +24,8 @@ use crate::detect::uint::{ }; use crate::detect::{ helper_keyword_register_multi_buffer, helper_keyword_register_sticky_buffer, - SigTableElmtStickyBuffer, SIGMATCH_INFO_ENUM_UINT, SIGMATCH_INFO_MULTI_UINT, - SIGMATCH_INFO_UINT8, + SigTableElmtStickyBuffer, SIGMATCH_INFO_BITFLAGS_UINT, SIGMATCH_INFO_ENUM_UINT, + SIGMATCH_INFO_MULTI_UINT, SIGMATCH_INFO_UINT8, }; use suricata_sys::sys::{ DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList, @@ -1142,7 +1142,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() { AppLayerTxMatch: Some(mqtt_flags_match), Setup: Some(mqtt_flags_setup), Free: Some(mqtt_flags_free), - flags: SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_MULTI_UINT, + flags: SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_MULTI_UINT | SIGMATCH_INFO_BITFLAGS_UINT, }; G_MQTT_FLAGS_KW_ID = SCDetectHelperKeywordRegister(&kw); G_MQTT_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister( @@ -1157,7 +1157,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() { AppLayerTxMatch: Some(mqtt_conn_flags_match), Setup: Some(mqtt_conn_flags_setup), Free: Some(mqtt_conn_flags_free), - flags: SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_MULTI_UINT, + flags: SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_MULTI_UINT | SIGMATCH_INFO_BITFLAGS_UINT, }; G_MQTT_CONN_FLAGS_KW_ID = SCDetectHelperKeywordRegister(&kw); G_MQTT_CONN_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister( diff --git a/rust/src/websocket/detect.rs b/rust/src/websocket/detect.rs index 810877d9c5..b5fe91c8eb 100644 --- a/rust/src/websocket/detect.rs +++ b/rust/src/websocket/detect.rs @@ -22,8 +22,8 @@ use crate::detect::uint::{ SCDetectU32Match, SCDetectU32Parse, SCDetectU8Free, SCDetectU8Match, }; use crate::detect::{ - helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer, SIGMATCH_INFO_ENUM_UINT, - SIGMATCH_INFO_UINT32, SIGMATCH_INFO_UINT8, + helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer, SIGMATCH_INFO_BITFLAGS_UINT, + SIGMATCH_INFO_ENUM_UINT, SIGMATCH_INFO_UINT32, SIGMATCH_INFO_UINT8, }; use crate::websocket::parser::WebSocketOpcode; use suricata_sys::sys::{ @@ -306,7 +306,7 @@ pub unsafe extern "C" fn SCDetectWebsocketRegister() { AppLayerTxMatch: Some(websocket_detect_flags_match), Setup: Some(websocket_detect_flags_setup), Free: Some(websocket_detect_flags_free), - flags: SIGMATCH_INFO_UINT8, + flags: SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_BITFLAGS_UINT, }; G_WEBSOCKET_FLAGS_KW_ID = SCDetectHelperKeywordRegister(&kw); G_WEBSOCKET_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister( diff --git a/src/detect-engine-register.c b/src/detect-engine-register.c index 80cb96e5f9..3f167f4b30 100644 --- a/src/detect-engine-register.c +++ b/src/detect-engine-register.c @@ -343,6 +343,8 @@ static void PrintFeatureList(const SigTableElmt *e, char sep) printf("multi "); if (flags & SIGMATCH_INFO_ENUM_UINT) printf("enum "); + if (flags & SIGMATCH_INFO_BITFLAGS_UINT) + printf("bitflags "); if (flags & SIGMATCH_INFO_UINT8) printf("uint8"); if (flags & SIGMATCH_INFO_UINT16) diff --git a/src/detect.h b/src/detect.h index fa294eb633..248987283b 100644 --- a/src/detect.h +++ b/src/detect.h @@ -1694,6 +1694,8 @@ typedef struct SigGroupHead_ { #define SIGMATCH_INFO_MULTI_UINT BIT_U32(19) /** keyword is an uint with enumeration stringer */ #define SIGMATCH_INFO_ENUM_UINT BIT_U32(20) +/** keyword is an uint with bitflags */ +#define SIGMATCH_INFO_BITFLAGS_UINT BIT_U32(21) enum DetectEngineTenantSelectors {