From: Vladimir Kobal Date: Wed, 14 Dec 2016 14:39:41 +0000 (+0200) Subject: Minor error corrections for IP stats in Freebsd plugin X-Git-Tag: v1.5.0~131^2 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netdata.git;a=commitdiff_plain;h=071b7dddb2d8b4e81cb00f11e294a619852d734f Minor error corrections for IP stats in Freebsd plugin --- diff --git a/src/freebsd_sysctl.c b/src/freebsd_sysctl.c index 4d15d563..d4786531 100644 --- a/src/freebsd_sysctl.c +++ b/src/freebsd_sysctl.c @@ -1052,11 +1052,12 @@ int do_freebsd_sysctl(int update_every, usec_t dt) { do_bandwidth = 0; error("DISABLED: system.ipv4"); } else { + iftot.ift_ibytes = iftot.ift_obytes = 0; for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (ifa->ifa_addr->sa_family != AF_INET) continue; - iftot.ift_ibytes += (((struct if_data *)ifa->ifa_data)->ifi_ibytes); - iftot.ift_obytes += (((struct if_data *)ifa->ifa_data)->ifi_obytes); + iftot.ift_ibytes += IFA_DATA(ibytes); + iftot.ift_obytes += IFA_DATA(obytes); } st = rrdset_find("system.ipv4"); @@ -1074,6 +1075,7 @@ int do_freebsd_sysctl(int update_every, usec_t dt) { // -------------------------------------------------------------------- + iftot.ift_ibytes = iftot.ift_obytes = 0; for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue;