yyyy-mm-dd, Version 4.1.2
* apcups plugin: Fix reporting of the `load percent' data.
+ * netlink plugin: Build issues under some older versions of the Linux
+ includes (i. e. Debian Sarge) have been fixed.
2007-09-12, Version 4.1.1
* Build system: The detection of `libnetlink' has been improved.
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>])
+ AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
+[#include <stdio.h>
+#include <sys/types.h>
+#include <asm/types.h>
+#include <sys/socket.h>])
+
+ AC_COMPILE_IFELSE(
+[#include <stdio.h>
+#include <sys/types.h>
+#include <asm/types.h>
+#include <sys/socket.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+int main (void)
+{
+ int retval = TCA_STATS2;
+ return (retval);
+}],
+ [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
+ []);
+
+ AC_COMPILE_IFELSE(
+[#include <stdio.h>
+#include <sys/types.h>
+#include <asm/types.h>
+#include <sys/socket.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+int main (void)
+{
+ int retval = TCA_STATS;
+ return (retval);
+}],
+ [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
+ []);
CFLAGS="$SAVE_CFLAGS"
fi
#include <asm/types.h>
#include <sys/socket.h>
+
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
-#include <linux/gen_stats.h>
+#if HAVE_LINUX_GEN_STATS_H
+# include <linux/gen_stats.h>
+#endif
+#if HAVE_LINUX_PKT_SCHED_H
+# include <linux/pkt_sched.h>
+#endif
#if HAVE_LIBNETLINK_H
# include <libnetlink.h>
plugin_dispatch_values (type, &vl);
} /* void submit_two */
-static int link_filter (const struct sockaddr_nl *sa, struct nlmsghdr *nmh,
- void *args)
+static int link_filter (const struct sockaddr_nl *sa,
+ const struct nlmsghdr *nmh, void *args)
{
struct ifinfomsg *msg;
int msg_len;
return (0);
} /* int link_filter */
-static int qos_filter (const struct sockaddr_nl *sa, struct nlmsghdr *nmh,
- void *args)
+static int qos_filter (const struct sockaddr_nl *sa,
+ const struct nlmsghdr *nmh, void *args)
{
struct tcmsg *msg;
int msg_len;
if (check_ignorelist (dev, tc_type, tc_inst))
return (0);
+#if HAVE_TCA_STATS2
if (attrs[TCA_STATS2])
{
struct rtattr *attrs_stats[TCA_STATS_MAX + 1];
submit_one (dev, "ipt_packets", type_instance, bs.packets);
}
}
+#endif /* TCA_STATS2 */
+#if HAVE_TCA_STATS && HAVE_TCA_STATS2
+ else
+#endif
+#if HAVE_TCA_STATS
+ if (attrs[TCA_STATS] != NULL)
+ {
+ struct tc_stats ts;
+ char type_instance[DATA_MAX_NAME_LEN];
+
+ snprintf (type_instance, sizeof (type_instance), "%s-%s",
+ tc_type, tc_inst);
+ type_instance[sizeof (type_instance) - 1] = '\0';
+
+ memset(&ts, '\0', sizeof (ts));
+ memcpy(&ts, RTA_DATA (attrs[TCA_STATS]),
+ MIN (RTA_PAYLOAD (attrs[TCA_STATS]), sizeof (ts)));
+
+ submit_one (dev, "ipt_bytes", type_instance, ts.bytes);
+ submit_one (dev, "ipt_packets", type_instance, ts.packets);
+ }
+#endif /* TCA_STATS */
+#if HAVE_TCA_STATS || HAVE_TCA_STATS2
+ else
+#endif
+ {
+ DEBUG ("netlink plugin: qos_filter: Have neither TCA_STATS2 nor "
+ "TCA_STATS.");
+ }
return (0);
} /* int qos_filter */