compat: Detect and use struct nf_conntrack_zone.
authorJoe Stringer <joe@ovn.org>
Thu, 24 Dec 2015 19:29:34 +0000 (11:29 -0800)
committerJoe Stringer <joe@ovn.org>
Tue, 2 Feb 2016 22:26:46 +0000 (14:26 -0800)
Rather than relying on version checks, detect the presence of this
structure and use it if available.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
acinclude.m4
datapath/linux/compat/include/net/netfilter/nf_conntrack_expect.h
datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
datapath/linux/compat/nf_conntrack_core.c

index 41284ea..f1ee8f8 100644 (file)
@@ -392,6 +392,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h],
                   [tmpl_alloc.*conntrack_zone],
                   [OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])])
+  OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h],
+                  [nf_ct_zone_init])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
   OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])
index 98c6d6b..a13f0ce 100644 (file)
@@ -3,7 +3,7 @@
 
 #include_next <net/netfilter/nf_conntrack_expect.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
+#ifndef HAVE_NF_CT_ZONE_INIT
 
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_zones.h>
@@ -17,5 +17,5 @@ rpl___nf_ct_expect_find(struct net *net,
 }
 #define __nf_ct_expect_find rpl___nf_ct_expect_find
 
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
+#endif /* HAVE_NF_CT_ZONE_INIT */
 #endif /* _NF_CONNTRACK_EXPECT_WRAPPER_H */
index 3c5e397..fb43acb 100644 (file)
@@ -7,7 +7,7 @@
 #include_next <net/netfilter/nf_conntrack_zones.h>
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
+#ifndef HAVE_NF_CT_ZONE_INIT
 
 #include <linux/kconfig.h>
 #include <linux/types.h>
@@ -99,5 +99,5 @@ static inline bool nf_ct_zone_equal_any(const struct nf_conn *a,
        return nf_ct_zone(a)->id == b->id;
 }
 #endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
+#endif /* HAVE_NF_CT_ZONE_INIT */
 #endif /* _NF_CONNTRACK_ZONES_WRAPPER_H */
index a266208..a7d3d43 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
+#ifndef HAVE_NF_CT_ZONE_INIT
 
 #include <net/netfilter/nf_conntrack_zones.h>
 
@@ -10,4 +10,4 @@ const struct nf_conntrack_zone nf_ct_zone_dflt = {
        .dir    = NF_CT_DEFAULT_ZONE_DIR,
 };
 
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
+#endif /* HAVE_NF_CT_ZONE_INIT */