From patchwork Tue Jan 12 01:53:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 566255 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 30C3C1402BC for ; Tue, 12 Jan 2016 12:55:18 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 46EA6108B0; Mon, 11 Jan 2016 17:54:31 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id D9A1310898 for ; Mon, 11 Jan 2016 17:54:29 -0800 (PST) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 6037C420056 for ; Mon, 11 Jan 2016 18:54:29 -0700 (MST) X-ASG-Debug-ID: 1452563669-09eadd1a1b93b60001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id 8cxTMETwibxo6WmD (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 11 Jan 2016 18:54:29 -0700 (MST) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO relay2-d.mail.gandi.net) (217.70.183.194) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 12 Jan 2016 01:54:28 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at ovn.org designates 217.70.183.194 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.194 X-Barracuda-RBL-IP: 217.70.183.194 Received: from mfilter18-d.gandi.net (mfilter18-d.gandi.net [217.70.178.146]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 623DDC5A5C; Tue, 12 Jan 2016 02:54:27 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter18-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter18-d.gandi.net (mfilter18-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id yQYF3-_8_vIr; Tue, 12 Jan 2016 02:54:26 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from localhost.localdomain (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id F3AD4C5A51; Tue, 12 Jan 2016 02:54:24 +0100 (CET) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-110088084 X-CudaMail-DTE: 011116 X-CudaMail-Originating-IP: 217.70.183.194 Date: Mon, 11 Jan 2016 17:53:59 -0800 X-ASG-Orig-Subj: [##CM-E1-110088084##][PATCH 11/13] compat: Detect and use nf_ct_frag6_gather(). Message-Id: <1452563641-33507-12-git-send-email-joe@ovn.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452563641-33507-1-git-send-email-joe@ovn.org> References: <1452563641-33507-1-git-send-email-joe@ovn.org> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1452563669 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 11/13] compat: Detect and use nf_ct_frag6_gather(). X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This function is a likely candidate for backporting, and currently relies on version checks to include the source or not. Grep for the appropriate functions instead, and include the backport based on that. Signed-off-by: Joe Stringer --- acinclude.m4 | 4 ++++ .../compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h | 14 ++++++++++++-- datapath/linux/compat/nf_conntrack_reasm.c | 6 +++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f0ea2fcea62d..7357a9fdfc74 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -404,6 +404,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [nf_ct_zone_init]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], [nf_connlabels_get]) + OVS_GREP_IFELSE([$KSRC/include/net/netfilter/ipv6/nf_defrag_ipv6.h], + [nf_ct_frag6_consume_orig]) + OVS_GREP_IFELSE([$KSRC/include/net/netfilter/ipv6/nf_defrag_ipv6.h], + [nf_ct_frag6_output]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) diff --git a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h index 7d51491a9c1b..97052ccc4d99 100644 --- a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h +++ b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h @@ -7,8 +7,14 @@ #include_next #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) +/* Upstream commit 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free clone + * operations") changed the semantics of nf_ct_frag6_gather(), so we backport + * it for all prior kernels. + */ +#if defined(HAVE_NF_CT_FRAG6_CONSUME_ORIG) || \ + defined(HAVE_NF_CT_FRAG6_OUTPUT) #if defined(OVS_FRAGMENT_BACKPORT) +#define OVS_NF_DEFRAG6_BACKPORT 1 struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user); int __init rpl_nf_ct_frag6_init(void); void rpl_nf_ct_frag6_cleanup(void); @@ -24,9 +30,13 @@ static inline void rpl_nf_ct_frag6_cleanup(void) { } static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { } #endif /* OVS_FRAGMENT_BACKPORT */ #define nf_ct_frag6_gather rpl_nf_ct_frag6_gather +#else /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */ +static inline int __init rpl_nf_ct_frag6_init(void) { return 0; } +static inline void rpl_nf_ct_frag6_cleanup(void) { } +static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { } +#endif /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */ #define nf_ct_frag6_init rpl_nf_ct_frag6_init #define nf_ct_frag6_cleanup rpl_nf_ct_frag6_cleanup #define nf_ct_frag6_consume_orig rpl_nf_ct_frag6_consume_orig -#endif /* < 4.3 */ #endif /* __NF_DEFRAG_IPV6_WRAPPER_H */ diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index 89a39789d322..fec9e5794f88 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -21,8 +21,6 @@ #include -#ifdef OVS_FRAGMENT_BACKPORT - #include #include #include @@ -56,6 +54,8 @@ #include #include +#ifdef OVS_NF_DEFRAG6_BACKPORT + static const char nf_frags_cache_name[] = "nf-frags"; struct nf_ct_frag6_skb_cb @@ -651,4 +651,4 @@ void rpl_nf_ct_frag6_cleanup(void) inet_frags_fini(&nf_frags); } -#endif /* OVS_FRAGMENT_BACKPORT */ +#endif /* OVS_NF_DEFRAG6_BACKPORT */