http logging module should log all txs in the list and not just the last complete tx available on EOF

remotes/origin/master-1.1.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent c13ad8c28a
commit 4e44073c79

@ -584,6 +584,48 @@ error:
SCReturnInt(-1);
}
/**
* \brief get the highest loggable transaction id
*/
int HtpTransactionGetLoggableId(Flow *f)
{
SCEnter();
/* Get the parser state (if any) */
if (f->aldata == NULL) {
SCLogDebug("no aldata");
goto error;
}
AppLayerParserStateStore *parser_state_store =
(AppLayerParserStateStore *)f->aldata[app_layer_sid];
if (parser_state_store == NULL) {
SCLogDebug("no state store");
goto error;
}
int id = 0;
HtpState *http_state = f->aldata[AlpGetStateIdx(ALPROTO_HTTP)];
if (http_state == NULL) {
SCLogDebug("no http state");
goto error;
}
if (parser_state_store->id_flags & APP_LAYER_TRANSACTION_EOF) {
SCLogDebug("eof, return current transaction as well");
id = (int)(list_size(http_state->connp->conn->transactions));
} else {
id = (int)(parser_state_store->avail_id - 1);
}
SCReturnInt(id);
error:
SCReturnInt(-1);
}
/**
* \brief Print the information and chunks of a Body
* \param body pointer to the HtpBody holding the list

@ -112,6 +112,7 @@ void HTPFreeConfig(void);
htp_tx_t *HTPTransactionMain(const HtpState *);
int HTPCallbackRequestBodyData(htp_tx_data_t *);
int HtpTransactionGetLoggableId(Flow *);
void HtpBodyPrint(HtpBody *);
void HtpBodyFree(HtpBody *);
void AppLayerHtpRegisterExtraCallbacks(void);

@ -56,7 +56,7 @@
#include "util-debug.h"
static uint16_t app_layer_sid = 0;
uint16_t app_layer_sid = 0;
static AppLayerProto al_proto_table[ALPROTO_MAX]; /**< Application layer protocol
table mapped to their
corresponding parsers */

@ -215,6 +215,8 @@ extern uint16_t app_layer_sid;
struct AlpProtoDetectCtx_;
extern uint16_t app_layer_sid;
/* prototypes */
void AppLayerParsersInitPostProcess(void);
void RegisterAppLayerParsers(void);

@ -129,7 +129,7 @@ TmEcode LogHttpLogIPv4(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P
}
size_t logged = (size_t)r;
r = AppLayerTransactionGetLoggableId(p->flow);
r = HtpTransactionGetLoggableId(p->flow);
if (r < 0) {
goto end;
}
@ -245,7 +245,7 @@ TmEcode LogHttpLogIPv6(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P
}
size_t logged = (size_t)r;
r = AppLayerTransactionGetLoggableId(p->flow);
r = HtpTransactionGetLoggableId(p->flow);
if (r < 0) {
goto end;
}

Loading…
Cancel
Save