From: Jason Ish Date: Thu, 24 Sep 2020 17:50:03 +0000 (-0600) Subject: app-layer: backport unidirectional tx option X-Git-Tag: suricata-5.0.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f22b1eb546bc05f4b940ba2215b347e79d9b1ac2;p=thirdparty%2Fsuricata.git app-layer: backport unidirectional tx option This is a partial backport of: ac3cf6ff75a3e5be39867bba1830076ac43e9f50 detect/config: set config for special cases Allow app-layer to declare the txs are uni-directional and special care is needed for applying config. --- diff --git a/rust/src/core.rs b/rust/src/core.rs index ef892e66e8..336b307304 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -29,6 +29,8 @@ pub type AppLayerEventType = std::os::raw::c_int; pub const APP_LAYER_EVENT_TYPE_TRANSACTION : i32 = 1; pub const APP_LAYER_EVENT_TYPE_PACKET : i32 = 2; +pub const APP_LAYER_PARSER_OPT_UNIDIR_TXS: u32 = 2; + // From stream.h. pub const STREAM_START: u8 = 0x01; pub const STREAM_EOF: u8 = 0x02; diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 133a9139e8..31d475880b 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -398,6 +398,12 @@ void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, SCReturn; } +uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto) +{ + SCEnter(); + SCReturnUInt(alp_ctx.ctxs[protomap][alproto].option_flags); +} + void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void), void (*StateFree)(void *)) diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 16efc7911d..ad37e22b18 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -39,6 +39,7 @@ /* Flags for AppLayerParserProtoCtx. */ #define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U32(0) +#define APP_LAYER_PARSER_OPT_UNIDIR_TXS BIT_U32(1) #define APP_LAYER_PARSER_INT_STREAM_DEPTH_SET BIT_U32(0) @@ -181,6 +182,7 @@ void AppLayerParserRegisterSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, /***** Get and transaction functions *****/ +uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto); AppLayerGetTxIteratorFunc AppLayerGetTxIterator(const uint8_t ipproto, const AppProto alproto);