if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION) ||
!(ssn.flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) ||
- !(((TcpSession *)f.protoctx)->server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) ||
- !(((TcpSession *)f.protoctx)->client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
+ !(((TcpSession *)f.protoctx)->server.flags & STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED) ||
+ !(((TcpSession *)f.protoctx)->client.flags & STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED)) {
goto end;
}
stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY;
SCLogDebug("ssn %p: reassembly depth reached, "
"STREAMTCP_STREAM_FLAG_NOREASSEMBLY set", ssn);
+ } else if ((ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED) &&
+ (stream->flags & STREAMTCP_STREAM_FLAG_DISABLE_RAW))
+ {
+ SCLogDebug("ssn %p: both app and raw are done, "
+ "STREAMTCP_STREAM_FLAG_NOREASSEMBLY set", ssn);
+ stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY;
}
uint64_t left_edge = GetLeftEdge(ssn, stream);
* 2. progress is 0, meaning the detect engine didn't touch
* raw at all. In this case we need to look into progressing
* raw anyway.
+ *
+ * Additionally, this function is tasked with disabling raw
+ * reassembly if the app-layer requested to disable it.
*/
void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, uint64_t progress)
{
(uint)STREAM_RAW_PROGRESS(stream), (uint)stream->window);
}
+ /* if we were told to accept no more raw data, we can mark raw as
+ * disabled now. */
if (stream->flags & STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED) {
stream->flags |= STREAMTCP_STREAM_FLAG_DISABLE_RAW;
SCLogDebug("ssn %p: STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED set, "
SCReturnInt(-1);
}
-/** \brief Set the No reassembly flag for the given direction in given TCP
- * session.
+/** \brief disable reassembly
+
+ * Disable app layer and set raw inspect to no longer accept new data.
+ * Stream engine will then fully disable raw after last inspection.
*
* \param ssn TCP Session to set the flag in
* \param direction direction to set the flag in: 0 toserver, 1 toclient
*/
void StreamTcpSetSessionNoReassemblyFlag (TcpSession *ssn, char direction)
{
- direction ? (ssn->server.flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY) :
- (ssn->client.flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY);
+ ssn->flags |= STREAMTCP_FLAG_APP_LAYER_DISABLED;
+ if (direction) {
+ ssn->server.flags |= STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED;
+ } else {
+ ssn->client.flags |= STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED;
+ }
}
/** \brief Set the No reassembly flag for the given direction in given TCP