diff --git a/src/app-layer.c b/src/app-layer.c index 001acf2d7d..60f2a278c1 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -209,12 +209,8 @@ static void TCPProtoDetectCheckBailConditions(ThreadVars *tv, STREAM_RIGHT_EDGE(&ssn->server) : 0; SCLogDebug("size_ts %"PRIu64", size_tc %"PRIu64, size_ts, size_tc); -#ifdef DEBUG_VALIDATION - if (!(ssn->client.flags & STREAMTCP_STREAM_FLAG_GAP)) - BUG_ON(size_ts > 1000000UL); - if (!(ssn->server.flags & STREAMTCP_STREAM_FLAG_GAP)) - BUG_ON(size_tc > 1000000UL); -#endif /* DEBUG_VALIDATION */ + DEBUG_VALIDATE_BUG_ON(size_ts > 1000000UL); + DEBUG_VALIDATE_BUG_ON(size_tc > 1000000UL); if (ProtoDetectDone(f, ssn, STREAM_TOSERVER) && ProtoDetectDone(f, ssn, STREAM_TOCLIENT)) diff --git a/src/flow.c b/src/flow.c index 14b32f4cc2..614540dd53 100644 --- a/src/flow.c +++ b/src/flow.c @@ -1127,9 +1127,6 @@ uint8_t FlowGetDisruptionFlags(const Flow *f, uint8_t flags) if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) { newflags |= STREAM_DEPTH; } - if (stream->flags & STREAMTCP_STREAM_FLAG_GAP) { - newflags |= STREAM_GAP; - } /* todo: handle pass case (also for UDP!) */ return newflags; diff --git a/src/output-json-flow.c b/src/output-json-flow.c index 9f7fd41300..1a0b823334 100644 --- a/src/output-json-flow.c +++ b/src/output-json-flow.c @@ -315,10 +315,6 @@ static void EveFlowLogJSON(JsonFlowLogThread *aft, JsonBuilder *jb, Flow *f) const char *tcp_state = StreamTcpStateAsString(ssn->state); if (tcp_state != NULL) jb_set_string(jb, "state", tcp_state); - if (ssn->client.flags & STREAMTCP_STREAM_FLAG_GAP) - JB_SET_TRUE(jb, "gap_ts"); - if (ssn->server.flags & STREAMTCP_STREAM_FLAG_GAP) - JB_SET_TRUE(jb, "gap_tc"); } /* Close tcp. */ diff --git a/src/stream-tcp-list.c b/src/stream-tcp-list.c index cb47ee8e92..518e958977 100644 --- a/src/stream-tcp-list.c +++ b/src/stream-tcp-list.c @@ -636,7 +636,7 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ static inline bool SegmentInUse(const TcpStream *stream, const TcpSegment *seg) { /* if proto detect isn't done, we're not returning */ - if (!(stream->flags & (STREAMTCP_STREAM_FLAG_GAP|STREAMTCP_STREAM_FLAG_NOREASSEMBLY))) { + if (!(stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) { if (!(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream))) { SCReturnInt(true); } @@ -672,9 +672,7 @@ static inline uint64_t GetLeftEdge(TcpSession *ssn, TcpStream *stream) bool use_log = true; uint64_t left_edge = 0; - if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || - (stream->flags & STREAMTCP_STREAM_FLAG_GAP)) - { + if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED)) { use_app = false; // app is dead } @@ -829,10 +827,8 @@ void StreamTcpPruneSession(Flow *f, uint8_t flags) StreamingBufferClear(&stream->sb); return; - } else if (((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || - (stream->flags & STREAMTCP_STREAM_FLAG_GAP)) && - (stream->flags & STREAMTCP_STREAM_FLAG_DISABLE_RAW)) - { + } else if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) && + (stream->flags & STREAMTCP_STREAM_FLAG_DISABLE_RAW)) { SCLogDebug("ssn %p / stream %p: both app and raw are done, " "STREAMTCP_STREAM_FLAG_NOREASSEMBLY set", ssn, stream); stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY; diff --git a/src/stream-tcp-private.h b/src/stream-tcp-private.h index 41f75d466d..b229edfae8 100644 --- a/src/stream-tcp-private.h +++ b/src/stream-tcp-private.h @@ -195,8 +195,7 @@ enum TcpState * Per STREAM flags */ -/** stream is in a gap state */ -#define STREAMTCP_STREAM_FLAG_GAP BIT_U16(0) +// bit 0 vacant /** Flag to avoid stream reassembly/app layer inspection for the stream */ #define STREAMTCP_STREAM_FLAG_NOREASSEMBLY BIT_U16(1) /** we received a keep alive */ diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 17c2168026..b4aacf14fa 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -807,9 +807,7 @@ int StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction) int use_app = 1; int use_raw = 1; - if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || - (stream->flags & STREAMTCP_STREAM_FLAG_GAP)) - { + if (ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) { // app is dead use_app = 0; } @@ -1360,11 +1358,8 @@ void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, uint64_t prog stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW; /* if app is active and beyond raw, sync raw to app */ - } else if (progress == 0 && - STREAM_APP_PROGRESS(stream) > STREAM_RAW_PROGRESS(stream) && - !(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) && - !(stream->flags & STREAMTCP_STREAM_FLAG_GAP)) - { + } else if (progress == 0 && STREAM_APP_PROGRESS(stream) > STREAM_RAW_PROGRESS(stream) && + !(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED)) { /* if trigger raw is set we sync the 2 trackers */ if (stream->flags & STREAMTCP_STREAM_FLAG_TRIGGER_RAW) { @@ -3379,7 +3374,6 @@ static int StreamTcpReassembleInlineTest08(void) FLOW_INITIALIZE(&f); stream_config.reassembly_toserver_chunk_size = 15; - ssn.client.flags |= STREAMTCP_STREAM_FLAG_GAP; f.protoctx = &ssn; uint8_t payload[] = { 'C', 'C', 'C', 'C', 'C' }; @@ -3431,7 +3425,6 @@ static int StreamTcpReassembleInlineTest09(void) FLOW_INITIALIZE(&f); stream_config.reassembly_toserver_chunk_size = 20; - ssn.client.flags |= STREAMTCP_STREAM_FLAG_GAP; uint8_t payload[] = { 'C', 'C', 'C', 'C', 'C' }; Packet *p = UTHBuildPacketReal(payload, 5, IPPROTO_TCP, "1.1.1.1", "2.2.2.2", 1024, 80); diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 0f49f19a96..59c3da97ff 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -4832,10 +4832,7 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt, goto skip; } - if (p->flow->flags & FLOW_WRONG_THREAD || - ssn->client.flags & STREAMTCP_STREAM_FLAG_GAP || - ssn->server.flags & STREAMTCP_STREAM_FLAG_GAP) - { + if (p->flow->flags & FLOW_WRONG_THREAD) { /* Stream and/or session in known bad condition. Block events * from being set. */ p->flags |= PKT_STREAM_NO_EVENTS;