summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Conole <aconole@redhat.com>2019-05-21 14:16:30 -0400
committerBen Pfaff <blp@ovn.org>2019-05-24 09:50:53 -0700
commit8c7130da98c55bdf13eae62b5250434f8dfd366b (patch)
treeb3c66b7d9ff596f1809f4eac4fd8d26d7763162f
parentfbc22735fd0d830d1e9367eb42a3feeb3615c449 (diff)
downloadopenvswitch-8c7130da98c55bdf13eae62b5250434f8dfd366b.tar.gz
compat: add SCTP netfilter states for older kernels
Bake in the SCTP states from the kernel UAPI. This means an older revision of the kernel headers won't interfere with the SCTP display enhancement. Additionally, if a newer version is available, or if x-compiling the datapath module we defer to that version (since this is just meant to provide the missing definitions). This will be used in a future commit. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--acinclude.m415
-rw-r--r--configure.ac1
-rw-r--r--include/linux/automake.mk1
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h26
4 files changed, 43 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index f8fc5bcd7..cf9cc8b8b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -212,6 +212,21 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
[Define to 1 if TCA_SKBEDIT_FLAGS is available.])])
])
+dnl OVS_CHECK_LINUX_SCTP_CT
+dnl
+dnl Checks for kernels which need additional SCTP state
+AC_DEFUN([OVS_CHECK_LINUX_SCTP_CT], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([#include <linux/netfilter/nfnetlink.h>
+#include <linux/netfilter/nfnetlink_conntrack.h>
+#include <linux/netfilter/nf_conntrack_common.h>
+#include <linux/netfilter/nf_conntrack_sctp.h>], [
+ int x = SCTP_CONNTRACK_HEARTBEAT_SENT;
+ ])],
+ [AC_DEFINE([HAVE_SCTP_CONNTRACK_HEARTBEATS], [1],
+ [Define to 1 if SCTP_CONNTRACK_HEARTBEAT_SENT is available.])])
+])
+
dnl OVS_FIND_DEPENDENCY(FUNCTION, SEARCH_LIBS, NAME_TO_PRINT)
dnl
dnl Check for a function in a library list.
diff --git a/configure.ac b/configure.ac
index 505e3d041..2dbe9a917 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,7 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH)
OVS_CHECK_LINUX
OVS_CHECK_LINUX_TC
+OVS_CHECK_LINUX_SCTP_CT
OVS_CHECK_DPDK
OVS_CHECK_PRAGMA_MESSAGE
AC_SUBST([OVS_CFLAGS])
diff --git a/include/linux/automake.mk b/include/linux/automake.mk
index 45271d1d5..24f85200b 100644
--- a/include/linux/automake.mk
+++ b/include/linux/automake.mk
@@ -1,4 +1,5 @@
noinst_HEADERS += \
+ include/linux/netfilter/nf_conntrack_sctp.h \
include/linux/pkt_cls.h \
include/linux/tc_act/tc_pedit.h \
include/linux/tc_act/tc_skbedit.h \
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
new file mode 100644
index 000000000..03b659052
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -0,0 +1,26 @@
+#ifndef __LINUX_NETFILTER_CONNTRACK_SCTP_WRAPPER_H
+#define __LINUX_NETFILTER_CONNTRACK_SCTP_WRAPPER_H 1
+
+#if defined(__KERNEL__) || defined(HAVE_SCTP_CONNTRACK_HEARTBEATS)
+#include_next <linux/netfilter/nf_conntrack_sctp.h>
+#else
+
+/* These are the states defined in the kernel UAPI for connection
+ * tracking. */
+enum sctp_conntrack {
+ SCTP_CONNTRACK_NONE,
+ SCTP_CONNTRACK_CLOSED,
+ SCTP_CONNTRACK_COOKIE_WAIT,
+ SCTP_CONNTRACK_COOKIE_ECHOED,
+ SCTP_CONNTRACK_ESTABLISHED,
+ SCTP_CONNTRACK_SHUTDOWN_SENT,
+ SCTP_CONNTRACK_SHUTDOWN_RECD,
+ SCTP_CONNTRACK_SHUTDOWN_ACK_SENT,
+ SCTP_CONNTRACK_HEARTBEAT_SENT,
+ SCTP_CONNTRACK_HEARTBEAT_ACKED,
+ SCTP_CONNTRACK_MAX
+};
+
+#endif
+
+#endif