@cryptotaxi247 / netdata-1 / commits / 071b7dddb

Minor error corrections for IP stats in Freebsd plugin

Vladimir Kobal committed Dec 14, 2016 at 16:39 UTC 071b7dddb2d8b4e81cb00f11e294a619852d734f
1 file changed +4 -2
src/freebsd_sysctl.c
+4 -2
@@ -1052,11 +1052,12 @@ int do_freebsd_sysctl(int update_every, usec_t dt) {
1052 do_bandwidth = 0;
1053 error("DISABLED: system.ipv4");
1054 } else {
1055 + iftot.ift_ibytes = iftot.ift_obytes = 0;
1056 for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
1057 if (ifa->ifa_addr->sa_family != AF_INET)
1058 continue;
1058 - iftot.ift_ibytes += (((struct if_data *)ifa->ifa_data)->ifi_ibytes);
1059 - iftot.ift_obytes += (((struct if_data *)ifa->ifa_data)->ifi_obytes);
1059 + iftot.ift_ibytes += IFA_DATA(ibytes);
1060 + iftot.ift_obytes += IFA_DATA(obytes);
1061 }
1062
1063 st = rrdset_find("system.ipv4");
@@ -1074,6 +1075,7 @@ int do_freebsd_sysctl(int update_every, usec_t dt) {
1075
1076 // --------------------------------------------------------------------
1077
1078 + iftot.ift_ibytes = iftot.ift_obytes = 0;
1079 for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
1080 if (ifa->ifa_addr->sa_family != AF_INET6)
1081 continue;