#include "util-unittest.h"
#include "util-unittest-helper.h"
-/** defined in stream-tcp-reassemble.c */
-extern int stream_inline;
-
-/**
- * \brief See if stream engine is operating in inline mode
- *
- * \retval 0 no
- * \retval 1 yes
- */
-int StreamTcpInlineMode(void)
-{
- return stream_inline;
-}
-
/**
* \brief Compare the shared data portion of two segments
*
/* unittest helper functions */
-extern int stream_inline;
-
void StreamTcpUTInit(TcpReassemblyThreadCtx **ra_ctx)
{
StreamTcpInitConfig(TRUE);
{
StreamTcpReassembleFreeThreadCtx(ra_ctx);
StreamTcpFreeConfig(TRUE);
- stream_inline = 0;
+ stream_config.flags &= ~STREAMTCP_INIT_FLAG_INLINE;
}
void StreamTcpUTInitInline(void) {
- stream_inline = 1;
+ stream_config.flags |= STREAMTCP_INIT_FLAG_INLINE;
}
void StreamTcpUTSetupSession(TcpSession *ssn)
uint64_t StreamTcpReassembleMemuseGlobalCounter(void);
SC_ATOMIC_DECLARE(uint64_t, st_memuse);
-/* stream engine running in "inline" mode. */
-int stream_inline = 0;
-
void StreamTcpInitMemuse(void)
{
SC_ATOMIC_INIT(st_memuse);
*/
int StreamTcpInlineDropInvalid(void)
{
- return (stream_inline && (stream_config.flags & STREAMTCP_INIT_FLAG_DROP_INVALID));
+ return ((stream_config.flags & STREAMTCP_INIT_FLAG_INLINE)
+ && (stream_config.flags & STREAMTCP_INIT_FLAG_DROP_INVALID));
}
/** \brief To initialize the stream global configuration data
* backward compatibility */
if (strcmp(temp_stream_inline_str, "auto") == 0) {
if (EngineModeIsIPS()) {
- stream_inline = 1;
- } else {
- stream_inline = 0;
+ stream_config.flags |= STREAMTCP_INIT_FLAG_INLINE;
}
} else if (ConfGetBool("stream.inline", &inl) == 1) {
- stream_inline = inl;
+ if (inl) {
+ stream_config.flags |= STREAMTCP_INIT_FLAG_INLINE;
+ }
}
} else {
/* default to 'auto' */
if (EngineModeIsIPS()) {
- stream_inline = 1;
- } else {
- stream_inline = 0;
+ stream_config.flags |= STREAMTCP_INIT_FLAG_INLINE;
}
}
if (!quiet) {
- SCLogConfig("stream.\"inline\": %s", stream_inline ? "enabled" : "disabled");
+ SCLogConfig("stream.\"inline\": %s",
+ stream_config.flags & STREAMTCP_INIT_FLAG_INLINE
+ ? "enabled" : "disabled");
}
int bypass = 0;
/* for IDS, return ack'd segments. For IPS all. */
TcpSegment *seg = stream->seg_list;
for (; seg != NULL &&
- (stream_inline || SEQ_LT(seg->seq, stream->last_ack));)
+ ((stream_config.flags & STREAMTCP_INIT_FLAG_INLINE)
+ || SEQ_LT(seg->seq, stream->last_ack));)
{
const uint8_t *seg_data;
uint32_t seg_datalen;
return (stream_config.flags & STREAMTCP_INIT_FLAG_BYPASS);
}
+/**
+ * \brief See if stream engine is operating in inline mode
+ *
+ * \retval 0 no
+ * \retval 1 yes
+ */
+int StreamTcpInlineMode(void)
+{
+ return (stream_config.flags & STREAMTCP_INIT_FLAG_INLINE) ? 1 : 0;
+}
+
+
void TcpSessionSetReassemblyDepth(TcpSession *ssn, uint32_t size)
{
if (size > ssn->reassembly_depth || size == 0) {
#define STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION BIT_U8(0)
#define STREAMTCP_INIT_FLAG_DROP_INVALID BIT_U8(1)
#define STREAMTCP_INIT_FLAG_BYPASS BIT_U8(2)
+#define STREAMTCP_INIT_FLAG_INLINE BIT_U8(3)
/*global flow data*/
typedef struct TcpStreamCnf_ {
/* check if bypass is enabled */
int StreamTcpBypassEnabled(void);
int StreamTcpInlineDropInvalid(void);
+int StreamTcpInlineMode(void);
int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn);