|
|
|
|
@ -609,8 +609,8 @@ static int StreamTcpPacketStateSynRecv(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -663,7 +663,8 @@ static int StreamTcpPacketStateSynRecv(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
|
break;
|
|
|
|
|
case TH_FIN:
|
|
|
|
|
/*FIN is handled in the same way as in TCP_ESTABLISHED case */;
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -709,7 +710,8 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
case TH_ACK|TH_PUSH:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -835,7 +837,8 @@ static int StreamTcpPacketStateEstablished(ThreadVars *tv, Packet *p, StreamTcpT
|
|
|
|
|
case TH_FIN|TH_ACK:
|
|
|
|
|
case TH_FIN|TH_ACK|TH_PUSH:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1003,7 +1006,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
|
switch (p->tcph->th_flags) {
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1048,7 +1052,8 @@ static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
|
case TH_FIN|TH_ACK:
|
|
|
|
|
case TH_FIN|TH_ACK|TH_PUSH:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1146,7 +1151,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
|
switch (p->tcph->th_flags) {
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1218,7 +1224,8 @@ static int StreamTcpPacketStateFinWait2(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
|
break;
|
|
|
|
|
case TH_FIN:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1305,7 +1312,8 @@ static int StreamTcpPacketStateClosing(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
|
switch(p->tcph->th_flags) {
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1393,7 +1401,8 @@ static int StreamTcpPacketStateCloseWait(ThreadVars *tv, Packet *p, StreamTcpThr
|
|
|
|
|
switch(p->tcph->th_flags) {
|
|
|
|
|
case TH_FIN:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1453,7 +1462,8 @@ static int StreamTcpPakcetStateLastAck(ThreadVars *tv, Packet *p, StreamTcpThrea
|
|
|
|
|
switch(p->tcph->th_flags) {
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1511,7 +1521,8 @@ static int StreamTcpPacketStateTimeWait(ThreadVars *tv, Packet *p, StreamTcpThre
|
|
|
|
|
switch(p->tcph->th_flags) {
|
|
|
|
|
case TH_ACK:
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1723,7 +1734,8 @@ static int ValidReset(TcpSession *ssn, Packet *p) {
|
|
|
|
|
|
|
|
|
|
uint8_t os_policy;
|
|
|
|
|
|
|
|
|
|
if (!ValidTimestamp(ssn, p)) {
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (!ValidTimestamp(ssn, p))
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1877,7 +1889,6 @@ static int ValidTimestamp (TcpSession *ssn, Packet *p) {
|
|
|
|
|
receiver_stream = &ssn->client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((ssn->server.flags & STREAMTCP_FLAG_TIMESTAMP) && (ssn->client.flags & STREAMTCP_FLAG_TIMESTAMP)) {
|
|
|
|
|
if (p->tcpvars.ts != NULL) {
|
|
|
|
|
uint32_t ts = TCP_GET_TSVAL(p);
|
|
|
|
|
|
|
|
|
|
@ -1968,8 +1979,6 @@ static int ValidTimestamp (TcpSession *ssn, Packet *p) {
|
|
|
|
|
receiver_stream->flags &= ~STREAMTCP_FLAG_TIMESTAMP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|