|
|
|
@ -31,6 +31,7 @@
|
|
|
|
|
#include "tm-threads.h"
|
|
|
|
|
|
|
|
|
|
#include "util-privs.h"
|
|
|
|
|
#include "util-device.h"
|
|
|
|
|
#include "tmqh-packetpool.h"
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_DAG
|
|
|
|
@ -85,6 +86,8 @@ typedef struct ErfDagThreadVars_ {
|
|
|
|
|
|
|
|
|
|
struct timeval maxwait, poll; /* Could possibly be made static */
|
|
|
|
|
|
|
|
|
|
LiveDevice *livedev;
|
|
|
|
|
|
|
|
|
|
uint64_t bytes;
|
|
|
|
|
uint16_t packets;
|
|
|
|
|
uint16_t drops;
|
|
|
|
@ -191,6 +194,14 @@ ReceiveErfDagThreadInit(ThreadVars *tv, void *initdata, void **data)
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ewtn->livedev = LiveGetDevice(initdata);
|
|
|
|
|
if (ewtn->livedev == NULL) {
|
|
|
|
|
SCLogError(SC_ERR_INVALID_VALUE, "Unable to get %s live device",
|
|
|
|
|
(char *)initdata);
|
|
|
|
|
SCFree(ewtn);
|
|
|
|
|
SCReturnInt(TM_ECODE_FAILED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SCLogInfo("Opening DAG: %s on stream: %d for processing",
|
|
|
|
|
ewtn->dagname, ewtn->dagstream);
|
|
|
|
|
|
|
|
|
@ -428,7 +439,8 @@ static inline TmEcode ProcessErfDagRecords(ErfDagThreadVars *ewtn, uint8_t *top,
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_ETH:
|
|
|
|
|
if (dr->lctr) {
|
|
|
|
|
SCPerfCounterIncr(ewtn->drops, ewtn->tv->sc_perf_pca);
|
|
|
|
|
SCPerfCounterAddUI64(ewtn->drops, ewtn->tv->sc_perf_pca,
|
|
|
|
|
ntohs(dr->lctr));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
@ -542,6 +554,11 @@ ReceiveErfDagThreadExitStats(ThreadVars *tv, void *data)
|
|
|
|
|
{
|
|
|
|
|
ErfDagThreadVars *ewtn = (ErfDagThreadVars *)data;
|
|
|
|
|
|
|
|
|
|
(void)SC_ATOMIC_SET(ewtn->livedev->pkts,
|
|
|
|
|
(uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->sc_perf_pca));
|
|
|
|
|
(void)SC_ATOMIC_SET(ewtn->livedev->drop,
|
|
|
|
|
(uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->sc_perf_pca));
|
|
|
|
|
|
|
|
|
|
SCLogInfo("Stream: %d; Bytes: %"PRIu64"; Packets: %"PRIu64
|
|
|
|
|
"; Drops: %"PRIu64,
|
|
|
|
|
ewtn->dagstream,
|
|
|
|
|