Date: Fri, 23 Sep 2016 21:27:46 +0200 From: Ben RUBSON <ben.rubson@gmail.com> To: FreeBSD Net <freebsd-net@freebsd.org> Subject: Re: netstat counts input traffic twice Message-ID: <2D30DE7E-2BA9-4554-83EB-B2F197355AD4@gmail.com> In-Reply-To: <94953762-4397-476D-AD61-A39914F27938@gmail.com> References: <94953762-4397-476D-AD61-A39914F27938@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 23 Sep 2016, at 19:59, Ben RUBSON <ben.rubson@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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2D30DE7E-2BA9-4554-83EB-B2F197355AD4>
