From f54383fea028792d59b3ac845c3fbeb423ca1b4f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 15 Sep 2007 12:30:15 +0200 Subject: [PATCH] netlink plugin: Don't fail if `IFLA_STATS' doesn't exist for an interface. Hopefully this fixes problems on my WRT ;) --- src/netlink.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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); -- 2.11.0