diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 0d6408dc7b..2eced26486 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -598,16 +598,15 @@ void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto, SCReturn; } -int AppLayerParserGetTxLogged(uint8_t ipproto, AppProto alproto, +int AppLayerParserGetTxLogged(const Flow *f, void *alstate, void *tx, uint32_t logger) { SCEnter(); uint8_t r = 0; - if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto]. - StateGetTxLogged != NULL) { - r = alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto]. - StateGetTxLogged(alstate, tx, logger); + if (alp_ctx.ctxs[f->protomap][f->alproto].StateGetTxLogged != NULL) { + r = alp_ctx.ctxs[f->protomap][f->alproto]. + StateGetTxLogged(alstate, tx, logger); } SCReturnInt(r); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 8318ef34e6..dc8667b028 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -169,7 +169,7 @@ void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_ void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate, void *tx, uint32_t logger); -int AppLayerParserGetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate, +int AppLayerParserGetTxLogged(const Flow *f, void *alstate, void *tx, uint32_t logger); uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction); diff --git a/src/output-tx.c b/src/output-tx.c index 326d881b04..b9c869c3ae 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -138,11 +138,11 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) OutputLoggerThreadData *op_thread_data = (OutputLoggerThreadData *)thread_data; OutputTxLogger *logger = list; OutputLoggerThreadStore *store = op_thread_data->store; - +#ifdef DEBUG_VALIDATION BUG_ON(logger == NULL && store != NULL); BUG_ON(logger != NULL && store == NULL); BUG_ON(logger == NULL && store == NULL); - +#endif if (p->flow == NULL) return TM_ECODE_OK; @@ -161,6 +161,8 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) goto end; } + const uint8_t ts_disrupt_flags = FlowGetDisruptionFlags(f, STREAM_TOSERVER); + const uint8_t tc_disrupt_flags = FlowGetDisruptionFlags(f, STREAM_TOCLIENT); const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser); uint64_t max_id = tx_id; @@ -182,10 +184,10 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) } int tx_progress_ts = AppLayerParserGetStateProgress(p->proto, alproto, - tx, FlowGetDisruptionFlags(f, STREAM_TOSERVER)); + tx, ts_disrupt_flags); int tx_progress_tc = AppLayerParserGetStateProgress(p->proto, alproto, - tx, FlowGetDisruptionFlags(f, STREAM_TOCLIENT)); + tx, tc_disrupt_flags); SCLogDebug("tx_progress_ts %d tx_progress_tc %d", tx_progress_ts, tx_progress_tc); @@ -204,8 +206,7 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) number_of_loggers++; - if (AppLayerParserGetTxLogged(p->proto, alproto, alstate, tx, - logger->id)) { + if (AppLayerParserGetTxLogged(f, alstate, tx, logger->id)) { SCLogDebug("logger has already logged this transaction"); loggers_that_logged++; goto next; @@ -246,9 +247,10 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) next: logger = logger->next; store = store->next; - +#ifdef DEBUG_VALIDATION BUG_ON(logger == NULL && store != NULL); BUG_ON(logger != NULL && store == NULL); +#endif } /* If all loggers logged set a flag and update the last tx_id