From patchwork Tue May 21 18:16:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 1102947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 457kW93p1Gz9s5c for ; Wed, 22 May 2019 04:17:09 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 51F9CCB0; Tue, 21 May 2019 18:16:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6BD8EC8E for ; Tue, 21 May 2019 18:16:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 163B627B for ; Tue, 21 May 2019 18:16:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D86DE128B5; Tue, 21 May 2019 18:16:35 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448C65C69A; Tue, 21 May 2019 18:16:33 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Tue, 21 May 2019 14:16:30 -0400 Message-Id: <20190521181631.14687-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 May 2019 18:16:35 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v3 1/2] compat: add SCTP netfilter states for older kernels X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- 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 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 +#include +#include +#include ], [ + 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 +#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