[ovs-dev] [PATCH] datapath: Apply bug fixes of nf_conncount for different kernel versions

Yifeng Sun pkusunyifeng at gmail.com
Wed Aug 7 00:06:05 UTC 2019

In upstream kernel, there are several critical bug fixes for nf_conncount
between 5c789e1 ("netfilter: nf_conncount: Add list lock and gc worker,
and RCU for init tree search") and c78e781 ("netfilter: nf_conncount:
replace CONNCOUNT_LOCK_SLOTS with CONNCOUNT_SLOTS"). This fixes are
already backported to OVS datapath.

This patch helps OVS datapath to always choose bug-fixed nf_conncount code.
If kernel already has these fixes, then kernel's nf_conncount is being used.
Otherwise, OVS falls back to use compat nf_conncount functions.

This patch is suggested by YiHung Wei.

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
 acinclude.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index f8e856d3303f..f0e38898b17a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -713,7 +713,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_range2])
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust])
   OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h], [nf_conncount_gc_list],
+                  [OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h],
+                                   [int nf_conncount_add],
+                                   [], [OVS_DEFINE([HAVE_UPSTREAM_NF_CONNCOUNT])])])
   OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
   OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])

More information about the dev mailing list