summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2019-10-15 10:27:43 -0700
committerBen Pfaff <blp@ovn.org>2019-10-18 10:55:47 -0700
commitc1d728dbdea811293e6aa6c18ee9e2b323fac875 (patch)
tree0468c0a74e2d5fde2ce1818423a841d1927e5cd9 /datapath
parent719197e73bac15656374af48a0f86b79d9eaea34 (diff)
downloadopenvswitch-c1d728dbdea811293e6aa6c18ee9e2b323fac875.tar.gz
datapath: Replace nf_ct_invert_tuplepr() with nf_ct_invert_tuple()
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>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/conntrack.c2
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h14
2 files changed, 15 insertions, 1 deletions
diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index e328afe1a..afdd65b4c 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -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;
}
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
index 84cb09e65..bb3d79471 100644
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
+++ b/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
@@ -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 */