Merge branch 'stats-bytes-recvd' of https://github.com/msmiley/bro

This commit is contained in:
Robin Sommer 2015-03-04 13:13:50 -08:00
commit e5adc768cc
8 changed files with 27 additions and 6 deletions

View file

@ -180,6 +180,8 @@ bool PcapSource::ExtractNextPacket(Packet* pkt)
last_hdr = current_hdr;
last_data = data;
++stats.received;
stats.bytes_received += current_hdr.len;
return true;
}
@ -219,7 +221,7 @@ bool PcapSource::SetFilter(int index)
#ifndef HAVE_LINUX
// Linux doesn't clear counters when resetting filter.
stats.received = stats.dropped = stats.link = 0;
stats.received = stats.dropped = stats.link = stats.bytes_received = 0;
#endif
return true;
@ -230,7 +232,7 @@ void PcapSource::Statistics(Stats* s)
char errbuf[PCAP_ERRBUF_SIZE];
if ( ! (props.is_live && pd) )
s->received = s->dropped = s->link = 0;
s->received = s->dropped = s->link = s->bytes_received = 0;
else
{
@ -238,7 +240,7 @@ void PcapSource::Statistics(Stats* s)
if ( pcap_stats(pd, &pstat) < 0 )
{
PcapError();
s->received = s->dropped = s->link = 0;
s->received = s->dropped = s->link = s->bytes_received = 0;
}
else
@ -249,6 +251,7 @@ void PcapSource::Statistics(Stats* s)
}
s->received = stats.received;
s->bytes_received = stats.bytes_received;
if ( ! props.is_live )
s->dropped = 0;