stream: turn session bool into flag

pull/8546/head
Victor Julien 3 years ago
parent aa7d58b0c7
commit 65f28b075f

@ -165,7 +165,7 @@ static inline void FlowEndCountersUpdate(ThreadVars *tv, FlowEndCounters *fec, F
if (f->proto == IPPROTO_TCP && f->protoctx != NULL) {
TcpSession *ssn = f->protoctx;
StatsIncr(tv, fec->flow_tcp_state[ssn->state]);
if (ssn->lossy_be_liberal) {
if (ssn->flags & STREAMTCP_FLAG_LOSSY_BE_LIBERAL) {
StatsIncr(tv, fec->flow_tcp_liberal);
}
}

@ -189,7 +189,8 @@ enum TcpState {
#define STREAMTCP_FLAG_CLIENT_SACKOK BIT_U32(9)
/** Flag to indicate both sides of the session permit SACK (SYN + SYN/ACK) */
#define STREAMTCP_FLAG_SACKOK BIT_U32(10)
// vacancy
/** Session is in "lossy" state, be liberal */
#define STREAMTCP_FLAG_LOSSY_BE_LIBERAL BIT_U32(11)
/** 3WHS confirmed by server -- if suri sees 3whs ACK but server doesn't (pkt
* is lost on the way to server), SYN/ACK is retransmitted. If server sends
* normal packet we assume 3whs to be completed. Only used for SYN/ACK resend
@ -277,7 +278,6 @@ typedef struct TcpSession_ {
int8_t data_first_seen_dir;
/** track all the tcp flags we've seen */
uint8_t tcp_packet_flags;
bool lossy_be_liberal;
/* coccinelle: TcpSession:flags:STREAMTCP_FLAG */
uint32_t flags;
uint32_t reassembly_depth; /**< reassembly depth for the stream */

@ -781,7 +781,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
if (seg == NULL) {
SCLogDebug("segment_pool is empty");
StreamTcpSetEvent(p, STREAM_REASSEMBLY_NO_SEGMENT);
ssn->lossy_be_liberal = true;
ssn->flags |= STREAMTCP_FLAG_LOSSY_BE_LIBERAL;
SCReturnInt(-1);
}
@ -805,7 +805,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
tv, ra_ctx, stream, seg, p, TCP_GET_SEQ(p), p->payload, p->payload_len);
if (r < 0) {
if (r == -ENOMEM) {
ssn->lossy_be_liberal = true;
ssn->flags |= STREAMTCP_FLAG_LOSSY_BE_LIBERAL;
}
SCLogDebug("StreamTcpReassembleInsertSegment failed");
SCReturnInt(-1);
@ -1253,7 +1253,7 @@ static int ReassembleUpdateAppLayer (ThreadVars *tv,
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
(*stream)->flags |= STREAMTCP_STREAM_FLAG_HAS_GAP;
StatsIncr(tv, ra_ctx->counter_tcp_reass_gap);
ssn->lossy_be_liberal = true;
ssn->flags |= STREAMTCP_FLAG_LOSSY_BE_LIBERAL;
/* AppLayerHandleTCPData has likely updated progress. */
const bool no_progress_update = (app_progress == STREAM_APP_PROGRESS(*stream));

@ -5516,7 +5516,7 @@ static int StreamTcpValidateRst(TcpSession *ssn, Packet *p)
{
uint8_t os_policy;
if (ssn->lossy_be_liberal) {
if (ssn->flags & STREAMTCP_FLAG_LOSSY_BE_LIBERAL) {
SCReturnInt(1);
}

Loading…
Cancel
Save