]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath: Replace nf_ct_invert_tuplepr() with nf_ct_invert_tuple()
authorYi-Hung Wei <yihung.wei@gmail.com>
Tue, 15 Oct 2019 17:27:43 +0000 (10:27 -0700)
committerBen Pfaff <blp@ovn.org>
Fri, 18 Oct 2019 17:55:47 +0000 (10:55 -0700)
After upstream net-next commit 303e0c558959 ("netfilter: conntrack:
avoid unneeded nf_conntrack_l4proto lookups") nf_ct_invert_tuplepr()
is no longer available in the kernel.

Ideally, we should be in sync with upstream kernel by calling
nf_ct_invert_tuple() directly in conntrack.c.  However,
nf_ct_invert_tuple() has different function signature in older kernel,
and it would be hard to replace that in the compat layer. Thus, we
use rpl_nf_ct_invert_tuple() in conntrack.c and maintain compatibility
in the compat layer so that ovs kernel module runs smoothly in both
new and old kernel.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
acinclude.m4
datapath/conntrack.c
datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h

index d60016f33e2770dafa96a6b8fd4a7cd73951d673..a93e49e7dea3ef55f67adcd16dd31d24a453d333 100644 (file)
@@ -697,6 +697,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [nf_ct_set])
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h],
                   [nf_ct_is_untracked])
+  OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h],
+                  [nf_ct_invert_tuplepr])
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h],
                   [nf_ct_zone_init])
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_l3proto.h],
index e328afe1ad155c1b2ed1906584b4d84c07679160..afdd65b4cb7c1f95b13c579b9ab0a68271e5365f 100644 (file)
@@ -668,7 +668,7 @@ ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone,
        if (natted) {
                struct nf_conntrack_tuple inverse;
 
-               if (!nf_ct_invert_tuplepr(&inverse, &tuple)) {
+               if (!rpl_nf_ct_invert_tuple(&inverse, &tuple)) {
                        pr_debug("ovs_ct_find_existing: Inversion failed!\n");
                        return NULL;
                }
index 84cb09e6582771cfd4e930eb6cadbf202984bdc1..bb3d7947183e808f8b5037dfa0aba65fca078f3e 100644 (file)
@@ -113,4 +113,18 @@ rpl_nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state)
 #define nf_conntrack_in rpl_nf_conntrack_in
 #endif /* HAVE_NF_CONNTRACK_IN_TAKES_NF_HOOK_STATE */
 
+#ifdef HAVE_NF_CT_INVERT_TUPLEPR
+static inline bool rpl_nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
+       const struct nf_conntrack_tuple *orig)
+{
+       return nf_ct_invert_tuplepr(inverse, orig);
+}
+#else
+static inline bool rpl_nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
+       const struct nf_conntrack_tuple *orig)
+{
+       return nf_ct_invert_tuple(inverse, orig);
+}
+#endif /* HAVE_NF_CT_INVERT_TUPLEPR */
+
 #endif /* _NF_CONNTRACK_CORE_WRAPPER_H */