From: Florian Forster Date: Sat, 15 Sep 2007 10:30:15 +0000 (+0200) Subject: netlink plugin: Don't fail if `IFLA_STATS' doesn't exist for an interface. X-Git-Tag: collectd-4.1.2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f54383fea028792d59b3ac845c3fbeb423ca1b4f;p=collectd.git netlink plugin: Don't fail if `IFLA_STATS' doesn't exist for an interface. Hopefully this fixes problems on my WRT ;) --- diff --git a/src/netlink.c b/src/netlink.c index 8c883f67..22afdc77 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -237,10 +237,6 @@ static int link_filter (const struct sockaddr_nl *sa, return (-1); } - if (attrs[IFLA_STATS] == NULL) - return (-1); - stats = RTA_DATA (attrs[IFLA_STATS]); - if (attrs[IFLA_IFNAME] == NULL) { ERROR ("netlink plugin: link_filter: attrs[IFLA_IFNAME] == NULL"); @@ -273,6 +269,13 @@ static int link_filter (const struct sockaddr_nl *sa, iflist[msg->ifi_index] = strdup (dev); } + if (attrs[IFLA_STATS] == NULL) + { + DEBUG ("netlink plugin: link_filter: No statistics for interface %s.", dev); + return (0); + } + stats = RTA_DATA (attrs[IFLA_STATS]); + if (check_ignorelist (dev, "interface", NULL) == 0) { submit_two (dev, "if_octets", NULL, stats->rx_bytes, stats->tx_bytes);