summaryrefslogtreecommitdiffstats
path: root/kernel/include
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-10-02 17:31:15 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-10-02 17:31:15 +0200
commit8a82b39ef90b95cd4533fb5a6f5afa2b74ebd61d (patch)
tree0dc92ad0e77247ae87823a3c3f18cb34f36abc78 /kernel/include
parenta61d7ebe47c4c0d7a60dd8d4345ef4e41f14426a (diff)
Compatibility code is modified not to rely on kernel version numbers
Instead the kernel source code is checked to verify the different compatibility issues for the supported kernel releases. This way hopefully backported features will be handled properly.
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in (renamed from kernel/include/linux/netfilter/ipset/ip_set_compat.h)38
1 files changed, 27 insertions, 11 deletions
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
index cdc8f53..b93c5d9 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -1,6 +1,20 @@
#ifndef __IP_SET_COMPAT_H
#define __IP_SET_COMPAT_H
+#@HAVE_STRUCT_XT_ACTION_PARAM@ HAVE_STRUCT_XT_ACTION_PARAM
+#@HAVE_VZALLOC@ HAVE_VZALLOC
+#@HAVE_ETHER_ADDR_EQUAL@ HAVE_ETHER_ADDR_EQUAL
+#@HAVE_NLA_PUT_BE64@ HAVE_NLA_PUT_BE64
+#@HAVE_NL_INFO_PORTID@ HAVE_NL_INFO_PORTID
+#define HAVE_NETLINK_DUMP_START_ARGS @HAVE_NETLINK_DUMP_START_ARGS@
+#@HAVE_NS_CAPABLE@ HAVE_NS_CAPABLE
+#@HAVE_NFNL_LOCK_SUBSYS@ HAVE_NFNL_LOCK_SUBSYS
+#@HAVE_EXPORT_H@ HAVE_EXPORT_H
+#define HAVE_IPV6_SKIP_EXTHDR_ARGS @HAVE_IPV6_SKIP_EXTHDR_ARGS@
+#@HAVE_CHECKENTRY_BOOL@ HAVE_CHECKENTRY_BOOL
+#@HAVE_XT_TARGET_PARAM@ HAVE_XT_TARGET_PARAM
+#@HAVE_NET_OPS_ID@ HAVE_NET_OPS_ID
+
/* Not everything could be moved here. Compatibility stuffs can be found in
* xt_set.c, ip_set_core.c, ip_set_getport.c, pfxlen.c too.
*/
@@ -31,24 +45,26 @@
#error "NETFILTER_NETLINK must be enabled: select NFACCT/NFQUEUE/LOG over NFNETLINK"
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
+#ifndef HAVE_STRUCT_XT_ACTION_PARAM
#define xt_action_param xt_match_param
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+#ifndef HAVE_VZALLOC
#define vzalloc(size) __vmalloc(size,\
GFP_KERNEL|__GFP_ZERO|__GFP_HIGHMEM,\
PAGE_KERNEL)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
+#ifndef HAVE_ETHER_ADDR_EQUAL
#include <linux/etherdevice.h>
static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
return !compare_ether_addr(addr1, addr2);
}
+#endif
+#ifndef HAVE_NLA_PUT_BE64
static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
{
return nla_put(skb, attrtype, sizeof(__be64), &value);
@@ -60,22 +76,22 @@ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
}
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-#define NETLINK_PORTID(skb) NETLINK_CB(skb).pid
-#else
+#ifdef HAVE_NL_INFO_PORTID
#define NETLINK_PORTID(skb) NETLINK_CB(skb).portid
+#else
+#define NETLINK_PORTID(skb) NETLINK_CB(skb).pid
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
+#ifndef HAVE_NS_CAPABLE
#define ns_capable(ns, cap) capable(cap)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-#define lock_nfnl() nfnl_lock()
-#define unlock_nfnl() nfnl_unlock()
-#else
+#ifdef HAVE_NFNL_LOCK_SUBSYS
#define lock_nfnl() nfnl_lock(NFNL_SUBSYS_IPSET)
#define unlock_nfnl() nfnl_unlock(NFNL_SUBSYS_IPSET)
+#else
+#define lock_nfnl() nfnl_lock()
+#define unlock_nfnl() nfnl_unlock()
#endif
#ifdef NLA_PUT_NET16