netstat counts input traffic twice
Ben RUBSON
ben.rubson at gmail.com
Fri Sep 23 19:27:50 UTC 2016
> On 23 Sep 2016, at 19:59, Ben RUBSON <ben.rubson at gmail.com> wrote:
>
> Hello,
>
> I found a strange issue where input traffic is counted twice,
> sometimes more.
As a very disgusting & temporary workaround, I did the following,
so that statistics are made on the networks, not on the links :
--- usr.bin/netstat/if.c.ori 2016-08-12 02:08:29.000000000 +0200
+++ usr.bin/netstat/if.c 2016-09-23 21:20:03.000000000 +0200
@@ -513,19 +513,19 @@
/*
* Obtain stats for interface(s).
*/
static void
fill_iftot(struct iftot *st)
{
struct ifaddrs *ifap, *ifa;
bool found = false;
if (getifaddrs(&ifap) != 0)
xo_err(EX_OSERR, "getifaddrs");
bzero(st, sizeof(*st));
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr->sa_family != AF_LINK)
+ if (ifa->ifa_addr->sa_family != AF_INET)
continue;
if (interface) {
if (strcmp(ifa->ifa_name, interface) == 0)
More information about the freebsd-net
mailing list