Merge branch 'collectd-5.5'
[collectd.git] / src / netlink.c
index 47c1332..d4661ce 100644 (file)
@@ -30,7 +30,6 @@
 #include "common.h"
 
 #include <asm/types.h>
-#include <sys/socket.h>
 
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
@@ -313,28 +312,28 @@ static void check_ignorelist_and_submit (const char *dev,
 #define COPY_RTNL_LINK_VALUE(dst_stats, src_stats, value_name) \
   (dst_stats)->value_name = (src_stats)->value_name
 
-#define COPY_RTNL_LINK_STATS(dst_stats, src_stats)  \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_bytes); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_packets); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_bytes); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_bytes); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_dropped); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_dropped); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, multicast); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, collisions); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_length_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_over_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_crc_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_frame_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_fifo_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, rx_missed_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_aborted_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_carrier_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_fifo_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_heartbeat_errors); \
-  COPY_RTNL_LINK_VALUE(dst_stats, src_stats, tx_window_errors)
+#define COPY_RTNL_LINK_STATS(dst_stats, src_stats) \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_packets); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_packets); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_bytes); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_bytes); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_dropped); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_dropped); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, multicast); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, collisions); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_length_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_over_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_crc_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_frame_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_fifo_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, rx_missed_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_aborted_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_carrier_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_fifo_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_heartbeat_errors); \
+  COPY_RTNL_LINK_VALUE (dst_stats, src_stats, tx_window_errors)
 
 #ifdef HAVE_RTNL_LINK_STATS64
 static void check_ignorelist_and_submit64 (const char *dev,
@@ -342,7 +341,7 @@ static void check_ignorelist_and_submit64 (const char *dev,
 {
   struct ir_link_stats_storage_s s;
 
-  COPY_RTNL_LINK_STATS(&s, stats);
+  COPY_RTNL_LINK_STATS (&s, stats);
 
   check_ignorelist_and_submit (dev, &s);
 }
@@ -471,7 +470,7 @@ static int qos_filter_cb (const struct nlmsghdr *nlh, void *args)
   const char *kind = NULL;
 
   /* char *type_instance; */
-  char *tc_type;
+  const char *tc_type;
   char tc_inst[DATA_MAX_NAME_LEN];
 
   _Bool stats_submitted = 0;
@@ -780,7 +779,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);