]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: backport unidirectional tx option
authorJason Ish <jason.ish@oisf.net>
Thu, 24 Sep 2020 17:50:03 +0000 (11:50 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Oct 2020 06:33:09 +0000 (08:33 +0200)
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.

rust/src/core.rs
src/app-layer-parser.c
src/app-layer-parser.h

index ef892e66e8d1956273e28d748ecebd9087aa51f2..336b3073047c64f33876697f90645f8d9394e54b 100644 (file)
@@ -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;
index 133a9139e83b4f4578c4ce572531d965a404d161..31d475880b4083228c70bda28ea26be2d6124d75 100644 (file)
@@ -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 *))
index 16efc7911dfc24d6318a08b03a2012bc5dc157e9..ad37e22b18e787f59521f693c52ccc95b9e24ddb 100644 (file)
@@ -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);