From 8a1bb3297ffe9e2fded836dfa9edbee7cc8246a6 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Fri, 19 Jul 2013 16:23:56 +0200 Subject: [PATCH] netlink: fix segfault & make advanced options work again A type mismatch and offset mistake was preventing the interface list from getting iterated. This was making collectd segfault when the "QDisc", "Class" or "Filter" options were enabled. --- src/netlink.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/netlink.c b/src/netlink.c index 0c06e78a..ca8f7c52 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -663,10 +663,9 @@ static int ir_read (void) /* `link_filter_cb' will update `iflist' which is used here to iterate * over all interfaces. */ - for (ifindex = 0; ifindex < iflist_len; ifindex++) + for (ifindex = 1; ifindex < iflist_len; ifindex++) { struct tcmsg *tm; - int ifindex; size_t type_index; if (iflist[ifindex] == NULL) @@ -681,7 +680,7 @@ static int ir_read (void) continue; } - DEBUG ("netlink plugin: ir_read: querying %s from %s (%i).", + DEBUG ("netlink plugin: ir_read: querying %s from %s (%lu).", type_name[type_index], iflist[ifindex], ifindex); nlh = mnl_nlmsg_put_header (buf); -- 2.30.2