When an app-layer parser is enabled, it could set its
own stream_depth value calling the API AppLayerParserSetStreamDepth.
Then, the function AppLayerParserPostStreamSetup will replace
the stream_depth value already set with stream_config.reassembly_depth.
To avoid overwriting, in AppLayerParserSetStreamDepth API a flag
will be set internally to specify that a value is already set.
/* lets set a default value for stream_depth */
for (flow_proto = 0; flow_proto < FLOW_PROTO_DEFAULT; flow_proto++) {
for (alproto = 0; alproto < ALPROTO_MAX; alproto++) {
- alp_ctx.ctxs[flow_proto][alproto].stream_depth =
- stream_config.reassembly_depth;
+ if (!(alp_ctx.ctxs[flow_proto][alproto].flags &
+ APP_LAYER_PARSER_OPT_STREAM_DEPTH_SET)) {
+ alp_ctx.ctxs[flow_proto][alproto].stream_depth =
+ stream_config.reassembly_depth;
+ }
}
}
}
SCEnter();
alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].stream_depth = stream_depth;
+ alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].flags |=
+ APP_LAYER_PARSER_OPT_STREAM_DEPTH_SET;
SCReturn;
}
/* Flags for AppLayerParserProtoCtx. */
#define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U64(0)
+#define APP_LAYER_PARSER_OPT_STREAM_DEPTH_SET BIT_U64(1)
/* applies to DetectFlags uint64_t field */