From b0f5f7ee97d1d14923bb62c68e81172f56d0dc5b Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 15 Jul 2015 13:08:22 +0200 Subject: [PATCH] app-layer: fix args to state progress calls --- src/output-streaming.c | 12 ++++++++---- src/output-tx.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/output-streaming.c b/src/output-streaming.c index 35e40d0c62..bc2a7d4be0 100644 --- a/src/output-streaming.c +++ b/src/output-streaming.c @@ -147,9 +147,11 @@ int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags) HtpState *s = f->alstate; if (s != NULL && s->conn != NULL) { int tx_progress_done_value_ts = - AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, ALPROTO_HTTP, 0); + AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, + ALPROTO_HTTP, STREAM_TOSERVER); int tx_progress_done_value_tc = - AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, ALPROTO_HTTP, 1); + AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, + ALPROTO_HTTP, STREAM_TOCLIENT); // for each tx uint64_t tx_id = 0; @@ -161,9 +163,11 @@ int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags) int tx_done = 0; int tx_logged = 0; - int tx_progress_ts = AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, 0); + int tx_progress_ts = AppLayerParserGetStateProgress( + IPPROTO_TCP, ALPROTO_HTTP, tx, STREAM_TOSERVER); if (tx_progress_ts >= tx_progress_done_value_ts) { - int tx_progress_tc = AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, 1); + int tx_progress_tc = AppLayerParserGetStateProgress( + IPPROTO_TCP, ALPROTO_HTTP, tx, STREAM_TOCLIENT); if (tx_progress_tc >= tx_progress_done_value_tc) { tx_done = 1; } diff --git a/src/output-tx.c b/src/output-tx.c index 9bb7c277db..aa48d9e121 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -104,14 +104,14 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ Flow * const f = p->flow; FLOWLOCK_WRLOCK(f); /* WRITE lock before we updated flow logged id */ - AppProto alproto = f->alproto;//AppLayerGetProtoFromPacket(p); + AppProto alproto = f->alproto; if (AppLayerParserProtocolIsTxAware(p->proto, alproto) == 0) goto end; if (AppLayerParserProtocolHasLogger(p->proto, alproto) == 0) goto end; - void *alstate = f->alstate;//AppLayerGetProtoStateFromPacket((const Packet *)p); + void *alstate = f->alstate; if (alstate == NULL) { SCLogDebug("no alstate"); goto end; @@ -120,9 +120,11 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ uint64_t total_txs = AppLayerParserGetTxCnt(p->proto, alproto, alstate); uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser); int tx_progress_done_value_ts = - AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, 0); + AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, + STREAM_TOSERVER); int tx_progress_done_value_tc = - AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, 1); + AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, + STREAM_TOCLIENT); int proto_logged = 0; for (; tx_id < total_txs; tx_id++) @@ -135,13 +137,15 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ if (!(AppLayerParserStateIssetFlag(f->alparser, APP_LAYER_PARSER_EOF))) { - int tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, tx, 0); + int tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, + tx, STREAM_TOSERVER); if (tx_progress < tx_progress_done_value_ts) { SCLogDebug("progress not far enough, not logging"); break; } - tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, tx, 1); + tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, + tx, STREAM_TOCLIENT); if (tx_progress < tx_progress_done_value_tc) { SCLogDebug("progress not far enough, not logging"); break; -- 2.47.2