summaryrefslogtreecommitdiffstats
path: root/kernel/include
diff options
context:
space:
mode:
authorSerhey Popovych <serhe.popovych@gmail.com>2019-11-29 11:21:32 +0200
committerJozsef Kadlecsik <kadlec@netfilter.org>2019-12-09 11:07:02 +0100
commita065f8ed355f08131c39787b4c7a41543ff643b3 (patch)
tree5bc04778f2d526dd57b783dc5bc570fa34659a76 /kernel/include
parent4eda9fd68157c444f70541bd10fde3c36e09f0f1 (diff)
em_ipset: Build on old kernels
Make sure TCF_EM_IPSET defined and corresponds to current upstream value if not defined in target kernel. You need iproute2 version that supports em_ipset to communicate correctly. Include ip_set_compat.h after pkt_cls.h to prevent TCF_EM_IPSET redefine error. Detect skb->iif => skb->skb_iif rename after commit 8964be4a9a5c ("net: rename skb->iif to skb->skb_iif"). Add dev_get_by_index_rcu() define pointing to __dev_get_by_index() to build on RHEL6 kernels with explicit note that this may not work on all architectures. Always build em_ipset regardless of CONFIG_NET_EMATCH_IPSET option. Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in17
1 files changed, 17 insertions, 0 deletions
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 92d815e..d71c3fd 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -51,6 +51,7 @@
#@HAVE_SYNCHRONIZE_RCU_BH@ HAVE_SYNCHRONIZE_RCU_BH
#@HAVE_LOCKDEP_NFNL_IS_HELD@ HAVE_LOCKDEP_NFNL_IS_HELD
#@HAVE_COND_RESCHED_RCU@ HAVE_COND_RESCHED_RCU
+#@HAVE_SKB_IIF@ HAVE_SKB_IIF
#ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
#include <linux/module.h>
@@ -430,5 +431,21 @@ static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
#define SIZE_MAX (~(size_t)0)
#endif
+#ifndef TCF_EM_IPSET
+#define TCF_EM_IPSET 8
+#endif
+
+#ifndef HAVE_SKB_IIF
+#define skb_iif iif
+#endif
+
+#ifndef HAVE_DEV_GET_BY_INDEX_RCU
+/* This should not be considered RCU-safe on all architectures.
+ * You probably should consider upgrading your kernel in case of
+ * kernel crashes including em_ipset and this function call.
+ */
+#define dev_get_by_index_rcu __dev_get_by_index
+#endif
+
#endif /* IP_SET_COMPAT_HEADERS */
#endif /* __IP_SET_COMPAT_H */