Skip to content

Commit

Permalink
compat: add SCTP netfilter states for older kernels
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed May 24, 2019
1 parent fbc2273 commit 8c7130d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
1 change: 1 addition & 0 deletions include/linux/automake.mk
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
26 changes: 26 additions & 0 deletions include/linux/netfilter/nf_conntrack_sctp.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8c7130d

Please sign in to comment.