From: Marc Fournier Date: Fri, 19 Jul 2013 14:23:56 +0000 (+0200) Subject: netlink: fix segfault & make advanced options work again X-Git-Tag: collectd-5.4.0~11^2~9 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=8a1bb3297ffe9e2fded836dfa9edbee7cc8246a6 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. --- 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);