[packages] fixes netlink / 3.3 related collectd breakage
authorJohn Crispin <john@openwrt.org>
Thu, 7 Jun 2012 17:01:32 +0000 (17:01 +0000)
committerJohn Crispin <john@openwrt.org>
Thu, 7 Jun 2012 17:01:32 +0000 (17:01 +0000)
fixes #11348, #11610, #11490

thanks hnyman

SVN-Revision: 32121

utils/collectd/patches/130-fix_netlink_kernel_3.3-patch [new file with mode: 0644]

diff --git a/utils/collectd/patches/130-fix_netlink_kernel_3.3-patch b/utils/collectd/patches/130-fix_netlink_kernel_3.3-patch
new file mode 100644 (file)
index 0000000..9cb8830
--- /dev/null
@@ -0,0 +1,50 @@
+Index: collectd-4.10.7/src/netlink.c
+===================================================================
+--- collectd-4.10.7.orig/src/netlink.c 2012-04-01 16:20:24.000000000 +0200
++++ collectd-4.10.7/src/netlink.c      2012-06-07 17:22:16.212616882 +0200
+@@ -223,7 +223,7 @@
+   msg = NLMSG_DATA (nmh);
+-  msg_len = nmh->nlmsg_len - sizeof (struct ifinfomsg);
++  msg_len = nmh->nlmsg_len - NLMSG_LENGTH(sizeof (struct ifinfomsg));
+   if (msg_len < 0)
+   {
+     ERROR ("netlink plugin: link_filter: msg_len = %i < 0;", msg_len);
+@@ -554,24 +554,19 @@
+ static int ir_read (void)
+ {
+-  struct ifinfomsg im;
+   struct tcmsg tm;
+   int ifindex;
+   static const int type_id[] = { RTM_GETQDISC, RTM_GETTCLASS, RTM_GETTFILTER };
+   static const char *type_name[] = { "qdisc", "class", "filter" };
+-  memset (&im, '\0', sizeof (im));
+-  im.ifi_type = AF_UNSPEC;
+-
+-  if (rtnl_dump_request (&rth, RTM_GETLINK, &im, sizeof (im)) < 0)
++  if (rtnl_wilddump_request (&rth, AF_UNSPEC, RTM_GETLINK) < 0)
+   {
+     ERROR ("netlink plugin: ir_read: rtnl_dump_request failed.");
+     return (-1);
+   }
+-  if (rtnl_dump_filter (&rth, link_filter, /* arg1 = */ NULL,
+-      NULL, NULL) != 0)
++  if (rtnl_dump_filter (&rth, link_filter, /* arg1 = */ NULL) != 0)
+   {
+     ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
+     return (-1);
+@@ -608,8 +603,7 @@
+       continue;
+       }
+-      if (rtnl_dump_filter (&rth, qos_filter, (void *) &ifindex,
+-          NULL, NULL) != 0)
++      if (rtnl_dump_filter (&rth, qos_filter, (void *) &ifindex) != 0)
+       {
+       ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
+       continue;