summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2019-10-15 10:27:44 -0700
committerBen Pfaff <blp@ovn.org>2019-10-18 10:55:47 -0700
commit9ea96dce45995be460b12b8dd417cc88be190def (patch)
tree477090c894ee02fce98a40552306ea7465bddb2a /datapath
parentc1d728dbdea811293e6aa6c18ee9e2b323fac875 (diff)
downloadopenvswitch-9ea96dce45995be460b12b8dd417cc88be190def.tar.gz
datapath: Detect upstream nf_nat change
The following two upstream commits merge nf_nat_ipv4 and nf_nat_ipv6 into nf_nat core, and move some header files around. To handle these modifications, this patch detects the upstream changes, uses the header files and config symbols properly. Ideally, we should replace CONFIG_NF_NAT_IPV4 and CONFIG_NF_NAT_IPV6 with CONFIG_NF_NAT and CONFIG_IPV6. In order to keep backward compatibility, we keep the checking of CONFIG_NF_NAT_IPV4/6 as is for the old kernel, and replace them with marco for the new kernel. upstream commits: 3bf195ae6037 ("netfilter: nat: merge nf_nat_ipv4,6 into nat core") d2c5c103b133 ("netfilter: nat: remove nf_nat_l3proto.h and nf_nat_core.h") 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.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index afdd65b4c..291d4f472 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -35,10 +35,21 @@
#include <net/ipv6_frag.h>
#ifdef CONFIG_NF_NAT_NEEDED
+/* Starting from upstream commit 3bf195ae6037 ("netfilter: nat: merge
+ * nf_nat_ipv4,6 into nat core") in kernel 5.1. nf_nat_ipv4,6 are merged
+ * into nf_nat. In order to keep backward compatibility, we keep the config
+ * checking as is for the old kernel, and replace them with marco for the
+ * new kernel. */
+#ifdef HAVE_UPSTREAM_NF_NAT
+#include <net/netfilter/nf_nat.h>
+#define CONFIG_NF_NAT_IPV4 CONFIG_NF_NAT
+#define CONFIG_NF_NAT_IPV6 CONFIG_IPV6
+#else
#include <linux/netfilter/nf_nat.h>
#include <net/netfilter/nf_nat_core.h>
#include <net/netfilter/nf_nat_l3proto.h>
-#endif
+#endif /* HAVE_UPSTREAM_NF_NAT */
+#endif /* CONFIG_NF_NAT_NEEDED */
#include "datapath.h"
#include "conntrack.h"