From 9322378f74a4f30723526ff97db8622a5f743c40 Mon Sep 17 00:00:00 2001 From: Dmitry Sivachenko Date: Sun, 5 Jan 2014 08:14:25 +0000 Subject: Fix network interface statistics reports broken on FreeBSD-10. Approved by: maintainer --- net-mgmt/collectd5/Makefile | 2 +- net-mgmt/collectd5/files/patch-src-interface.c | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 net-mgmt/collectd5/files/patch-src-interface.c diff --git a/net-mgmt/collectd5/Makefile b/net-mgmt/collectd5/Makefile index 703503da9315..87dfd3744b3c 100644 --- a/net-mgmt/collectd5/Makefile +++ b/net-mgmt/collectd5/Makefile @@ -3,7 +3,7 @@ PORTNAME= collectd PORTVERSION= 5.4.0 -PORTREVISION= 2 +PORTREVISION= 3 PKGNAMESUFFIX= 5 CATEGORIES= net-mgmt MASTER_SITES= http://collectd.org/files/ diff --git a/net-mgmt/collectd5/files/patch-src-interface.c b/net-mgmt/collectd5/files/patch-src-interface.c new file mode 100644 index 000000000000..f2ad3d2bb601 --- /dev/null +++ b/net-mgmt/collectd5/files/patch-src-interface.c @@ -0,0 +1,36 @@ +--- src/interface.c.orig 2014-01-05 00:36:58.000000000 +0400 ++++ src/interface.c 2014-01-05 00:45:10.000000000 +0400 +@@ -212,20 +212,19 @@ static int interface_read (void) + return (-1); + + for (if_ptr = if_list; if_ptr != NULL; if_ptr = if_ptr->ifa_next) +- { +- if ((if_data = (struct IFA_DATA *) if_ptr->ifa_data) == NULL) +- continue; +- +- if_submit (if_ptr->ifa_name, "if_octets", +- if_data->IFA_RX_BYTES, +- if_data->IFA_TX_BYTES); +- if_submit (if_ptr->ifa_name, "if_packets", +- if_data->IFA_RX_PACKT, +- if_data->IFA_TX_PACKT); +- if_submit (if_ptr->ifa_name, "if_errors", +- if_data->IFA_RX_ERROR, +- if_data->IFA_TX_ERROR); +- } ++ if (if_ptr->ifa_addr != NULL && if_ptr->ifa_addr->sa_family == AF_LINK) { ++ if_data = (struct IFA_DATA *) if_ptr->ifa_data; ++ ++ if_submit (if_ptr->ifa_name, "if_octets", ++ if_data->IFA_RX_BYTES, ++ if_data->IFA_TX_BYTES); ++ if_submit (if_ptr->ifa_name, "if_packets", ++ if_data->IFA_RX_PACKT, ++ if_data->IFA_TX_PACKT); ++ if_submit (if_ptr->ifa_name, "if_errors", ++ if_data->IFA_RX_ERROR, ++ if_data->IFA_TX_ERROR); ++ } + + freeifaddrs (if_list); + /* #endif HAVE_GETIFADDRS */ -- cgit v1.2.3