[ovs-dev,v3,1/2] compat: add SCTP netfilter states for older kernels
diff mbox series

Message ID 20190521181631.14687-1-aconole@redhat.com
State Accepted
Headers show
Series
  • [ovs-dev,v3,1/2] compat: add SCTP netfilter states for older kernels
Related show

Checks

Context Check Description
ovsrobot/default success None
ovsrobot/robo_travis pending Robot travis build

Commit Message

Aaron Conole May 21, 2019, 6:16 p.m. UTC
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>
---
v3: introduced

 acinclude.m4                                | 15 ++++++++++++
 configure.ac                                |  1 +
 include/linux/automake.mk                   |  1 +
 include/linux/netfilter/nf_conntrack_sctp.h | 26 +++++++++++++++++++++
 4 files changed, 43 insertions(+)
 create mode 100644 include/linux/netfilter/nf_conntrack_sctp.h

Patch
diff mbox series

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