From a065f8ed355f08131c39787b4c7a41543ff643b3 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Fri, 29 Nov 2019 11:21:32 +0200 Subject: 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 Signed-off-by: Jozsef Kadlecsik --- kernel/include/linux/netfilter/ipset/ip_set_compat.h.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'kernel/include/linux/netfilter/ipset/ip_set_compat.h.in') 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 @@ -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 */ -- cgit v1.2.3