bypass: restore interface counter

pull/3952/head
Eric Leblond 6 years ago committed by Victor Julien
parent d119845d98
commit f78e5ba1e1

@ -255,6 +255,10 @@ static int FlowManagerFlowTimeout(Flow *f, enum FlowState state, struct timeval
if (fc) {
if (fc->BypassUpdate) {
/* flow will be possibly updated */
uint64_t pkts_tosrc = fc->tosrcpktcnt;
uint64_t bytes_tosrc = fc->tosrcbytecnt;
uint64_t pkts_todst = fc->todstpktcnt;
uint64_t bytes_todst = fc->todstbytecnt;
bool update = fc->BypassUpdate(f, fc->bypass_data, ts->tv_sec);
/* FIXME do global accounting: store pkts and bytes before and add difference here to counter */
if (update) {
@ -262,6 +266,14 @@ static int FlowManagerFlowTimeout(Flow *f, enum FlowState state, struct timeval
flow_times_out_at = (int32_t)(f->lastts.tv_sec + timeout);
if (*next_ts == 0 || flow_times_out_at < *next_ts)
*next_ts = flow_times_out_at;
pkts_tosrc = fc->tosrcpktcnt - pkts_tosrc;
bytes_tosrc = fc->tosrcbytecnt - bytes_tosrc;
pkts_todst = fc->todstpktcnt - pkts_todst;
bytes_todst = fc->todstbytecnt - bytes_todst;
if (f->livedev) {
SC_ATOMIC_ADD(f->livedev->bypassed,
pkts_tosrc + pkts_todst);
}
return 0;
} else {
SCLogDebug("No new packet, dead flow %ld", FlowGetId(f));

@ -347,7 +347,7 @@ typedef struct Flow_
uint8_t vlan_idx;
/** Incoming interface */
const struct LiveDevice_ *livedev;
struct LiveDevice_ *livedev;
/** flow hash - the flow hash before hash table size mod. */
uint32_t flow_hash;

Loading…
Cancel
Save