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;
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))

@ -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;

@ -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. */

@ -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;

@ -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 */

@ -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);

@ -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;

Loading…
Cancel
Save