stream: remove GAP flag from stream

This flag was checked in many places, but never set expect in 2 unittests.
pull/5442/head
Victor Julien 5 years ago
parent c5ace81a27
commit 34e83b8acf

@ -209,12 +209,8 @@ static void TCPProtoDetectCheckBailConditions(ThreadVars *tv,
STREAM_RIGHT_EDGE(&ssn->server) : 0; STREAM_RIGHT_EDGE(&ssn->server) : 0;
SCLogDebug("size_ts %"PRIu64", size_tc %"PRIu64, size_ts, size_tc); SCLogDebug("size_ts %"PRIu64", size_tc %"PRIu64, size_ts, size_tc);
#ifdef DEBUG_VALIDATION DEBUG_VALIDATE_BUG_ON(size_ts > 1000000UL);
if (!(ssn->client.flags & STREAMTCP_STREAM_FLAG_GAP)) DEBUG_VALIDATE_BUG_ON(size_tc > 1000000UL);
BUG_ON(size_ts > 1000000UL);
if (!(ssn->server.flags & STREAMTCP_STREAM_FLAG_GAP))
BUG_ON(size_tc > 1000000UL);
#endif /* DEBUG_VALIDATION */
if (ProtoDetectDone(f, ssn, STREAM_TOSERVER) && if (ProtoDetectDone(f, ssn, STREAM_TOSERVER) &&
ProtoDetectDone(f, ssn, STREAM_TOCLIENT)) ProtoDetectDone(f, ssn, STREAM_TOCLIENT))

@ -1127,9 +1127,6 @@ uint8_t FlowGetDisruptionFlags(const Flow *f, uint8_t flags)
if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) { if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) {
newflags |= STREAM_DEPTH; newflags |= STREAM_DEPTH;
} }
if (stream->flags & STREAMTCP_STREAM_FLAG_GAP) {
newflags |= STREAM_GAP;
}
/* todo: handle pass case (also for UDP!) */ /* todo: handle pass case (also for UDP!) */
return newflags; return newflags;

@ -315,10 +315,6 @@ static void EveFlowLogJSON(JsonFlowLogThread *aft, JsonBuilder *jb, Flow *f)
const char *tcp_state = StreamTcpStateAsString(ssn->state); const char *tcp_state = StreamTcpStateAsString(ssn->state);
if (tcp_state != NULL) if (tcp_state != NULL)
jb_set_string(jb, "state", tcp_state); 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. */ /* Close tcp. */

@ -636,7 +636,7 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
static inline bool SegmentInUse(const TcpStream *stream, const TcpSegment *seg) static inline bool SegmentInUse(const TcpStream *stream, const TcpSegment *seg)
{ {
/* if proto detect isn't done, we're not returning */ /* 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))) { if (!(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream))) {
SCReturnInt(true); SCReturnInt(true);
} }
@ -672,9 +672,7 @@ static inline uint64_t GetLeftEdge(TcpSession *ssn, TcpStream *stream)
bool use_log = true; bool use_log = true;
uint64_t left_edge = 0; uint64_t left_edge = 0;
if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED)) {
(stream->flags & STREAMTCP_STREAM_FLAG_GAP))
{
use_app = false; // app is dead use_app = false; // app is dead
} }
@ -829,10 +827,8 @@ void StreamTcpPruneSession(Flow *f, uint8_t flags)
StreamingBufferClear(&stream->sb); StreamingBufferClear(&stream->sb);
return; return;
} else if (((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || } else if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) &&
(stream->flags & STREAMTCP_STREAM_FLAG_GAP)) && (stream->flags & STREAMTCP_STREAM_FLAG_DISABLE_RAW)) {
(stream->flags & STREAMTCP_STREAM_FLAG_DISABLE_RAW))
{
SCLogDebug("ssn %p / stream %p: both app and raw are done, " SCLogDebug("ssn %p / stream %p: both app and raw are done, "
"STREAMTCP_STREAM_FLAG_NOREASSEMBLY set", ssn, stream); "STREAMTCP_STREAM_FLAG_NOREASSEMBLY set", ssn, stream);
stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY; stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY;

@ -195,8 +195,7 @@ enum TcpState
* Per STREAM flags * Per STREAM flags
*/ */
/** stream is in a gap state */ // bit 0 vacant
#define STREAMTCP_STREAM_FLAG_GAP BIT_U16(0)
/** Flag to avoid stream reassembly/app layer inspection for the stream */ /** Flag to avoid stream reassembly/app layer inspection for the stream */
#define STREAMTCP_STREAM_FLAG_NOREASSEMBLY BIT_U16(1) #define STREAMTCP_STREAM_FLAG_NOREASSEMBLY BIT_U16(1)
/** we received a keep alive */ /** we received a keep alive */

@ -807,9 +807,7 @@ int StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction)
int use_app = 1; int use_app = 1;
int use_raw = 1; int use_raw = 1;
if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) || if (ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) {
(stream->flags & STREAMTCP_STREAM_FLAG_GAP))
{
// app is dead // app is dead
use_app = 0; use_app = 0;
} }
@ -1360,11 +1358,8 @@ void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, uint64_t prog
stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW; stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW;
/* if app is active and beyond raw, sync raw to app */ /* if app is active and beyond raw, sync raw to app */
} else if (progress == 0 && } else if (progress == 0 && STREAM_APP_PROGRESS(stream) > STREAM_RAW_PROGRESS(stream) &&
STREAM_APP_PROGRESS(stream) > STREAM_RAW_PROGRESS(stream) && !(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED)) {
!(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) &&
!(stream->flags & STREAMTCP_STREAM_FLAG_GAP))
{
/* if trigger raw is set we sync the 2 trackers */ /* if trigger raw is set we sync the 2 trackers */
if (stream->flags & STREAMTCP_STREAM_FLAG_TRIGGER_RAW) if (stream->flags & STREAMTCP_STREAM_FLAG_TRIGGER_RAW)
{ {
@ -3379,7 +3374,6 @@ static int StreamTcpReassembleInlineTest08(void)
FLOW_INITIALIZE(&f); FLOW_INITIALIZE(&f);
stream_config.reassembly_toserver_chunk_size = 15; stream_config.reassembly_toserver_chunk_size = 15;
ssn.client.flags |= STREAMTCP_STREAM_FLAG_GAP;
f.protoctx = &ssn; f.protoctx = &ssn;
uint8_t payload[] = { 'C', 'C', 'C', 'C', 'C' }; uint8_t payload[] = { 'C', 'C', 'C', 'C', 'C' };
@ -3431,7 +3425,6 @@ static int StreamTcpReassembleInlineTest09(void)
FLOW_INITIALIZE(&f); FLOW_INITIALIZE(&f);
stream_config.reassembly_toserver_chunk_size = 20; stream_config.reassembly_toserver_chunk_size = 20;
ssn.client.flags |= STREAMTCP_STREAM_FLAG_GAP;
uint8_t payload[] = { 'C', 'C', 'C', 'C', 'C' }; 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); Packet *p = UTHBuildPacketReal(payload, 5, IPPROTO_TCP, "1.1.1.1", "2.2.2.2", 1024, 80);

@ -4832,10 +4832,7 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
goto skip; goto skip;
} }
if (p->flow->flags & FLOW_WRONG_THREAD || if (p->flow->flags & FLOW_WRONG_THREAD) {
ssn->client.flags & STREAMTCP_STREAM_FLAG_GAP ||
ssn->server.flags & STREAMTCP_STREAM_FLAG_GAP)
{
/* Stream and/or session in known bad condition. Block events /* Stream and/or session in known bad condition. Block events
* from being set. */ * from being set. */
p->flags |= PKT_STREAM_NO_EVENTS; p->flags |= PKT_STREAM_NO_EVENTS;

Loading…
Cancel
Save