|
|
@ -316,6 +316,8 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p, StreamTcpThread *
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("ssn %p: ssn->client.isn %" PRIu32 ", ssn->client.next_seq %" PRIu32 ", ssn->client.last_ack %"PRIu32"",
|
|
|
|
SCLogDebug("ssn %p: ssn->client.isn %" PRIu32 ", ssn->client.next_seq %" PRIu32 ", ssn->client.last_ack %"PRIu32"",
|
|
|
|
ssn, ssn->client.isn, ssn->client.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->client.isn, ssn->client.next_seq, ssn->client.last_ack);
|
|
|
|
|
|
|
|
if ( p->flowflags & FLOW_PKT_NOCLIENT_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->client.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case TH_SYN|TH_ACK:
|
|
|
|
case TH_SYN|TH_ACK:
|
|
|
@ -377,6 +379,9 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p, StreamTcpThread *
|
|
|
|
ssn->client.last_ts = 0;
|
|
|
|
ssn->client.last_ts = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (p->flowflags & FLOW_PKT_NOSERVER_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->server.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
/* Handle SYN/ACK and 3WHS shake missed together as it is almost similar. */
|
|
|
|
/* Handle SYN/ACK and 3WHS shake missed together as it is almost similar. */
|
|
|
|
case TH_ACK:
|
|
|
|
case TH_ACK:
|
|
|
@ -441,7 +446,14 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p, StreamTcpThread *
|
|
|
|
ssn->client.last_ts = 0;
|
|
|
|
ssn->client.last_ts = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if ( p->flowflags & FLOW_PKT_NOCLIENT_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->client.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
|
|
|
|
if (p->flowflags & FLOW_PKT_NOSERVER_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->server.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*If no stream reassembly/application layer protocol inspection, then simple return*/
|
|
|
|
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
@ -535,6 +547,9 @@ static int StreamTcpPacketStateSynSent(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
SCLogDebug("ssn %p: ssn->client.next_win %" PRIu32 "", ssn, ssn->client.next_win);
|
|
|
|
SCLogDebug("ssn %p: ssn->client.next_win %" PRIu32 "", ssn, ssn->client.next_win);
|
|
|
|
SCLogDebug("ssn %p: ssn->server.isn %" PRIu32 ", ssn->server.next_seq %" PRIu32 ", ssn->server.last_ack %" PRIu32 " (ssn->client.last_ack %" PRIu32 ")",
|
|
|
|
SCLogDebug("ssn %p: ssn->server.isn %" PRIu32 ", ssn->server.next_seq %" PRIu32 ", ssn->server.last_ack %" PRIu32 " (ssn->client.last_ack %" PRIu32 ")",
|
|
|
|
ssn, ssn->server.isn, ssn->server.next_seq, ssn->server.last_ack, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.isn, ssn->server.next_seq, ssn->server.last_ack, ssn->client.last_ack);
|
|
|
|
|
|
|
|
if (p->flowflags & FLOW_PKT_NOSERVER_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->server.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
@ -613,6 +628,9 @@ static int StreamTcpPacketStateSynRecv(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
|
|
|
|
|
|
|
|
ssn->server.next_win = ssn->server.last_ack + ssn->server.window;
|
|
|
|
ssn->server.next_win = ssn->server.last_ack + ssn->server.window;
|
|
|
|
SCLogDebug("ssn %p: ssn->server.next_win %" PRIu32 ", ssn->server.last_ack %"PRIu32"", ssn, ssn->server.next_win, ssn->server.last_ack);
|
|
|
|
SCLogDebug("ssn %p: ssn->server.next_win %" PRIu32 ", ssn->server.last_ack %"PRIu32"", ssn, ssn->server.next_win, ssn->server.last_ack);
|
|
|
|
|
|
|
|
if ( p->flowflags & FLOW_PKT_NOCLIENT_REASSEMBLY)
|
|
|
|
|
|
|
|
ssn->client.flags |= STREAMTCP_FLAG_NO_REASSEMBLY;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
|
case TH_RST|TH_ACK:
|
|
|
@ -696,7 +714,9 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
SCLogDebug("ssn %p: seq %"PRIu32", updated ssn->server.next_win %" PRIu32 " (win %"PRIu32")", ssn, TCP_GET_SEQ(p), ssn->server.next_win, ssn->server.window);
|
|
|
|
SCLogDebug("ssn %p: seq %"PRIu32", updated ssn->server.next_win %" PRIu32 " (win %"PRIu32")", ssn, TCP_GET_SEQ(p), ssn->server.next_win, ssn->server.window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
/*If no stream reassembly/application layer protocol inspection, then simple return*/
|
|
|
|
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
SCLogDebug("ssn %p: server => SEQ out of window, packet SEQ %" PRIu32 ", payload size %" PRIu32 " (%" PRIu32 "), ssn->client.last_ack %" PRIu32 ", ssn->client.next_win %" PRIu32 "(%"PRIu32") (ssn->client.ra_base_seq %"PRIu32")", ssn, TCP_GET_SEQ(p), p->payload_len, TCP_GET_SEQ(p) + p->payload_len, ssn->client.last_ack, ssn->client.next_win, TCP_GET_SEQ(p) + p->payload_len - ssn->client.next_win, ssn->client.ra_base_seq);
|
|
|
|
SCLogDebug("ssn %p: server => SEQ out of window, packet SEQ %" PRIu32 ", payload size %" PRIu32 " (%" PRIu32 "), ssn->client.last_ack %" PRIu32 ", ssn->client.next_win %" PRIu32 "(%"PRIu32") (ssn->client.ra_base_seq %"PRIu32")", ssn, TCP_GET_SEQ(p), p->payload_len, TCP_GET_SEQ(p) + p->payload_len, ssn->client.last_ack, ssn->client.next_win, TCP_GET_SEQ(p) + p->payload_len - ssn->client.next_win, ssn->client.ra_base_seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -741,7 +761,9 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
SCLogDebug("ssn %p: seq %"PRIu32", keeping ssn->client.next_win %" PRIu32 " the same (win %"PRIu32")", ssn, TCP_GET_SEQ(p), ssn->client.next_win, ssn->client.window);
|
|
|
|
SCLogDebug("ssn %p: seq %"PRIu32", keeping ssn->client.next_win %" PRIu32 " the same (win %"PRIu32")", ssn, TCP_GET_SEQ(p), ssn->client.next_win, ssn->client.window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
/*If no stream reassembly/application layer protocol inspection, then simple return*/
|
|
|
|
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
SCLogDebug("ssn %p: client => SEQ out of window, packet SEQ %" PRIu32 ", payload size %" PRIu32 " (%" PRIu32 "), ssn->server.last_ack %" PRIu32 ", ssn->server.next_win %" PRIu32 "(%"PRIu32") (ssn->server.ra_base_seq %"PRIu32")", ssn, TCP_GET_SEQ(p), p->payload_len, TCP_GET_SEQ(p) + p->payload_len, ssn->server.last_ack, ssn->server.next_win, TCP_GET_SEQ(p) + p->payload_len - ssn->server.next_win, ssn->server.ra_base_seq);
|
|
|
|
SCLogDebug("ssn %p: client => SEQ out of window, packet SEQ %" PRIu32 ", payload size %" PRIu32 " (%" PRIu32 "), ssn->server.last_ack %" PRIu32 ", ssn->server.next_win %" PRIu32 "(%"PRIu32") (ssn->server.ra_base_seq %"PRIu32")", ssn, TCP_GET_SEQ(p), p->payload_len, TCP_GET_SEQ(p) + p->payload_len, ssn->server.last_ack, ssn->server.next_win, TCP_GET_SEQ(p) + p->payload_len - ssn->server.next_win, ssn->server.ra_base_seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -782,7 +804,8 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -798,7 +821,8 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -844,7 +868,8 @@ static int StreamTcpHandleFin(StreamTcpThread *stt, TcpSession *ssn, Packet *p)
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
@ -868,7 +893,8 @@ static int StreamTcpHandleFin(StreamTcpThread *stt, TcpSession *ssn, Packet *p)
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
@ -910,7 +936,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else { /* implied to client */
|
|
|
|
} else { /* implied to client */
|
|
|
@ -923,7 +950,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -955,7 +983,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else { /* implied to client */
|
|
|
|
} else { /* implied to client */
|
|
|
@ -976,7 +1005,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1037,7 +1067,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else { /* implied to client */
|
|
|
|
} else { /* implied to client */
|
|
|
@ -1057,7 +1088,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1095,7 +1127,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
@ -1116,7 +1149,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1169,7 +1203,8 @@ static int StreamTcpPacketStateClosing(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else { /* implied to client */
|
|
|
|
} else { /* implied to client */
|
|
|
@ -1189,7 +1224,8 @@ static int StreamTcpPacketStateClosing(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("StreamTcpPacketStateClosing (%p): =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("StreamTcpPacketStateClosing (%p): =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1240,7 +1276,8 @@ static int StreamTcpPacketStateCloseWait(ThreadVars *tv, Packet *p, StreamTcpThr
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1292,7 +1329,8 @@ static int StreamTcpPakcetStateLastAck(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1344,7 +1382,8 @@ static int StreamTcpPacketStateTimeWait(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->server.last_ack))
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->server.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
if (ssn->client.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->client, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
ssn, ssn->client.next_seq, ssn->server.last_ack);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -1364,7 +1403,8 @@ static int StreamTcpPacketStateTimeWait(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
if (SEQ_GT(TCP_GET_ACK(p),ssn->client.last_ack))
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
ssn->client.last_ack = TCP_GET_ACK(p);
|
|
|
|
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
if (ssn->server.flags & STREAMTCP_FLAG_NO_REASSEMBLY)
|
|
|
|
|
|
|
|
StreamTcpReassembleHandleSegment(stt->ra_ctx, ssn, &ssn->server, p);
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
SCLogDebug("ssn %p: =+ next SEQ %" PRIu32 ", last ACK %" PRIu32 "",
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
ssn, ssn->server.next_seq, ssn->client.last_ack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|