nfs: add to fileinfo events

pull/2791/head
Victor Julien 8 years ago
parent db2d928151
commit e8dae2e093

@ -721,7 +721,7 @@ impl NFSState {
tx.type_data = Some(NFSTransactionTypeData::FILE(NFSTransactionFile::new()));
match tx.type_data {
Some(NFSTransactionTypeData::FILE(ref mut d)) => {
d.file_tracker.tx_id = tx.id;
d.file_tracker.tx_id = tx.id - 1;
},
_ => { },
}

@ -60,6 +60,7 @@
#include "output-json-http.h"
#include "output-json-smtp.h"
#include "output-json-email-common.h"
#include "output-json-nfs.h"
#include "app-layer-htp.h"
#include "util-memcmp.h"
@ -105,6 +106,16 @@ static void FileWriteJsonRecord(JsonFileLogThread *aft, const Packet *p, const F
if (hjs)
json_object_set_new(js, "email", hjs);
break;
#ifdef HAVE_RUST
case ALPROTO_NFS:
hjs = JsonNFSAddMetadataRPC(p->flow, ff->txid);
if (hjs)
json_object_set_new(js, "rpc", hjs);
hjs = JsonNFSAddMetadata(p->flow, ff->txid);
if (hjs)
json_object_set_new(js, "nfs", hjs);
break;
#endif
}
json_object_set_new(js, "app_proto",

@ -62,6 +62,32 @@ typedef struct LogNFSLogThread_ {
MemBuffer *buffer;
} LogNFSLogThread;
json_t *JsonNFSAddMetadataRPC(const Flow *f, uint64_t tx_id)
{
NFSState *state = FlowGetAppState(f);
if (state) {
NFSTransaction *tx = AppLayerParserGetTx(f->proto, ALPROTO_NFS, state, tx_id);
if (tx) {
return rs_rpc_log_json_response(tx);
}
}
return NULL;
}
json_t *JsonNFSAddMetadata(const Flow *f, uint64_t tx_id)
{
NFSState *state = FlowGetAppState(f);
if (state) {
NFSTransaction *tx = AppLayerParserGetTx(f->proto, ALPROTO_NFS, state, tx_id);
if (tx) {
return rs_nfs_log_json_response(state, tx);
}
}
return NULL;
}
static int JsonNFSLogger(ThreadVars *tv, void *thread_data,
const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
{

@ -25,5 +25,8 @@
#define __OUTPUT_JSON_NFS_H__
void JsonNFSLogRegister(void);
#ifdef HAVE_RUST
json_t *JsonNFSAddMetadataRPC(const Flow *f, uint64_t tx_id);
json_t *JsonNFSAddMetadata(const Flow *f, uint64_t tx_id);
#endif /* HAVE_RUST */
#endif /* __OUTPUT_JSON_NFS_H__ */

Loading…
Cancel
Save