Merged branch 'collectd-4.10' into collectd-5.4.
[collectd.git] / src / netlink.c
index c0b60c2..3c4642c 100644 (file)
@@ -1,6 +1,9 @@
 /**
  * collectd - src/netlink.c
  * Copyright (C) 2007-2010  Florian octo Forster
+ * Copyright (C) 2008-2012  Sebastian Harl
+ * Copyright (C) 2013       Andreas Henriksson
+ * Copyright (C) 2013       Marc Fournier
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -17,6 +20,9 @@
  *
  * Authors:
  *   Florian octo Forster <octo at collectd.org>
+ *   Sebastian Harl <sh at tokkee.org>
+ *   Andreas Henriksson <andreas at fatal.se>
+ *   Marc Fournier <marc.fournier at camptocamp.com>
  **/
 
 #include "collectd.h"
@@ -35,7 +41,6 @@
 # include <linux/pkt_sched.h>
 #endif
 
-#include <time.h>
 #include <libmnl/libmnl.h>
 
 typedef struct ir_ignorelist_s
@@ -337,7 +342,7 @@ static int link_filter_cb (const struct nlmsghdr *nlh,
 #if HAVE_TCA_STATS2
 static int qos_attr_cb (const struct nlattr *attr, void *data)
 {
-  struct gnet_stats_basic *bs = *(struct gnet_stats_basic **)data;
+  struct gnet_stats_basic **bs = (struct gnet_stats_basic **)data;
 
   /* skip unsupported attribute in user-space */
   if (mnl_attr_type_valid (attr, TCA_STATS_MAX) < 0)
@@ -345,12 +350,12 @@ static int qos_attr_cb (const struct nlattr *attr, void *data)
 
   if (mnl_attr_get_type (attr) == TCA_STATS_BASIC)
   {
-    if (mnl_attr_validate2 (attr, MNL_TYPE_UNSPEC, sizeof (*bs)) < 0)
+    if (mnl_attr_validate2 (attr, MNL_TYPE_UNSPEC, sizeof (**bs)) < 0)
     {
       ERROR ("netlink plugin: qos_attr_cb: TCA_STATS_BASIC mnl_attr_validate2 failed.");
       return MNL_CB_ERROR;
     }
-    bs = mnl_attr_get_payload (attr);
+    *bs = mnl_attr_get_payload (attr);
     return MNL_CB_STOP;
   }
 
@@ -678,7 +683,7 @@ static int ir_read (void)
         continue;
       }
 
-      DEBUG ("netlink plugin: ir_read: querying %s from %s (%lu).",
+      DEBUG ("netlink plugin: ir_read: querying %s from %s (%zu).",
           type_name[type_index], iflist[ifindex], ifindex);
 
       nlh = mnl_nlmsg_put_header (buf);