Skip to content

Commit

Permalink
output: use flow's proto for file loggers
Browse files Browse the repository at this point in the history
As there can be an ICMP packet which gets related to a TCP flow.

Ticket: OISF#5408
  • Loading branch information
catenacyber authored and benignbala committed Nov 12, 2022
1 parent 48aa25b commit 1d352ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/output-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ int OutputRegisterFileLogger(LoggerId id, const char *name, FileLogger LogFunc,
static void CloseFile(const Packet *p, Flow *f, File *file)
{
DEBUG_VALIDATE_BUG_ON((file->flags & FILE_LOGGED) != 0);
void *txv = AppLayerParserGetTx(p->proto, f->alproto, f->alstate, file->txid);
void *txv = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, file->txid);
if (txv) {
AppLayerTxData *txd = AppLayerParserGetTxData(p->proto, f->alproto, txv);
AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, txv);
if (txd) {
txd->files_logged++;
DEBUG_VALIDATE_BUG_ON(txd->files_logged > txd->files_opened);
Expand Down
4 changes: 2 additions & 2 deletions src/output-filedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ static int CallLoggers(ThreadVars *tv, OutputLoggerThreadStore *store_list,

static void CloseFile(const Packet *p, Flow *f, File *file)
{
void *txv = AppLayerParserGetTx(p->proto, f->alproto, f->alstate, file->txid);
void *txv = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, file->txid);
if (txv) {
AppLayerTxData *txd = AppLayerParserGetTxData(p->proto, f->alproto, txv);
AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, txv);
if (txd)
txd->files_stored++;
}
Expand Down

0 comments on commit 1d352ba

Please sign in to comment.