summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@netfilter.org>2019-11-01 15:40:33 +0100
committerJozsef Kadlecsik <kadlec@netfilter.org>2019-11-01 15:40:33 +0100
commitd2bf22865663c260c9eb4ca2cba63dbac9e258f9 (patch)
treec09ec8fb321120ea12fb77a8cbf3d9d590d50339
parent2b2c1d85bbc4e24e1350c3075d5e653104c91a41 (diff)
downloadipset-d2bf22865663c260c9eb4ca2cba63dbac9e258f9.tar.gz
Fix compatibility support for netlink extended ACK and add synchronize_rcu_bh() checking
-rw-r--r--configure.ac13
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in5
-rw-r--r--kernel/net/netfilter/ipset/ip_set_hash_gen.h2
3 files changed, 18 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 75f43c7..5a0f18a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -581,7 +581,7 @@ fi
AC_MSG_CHECKING([kernel source for netlink extended ACK])
if test -f $ksourcedir/include/linux/netlink.h && \
- $AWK '/^extern void netlink_ack\(/,/\)/' $ksourcedir/include/linux/netlink.h | $GREP -q 'const struct netlink_ext_ack'; then
+ $AWK '/void netlink_ack\(/,/\)/' $ksourcedir/include/linux/netlink.h | $GREP -q 'const struct netlink_ext_ack'; then
AC_MSG_RESULT(yes)
AC_SUBST(HAVE_NETLINK_EXTENDED_ACK, define)
else
@@ -649,6 +649,17 @@ else
AC_SUBST(HAVE_STRSCPY, undef)
fi
+AC_MSG_CHECKING([kernel source for synchronize_rcu_bh() in rcutiny.h and rcupdate.h])
+if test -f $ksourcedir/include/linux/rcupdate.h && \
+ $GREP -q 'static inline void synchronize_rcu_bh' \
+ $ksourcedir/include/linux/rcutiny.h $ksourcedir/include/linux/rcupdate.h; then
+ AC_MSG_RESULT(yes)
+ AC_SUBST(HAVE_SYNCHRONIZE_RCU_BH, define)
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST(HAVE_SYNCHRONIZE_RCU_BH, undef)
+fi
+
AC_MSG_CHECKING([kernel source for struct net_generic])
if test -f $ksourcedir/include/net/netns/generic.h && \
$GREP -q 'struct net_generic' $ksourcedir/include/net/netns/generic.h; then
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
index 415104d..5f12ad8 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -48,6 +48,7 @@
#@HAVE_TYPEDEF_SCTP_SCTPHDR_T@ HAVE_TYPEDEF_SCTP_SCTPHDR_T
#@HAVE_TIMER_SETUP@ HAVE_TIMER_SETUP
#@HAVE_STRSCPY@ HAVE_STRSCPY
+#@HAVE_SYNCHRONIZE_RCU_BH@ HAVE_SYNCHRONIZE_RCU_BH
#@HAVE_LOCKDEP_NFNL_IS_HELD@ HAVE_LOCKDEP_NFNL_IS_HELD
#ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
@@ -82,6 +83,10 @@
#include <linux/version.h>
#include <linux/netlink.h>
+#ifdef HAVE_SYNCHRONIZE_RCU_BH
+#define synchronize_rcu() synchronize_rcu_bh()
+#endif
+
#ifndef rcu_dereference_bh
#define rcu_dereference_bh(p) rcu_dereference(p)
#endif
diff --git a/kernel/net/netfilter/ipset/ip_set_hash_gen.h b/kernel/net/netfilter/ipset/ip_set_hash_gen.h
index cc0e754..1767fed 100644
--- a/kernel/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/kernel/net/netfilter/ipset/ip_set_hash_gen.h
@@ -663,7 +663,7 @@ retry:
spin_unlock_bh(&set->lock);
/* Give time to other readers of the set */
- synchronize_rcu_bh();
+ synchronize_rcu();
pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
orig->htable_bits, orig, t->htable_bits, t);