2 changed files with 3 additions and 150 deletions
@ -1,147 +0,0 @@ |
|||||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
||||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
||||||
#
|
|
||||||
# Filename: package/.../collectd/collectd-5.1.0-netlink-plugin-rtnl_dump_filter-checkarg.patch
|
|
||||||
# Copyright (C) 2012 The OpenSDE Project
|
|
||||||
#
|
|
||||||
# More information can be found in the files COPYING and README.
|
|
||||||
#
|
|
||||||
# This patch file is dual-licensed. It is available under the license the
|
|
||||||
# patched project is licensed under, as long as it is an OpenSource license
|
|
||||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
||||||
# of the GNU General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
||||||
|
|
||||||
From 793d766ab645cdb01297889797faf780eb669d40 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sebastian Harl <[email protected]>
|
|
||||||
Date: Sat, 19 May 2012 12:31:52 +0200
|
|
||||||
Subject: [PATCH 1/1] netlink plugin: Check for the number of arguments to
|
|
||||||
'rtnl_dump_filter'.
|
|
||||||
|
|
||||||
In recent versions of iproute2, 'rtnl_dump_filter' expects three rather than
|
|
||||||
five arguments.
|
|
||||||
|
|
||||||
This should fix Github issue #7.
|
|
||||||
|
|
||||||
Signed-off-by: Florian Forster <[email protected]>
|
|
||||||
---
|
|
||||||
configure.in | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
src/netlink.c | 12 +++++++++++
|
|
||||||
2 files changed, 78 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/configure.in b/configure.in
|
|
||||||
index 1dc23bf..58c9d27 100644
|
|
||||||
--- a/configure.in
|
|
||||||
+++ b/configure.in
|
|
||||||
@@ -2192,6 +2192,72 @@ then
|
|
||||||
fi
|
|
||||||
if test "x$with_libnetlink" = "xyes"
|
|
||||||
then
|
|
||||||
+ SAVE_CFLAGS="$CFLAGS"
|
|
||||||
+ CFLAGS="$CFLAGS $with_libnetlink_cflags"
|
|
||||||
+
|
|
||||||
+ AC_CACHE_CHECK(
|
|
||||||
+ [if function 'rtnl_dump_filter' expects five arguments],
|
|
||||||
+ [c_cv_rtnl_dump_filter_five_args],
|
|
||||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
||||||
+ [
|
|
||||||
+AC_INCLUDES_DEFAULT
|
|
||||||
+#if HAVE_LIBNETLINK_H
|
|
||||||
+# include <libnetlink.h>
|
|
||||||
+#elif HAVE_IPROUTE_LIBNETLINK_H
|
|
||||||
+# include <iproute/libnetlink.h>
|
|
||||||
+#elif HAVE_LINUX_LIBNETLINK_H
|
|
||||||
+# include <linux/libnetlink.h>
|
|
||||||
+#endif
|
|
||||||
+ ],
|
|
||||||
+ [
|
|
||||||
+if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
|
|
||||||
+ return 1;
|
|
||||||
+return 0;
|
|
||||||
+ ]
|
|
||||||
+ )],
|
|
||||||
+ [c_cv_rtnl_dump_filter_five_args="yes"],
|
|
||||||
+ [c_cv_rtnl_dump_filter_five_args="no"]
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
+
|
|
||||||
+ AC_CACHE_CHECK(
|
|
||||||
+ [if function 'rtnl_dump_filter' expects three arguments],
|
|
||||||
+ [c_cv_rtnl_dump_filter_three_args],
|
|
||||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
||||||
+ [
|
|
||||||
+AC_INCLUDES_DEFAULT
|
|
||||||
+#if HAVE_LIBNETLINK_H
|
|
||||||
+# include <libnetlink.h>
|
|
||||||
+#elif HAVE_IPROUTE_LIBNETLINK_H
|
|
||||||
+# include <iproute/libnetlink.h>
|
|
||||||
+#elif HAVE_LINUX_LIBNETLINK_H
|
|
||||||
+# include <linux/libnetlink.h>
|
|
||||||
+#endif
|
|
||||||
+ ],
|
|
||||||
+ [
|
|
||||||
+if (rtnl_dump_filter(NULL, NULL, NULL))
|
|
||||||
+ return 1;
|
|
||||||
+return 0;
|
|
||||||
+ ]
|
|
||||||
+ )],
|
|
||||||
+ [c_cv_rtnl_dump_filter_three_args="yes"],
|
|
||||||
+ [c_cv_rtnl_dump_filter_three_args="no"]
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
+
|
|
||||||
+ CFLAGS="$SAVE_CFLAGS"
|
|
||||||
+
|
|
||||||
+ if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
|
|
||||||
+ then
|
|
||||||
+ AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
|
|
||||||
+ [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
|
|
||||||
+ fi
|
|
||||||
+ if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
|
|
||||||
+ then
|
|
||||||
+ AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
|
|
||||||
+ [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
|
|
||||||
BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
|
|
||||||
AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
|
|
||||||
diff --git a/src/netlink.c b/src/netlink.c
|
|
||||||
index 49c4e99..e65aec7 100644
|
|
||||||
--- a/src/netlink.c
|
|
||||||
+++ b/src/netlink.c
|
|
||||||
@@ -570,8 +570,14 @@ static int ir_read (void)
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef RTNL_DUMP_FILTER_FIVE_ARGS
|
|
||||||
if (rtnl_dump_filter (&rth, link_filter, /* arg1 = */ NULL,
|
|
||||||
NULL, NULL) != 0)
|
|
||||||
+#elif defined(RTNL_DUMP_FILTER_THREE_ARGS)
|
|
||||||
+ if (rtnl_dump_filter (&rth, link_filter, /* arg = */ NULL) != 0)
|
|
||||||
+#else
|
|
||||||
+#error "Failed to determine the number of arguments to 'rtnl_dump_filter'!"
|
|
||||||
+#endif
|
|
||||||
{
|
|
||||||
ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
|
|
||||||
return (-1);
|
|
||||||
@@ -608,8 +614,14 @@ static int ir_read (void)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef RTNL_DUMP_FILTER_FIVE_ARGS
|
|
||||||
if (rtnl_dump_filter (&rth, qos_filter, (void *) &ifindex,
|
|
||||||
NULL, NULL) != 0)
|
|
||||||
+#elif defined(RTNL_DUMP_FILTER_THREE_ARGS)
|
|
||||||
+ if (rtnl_dump_filter (&rth, qos_filter, /* arg = */ &ifindex) != 0)
|
|
||||||
+#else
|
|
||||||
+#error "Failed to determine the number of arguments to 'rtnl_dump_filter'!"
|
|
||||||
+#endif
|
|
||||||
{
|
|
||||||
ERROR ("netlink plugin: ir_read: rtnl_dump_filter failed.");
|
|
||||||
continue;
|
|
||||||
--
|
|
||||||
1.7.10.4
|
|
||||||
|
|
Loading…
Reference in new issue