+ return (0);
+} /* int update_iflist */
+
+static void check_ignorelist_and_submit(const char *dev,
+ struct ir_link_stats_storage_s *stats) {
+
+ if (check_ignorelist(dev, "interface", NULL) == 0) {
+ submit_two(dev, "if_octets", NULL, stats->rx_bytes, stats->tx_bytes);
+ submit_two(dev, "if_packets", NULL, stats->rx_packets, stats->tx_packets);
+ submit_two(dev, "if_errors", NULL, stats->rx_errors, stats->tx_errors);
+ } else {
+ DEBUG("netlink plugin: Ignoring %s/interface.", dev);
+ }
+
+ if (check_ignorelist(dev, "if_detail", NULL) == 0) {
+ submit_two(dev, "if_dropped", NULL, stats->rx_dropped, stats->tx_dropped);
+ submit_one(dev, "if_multicast", NULL, stats->multicast);
+ submit_one(dev, "if_collisions", NULL, stats->collisions);
+
+ submit_one(dev, "if_rx_errors", "length", stats->rx_length_errors);
+ submit_one(dev, "if_rx_errors", "over", stats->rx_over_errors);
+ submit_one(dev, "if_rx_errors", "crc", stats->rx_crc_errors);
+ submit_one(dev, "if_rx_errors", "frame", stats->rx_frame_errors);
+ submit_one(dev, "if_rx_errors", "fifo", stats->rx_fifo_errors);
+ submit_one(dev, "if_rx_errors", "missed", stats->rx_missed_errors);
+
+ submit_one(dev, "if_tx_errors", "aborted", stats->tx_aborted_errors);
+ submit_one(dev, "if_tx_errors", "carrier", stats->tx_carrier_errors);
+ submit_one(dev, "if_tx_errors", "fifo", stats->tx_fifo_errors);
+ submit_one(dev, "if_tx_errors", "heartbeat", stats->tx_heartbeat_errors);
+ submit_one(dev, "if_tx_errors", "window", stats->tx_window_errors);
+ } else {
+ DEBUG("netlink plugin: Ignoring %s/if_detail.", dev);
+ }
+
+} /* void check_ignorelist_and_submit */
+
+#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_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,
+ struct rtnl_link_stats64 *stats) {
+ struct ir_link_stats_storage_s s;
+
+ COPY_RTNL_LINK_STATS(&s, stats);
+
+ check_ignorelist_and_submit(dev, &s);
+}
+#endif