Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ static void DetectRun(ThreadVars *th_v,
/* run tx/state inspection. Don't call for ICMP error msgs. */
if (pflow && pflow->alstate && likely(pflow->proto == p->proto)) {
if (p->proto == IPPROTO_TCP) {
if ((p->flags & PKT_STREAM_EST) == 0) {
goto end;
}
const TcpSession *ssn = p->flow->protoctx;
if (ssn && (ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) == 0) {
// PACKET_PROFILING_DETECT_START(p, PROF_DETECT_TX);
Expand Down
25 changes: 14 additions & 11 deletions src/flow-worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,9 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data)
StreamTcpSessionCleanup(p->flow->protoctx);
}
} else if (p->proto == IPPROTO_TCP && p->flow->protoctx) {
FramesPrune(p->flow, p);
if (p->flags & PKT_STREAM_EST) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we still call StreamTcpPruneSession in this case? Seems not. Why would an error packet have any effect on state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

FramesPrune(p->flow, p);
}
FLOWWORKER_PROFILING_START(p, PROFILE_FLOWWORKER_TCPPRUNE);
StreamTcpPruneSession(p->flow, p->flowflags & FLOW_PKT_TOSERVER ?
STREAM_TOSERVER : STREAM_TOCLIENT);
Expand All @@ -631,18 +633,19 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data)

if ((PKT_IS_PSEUDOPKT(p)) ||
(p->flow->flags & (FLOW_TS_APP_UPDATED | FLOW_TC_APP_UPDATED))) {
if (PKT_IS_TOSERVER(p)) {
if (PKT_IS_PSEUDOPKT(p) || (p->flow->flags & (FLOW_TS_APP_UPDATED))) {
AppLayerParserTransactionsCleanup(p->flow, STREAM_TOSERVER);
p->flow->flags &= ~FLOW_TS_APP_UPDATED;
}
} else {
if (PKT_IS_PSEUDOPKT(p) || (p->flow->flags & (FLOW_TC_APP_UPDATED))) {
AppLayerParserTransactionsCleanup(p->flow, STREAM_TOCLIENT);
p->flow->flags &= ~FLOW_TC_APP_UPDATED;
if ((p->flags & PKT_STREAM_EST) || p->proto != IPPROTO_TCP) {
if (PKT_IS_TOSERVER(p)) {
if (PKT_IS_PSEUDOPKT(p) || (p->flow->flags & (FLOW_TS_APP_UPDATED))) {
AppLayerParserTransactionsCleanup(p->flow, STREAM_TOSERVER);
p->flow->flags &= ~FLOW_TS_APP_UPDATED;
}
} else {
if (PKT_IS_PSEUDOPKT(p) || (p->flow->flags & (FLOW_TC_APP_UPDATED))) {
AppLayerParserTransactionsCleanup(p->flow, STREAM_TOCLIENT);
p->flow->flags &= ~FLOW_TC_APP_UPDATED;
}
}
}

} else {
SCLogDebug("not pseudo, no app update: skip");
}
Expand Down
3 changes: 3 additions & 0 deletions src/output-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data)
SCLogDebug("not pseudo, no app update: skip");
return TM_ECODE_OK;
}
if ((p->flags & PKT_STREAM_EST) == 0 && p->proto == IPPROTO_TCP) {
return TM_ECODE_OK;
}
SCLogDebug("pseudo, or app update: run output");

OutputTxLoggerThreadData *op_thread_data = (OutputTxLoggerThreadData *)thread_data;
Expand Down