[packages] fixes netlink / 3.3 related collectd breakage
[openwrt/svn-archive/archive.git] / utils / collectd / patches / 130-fix_netlink_kernel_3.3-patch
1 Index: collectd-4.10.7/src/netlink.c
2 ===================================================================
3 --- collectd-4.10.7.orig/src/netlink.c 2012-04-01 16:20:24.000000000 +0200
4 +++ collectd-4.10.7/src/netlink.c 2012-06-07 17:22:16.212616882 +0200
5 @@ -223,7 +223,7 @@
6
7 msg = NLMSG_DATA (nmh);
8
9 - msg_len = nmh->nlmsg_len - sizeof (struct ifinfomsg);
10 + msg_len = nmh->nlmsg_len - NLMSG_LENGTH(sizeof (struct ifinfomsg));
11 if (msg_len < 0)
12 {
13 ERROR ("netlink plugin: link_filter: msg_len = %i < 0;", msg_len);
14 @@ -554,24 +554,19 @@
15
16 static int ir_read (void)
17 {
18 - struct ifinfomsg im;
19 struct tcmsg tm;
20 int ifindex;
21
22 static const int type_id[] = { RTM_GETQDISC, RTM_GETTCLASS, RTM_GETTFILTER };
23 static const char *type_name[] = { "qdisc", "class", "filter" };
24
25 - memset (&im, '\0', sizeof (im));
26 - im.ifi_type = AF_UNSPEC;
27 -
28 - if (rtnl_dump_request (&rth, RTM_GETLINK, &im, sizeof (im)) < 0)
29 + if (rtnl_wilddump_request (&rth, AF_UNSPEC, RTM_GETLINK) < 0)
30 {
31 ERROR ("netlink plugin: ir_read: rtnl_dump_request failed.");
32 return (-1);
33 }
34
35 - if (rtnl_dump_filter (&rth, link_filter, /* arg1 = */ NULL,
36 - NULL, NULL) != 0)
37 + if (rtnl_dump_filter (&rth, link_filter, /* arg1 = */ NULL) != 0)
38 {
39 ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
40 return (-1);
41 @@ -608,8 +603,7 @@
42 continue;
43 }
44
45 - if (rtnl_dump_filter (&rth, qos_filter, (void *) &ifindex,
46 - NULL, NULL) != 0)
47 + if (rtnl_dump_filter (&rth, qos_filter, (void *) &ifindex) != 0)
48 {
49 ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
50 continue;