stream: pass TcpSession to StreamTcpReassembleProcessAppLayer

Preparation for removing flow pointer from StreamMsg. Instead of
getting the ssn indirectly through StreamMsg->flow, we pass it
directly as all callers have it already.
pull/759/head
Victor Julien 12 years ago
parent 0ec375d95a
commit 1d08a3ff26

@ -351,11 +351,20 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
SCReturnInt(r);
}
int AppLayerHandleTCPMsg(StreamMsg *smsg)
/**
* \brief Attach a stream message to the TCP session for inspection
* in the detection engine.
*
* \param dp_ctx Thread app layer detect context
* \param smsg Stream message
*
* \retval 0 ok
* \retval -1 error
*/
int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
{
SCEnter();
TcpSession *ssn;
StreamMsg *cur;
#ifdef PRINT
@ -368,7 +377,6 @@ int AppLayerHandleTCPMsg(StreamMsg *smsg)
SCLogDebug("smsg %p", smsg);
BUG_ON(smsg->flow == NULL);
ssn = smsg->flow->protoctx;
if (ssn != NULL) {
SCLogDebug("storing smsg %p in the tcp session", smsg);

@ -55,7 +55,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
* \retval 0 On success.
* \retval -1 On failure.
*/
int AppLayerHandleTCPMsg(StreamMsg *smsg);
int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn);
/**
* \brief Handles an udp chunk.

@ -563,7 +563,7 @@ static inline void FlowForceReassemblyForHash(void)
stt->ra_ctx, ssn, &ssn->server,
reassemble_p, NULL);
FlowDeReference(&reassemble_p->flow);
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx, ssn) < 0) {
SCLogDebug("shutdown flow timeout "
"StreamTcpReassembleProcessAppLayer() erroring "
"over something");
@ -581,7 +581,7 @@ static inline void FlowForceReassemblyForHash(void)
stt->ra_ctx, ssn, &ssn->client,
reassemble_p, NULL);
FlowDeReference(&reassemble_p->flow);
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx, ssn) < 0) {
SCLogDebug("shutdown flow timeout "
"StreamTcpReassembleProcessAppLayer() erroring "
"over something");

@ -3393,7 +3393,7 @@ int StreamTcpReassembleHandleSegmentUpdateACK (ThreadVars *tv,
* \retval 0 ok
* \retval -1 error
*/
int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx)
int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx, TcpSession *ssn)
{
SCEnter();
@ -3417,7 +3417,7 @@ int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx)
/* Handle the stream msg. No need to use locking, flow is
* already locked at this point. Don't break out of the
* loop if we encounter an error. */
if (AppLayerHandleTCPMsg(smsg) != 0)
if (AppLayerHandleTCPMsg(smsg, ssn) != 0)
r = -1;
}
@ -5281,7 +5281,7 @@ static int StreamTcpReassembleTest28 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (3): ");
goto end;
}
@ -5365,7 +5365,7 @@ static int StreamTcpReassembleTest29 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
@ -5450,7 +5450,7 @@ static int StreamTcpReassembleTest30 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
@ -5474,7 +5474,7 @@ static int StreamTcpReassembleTest30 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
@ -6867,7 +6867,7 @@ static int StreamTcpReassembleTest40 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (4): ");
goto end;
}
@ -6914,7 +6914,7 @@ static int StreamTcpReassembleTest40 (void) {
"been sent (8): ");
goto end;
/* Process stream smsgs we may have in queue */
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (9): ");
goto end;
}
@ -6953,7 +6953,7 @@ static int StreamTcpReassembleTest40 (void) {
"been sent (12): ");
goto end;
/* Process stream smsgs we may have in queue */
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (13): ");
goto end;
}
@ -6993,7 +6993,7 @@ static int StreamTcpReassembleTest40 (void) {
/* Process stream smsgs we may have in queue */
}
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (17): ");
goto end;
}
@ -7130,7 +7130,7 @@ static int StreamTcpReassembleTest43 (void) {
printf("there should be a stream smsgs in the queue (6): ");
goto end;
/* Process stream smsgs we may have in queue */
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (7): ");
goto end;
}
@ -7184,7 +7184,7 @@ static int StreamTcpReassembleTest43 (void) {
" been unpaused now (12): ");
goto end;
/* Process stream smsgs we may have in queue */
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
} else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (13): ");
goto end;
}
@ -7572,7 +7572,7 @@ static int StreamTcpReassembleTest47 (void) {
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}

@ -84,7 +84,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
TcpReassemblyThreadCtx *ra_ctx,
TcpSession *ssn, TcpStream *stream,
Packet *p);
int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *);
int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *, TcpSession *);
void StreamTcpCreateTestPacket(uint8_t *, uint8_t, uint8_t, uint8_t);

@ -4374,7 +4374,7 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
}
/* Process stream smsgs we may have in queue */
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx, ssn) < 0) {
goto error;
}

Loading…
Cancel
Save