From patchwork Mon May 2 18:19:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 617648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qzCJ74p2Fz9sC4 for ; Tue, 3 May 2016 04:19:35 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id BC911102BB; Mon, 2 May 2016 11:19:34 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id EF4C2102B0 for ; Mon, 2 May 2016 11:19:32 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 764621E00ED for ; Mon, 2 May 2016 12:19:32 -0600 (MDT) X-ASG-Debug-ID: 1462213171-09eadd604325e60001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id VkyNPgyLSZYB53MT (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 02 May 2016 12:19:31 -0600 (MDT) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO relay5-d.mail.gandi.net) (217.70.183.197) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 2 May 2016 18:19:31 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.197 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.197 X-Barracuda-RBL-IP: 217.70.183.197 Received: from mfilter28-d.gandi.net (mfilter28-d.gandi.net [217.70.178.159]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id D14D541C08D; Mon, 2 May 2016 20:19:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter28-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter28-d.gandi.net (mfilter28-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id gdYCIE0nPkJt; Mon, 2 May 2016 20:19:28 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from localhost.localdomain (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 32AE141C080; Mon, 2 May 2016 20:19:26 +0200 (CEST) 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-E2-501056985 X-CudaMail-DTE: 050216 X-CudaMail-Originating-IP: 217.70.183.197 Date: Mon, 2 May 2016 11:19:10 -0700 X-ASG-Orig-Subj: [##CM-E2-501056985##][PATCHv2 1/9] compat: Add a struct net parameter to l4_pkt_to_tuple. Message-Id: <1462213158-60221-2-git-send-email-joe@ovn.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462213158-60221-1-git-send-email-joe@ovn.org> References: <1462213158-60221-1-git-send-email-joe@ovn.org> X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1462213171 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] [PATCHv2 1/9] compat: Add a struct net parameter to l4_pkt_to_tuple. 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" Upstream commit: netfilter: nf_conntrack: Add a struct net parameter to l4_pkt_to_tuple As gre does not have the srckey in the packet gre_pkt_to_tuple needs to perform a lookup in it's per network namespace tables. Pass in the proper network namespace to all pkt_to_tuple implementations to ensure gre (and any similar protocols) can get this right. Signed-off-by: "Eric W. Biederman" Signed-off-by: Pablo Neira Ayuso Upstream: a31f1adc0948 ("netfilter: nf_conntrack: Add a struct net parameter to l4_pkt_to_tuple") Signed-off-by: Joe Stringer --- v2: Initial Post. --- acinclude.m4 | 3 +++ datapath/conntrack.c | 2 +- datapath/linux/Modules.mk | 1 + .../linux/compat/include/net/netfilter/nf_conntrack.h | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 datapath/linux/compat/include/net/netfilter/nf_conntrack.h diff --git a/acinclude.m4 b/acinclude.m4 index acd7ce7c13cc..398205673951 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -426,6 +426,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], [tmpl_alloc.*conntrack_zone], [OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])]) + OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], + [l3num.*struct.net], + [OVS_DEFINE([HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET])]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h], [nf_ct_zone_init]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 0338f9f0c930..c365e2e205a7 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -373,7 +373,7 @@ ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone, { struct nf_conntrack_tuple tuple; - if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, &tuple)) + if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, net, &tuple)) return NULL; return __nf_ct_expect_find(net, zone, &tuple); } diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk index 6ab52a76ceff..7e334cbf030a 100644 --- a/datapath/linux/Modules.mk +++ b/datapath/linux/Modules.mk @@ -99,6 +99,7 @@ openvswitch_headers += \ linux/compat/include/net/stt.h \ linux/compat/include/net/vrf.h \ linux/compat/include/net/vxlan.h \ + linux/compat/include/net/netfilter/nf_conntrack.h \ linux/compat/include/net/netfilter/nf_conntrack_core.h \ linux/compat/include/net/netfilter/nf_conntrack_expect.h \ linux/compat/include/net/netfilter/nf_conntrack_labels.h \ diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack.h new file mode 100644 index 000000000000..e02e20b28baf --- /dev/null +++ b/datapath/linux/compat/include/net/netfilter/nf_conntrack.h @@ -0,0 +1,17 @@ +#ifndef _NF_CONNTRACK_WRAPPER_H +#define _NF_CONNTRACK_WRAPPER_H + +#include_next + +#ifndef HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET +static inline bool rpl_nf_ct_get_tuplepr(const struct sk_buff *skb, + unsigned int nhoff, + u_int16_t l3num, struct net *net, + struct nf_conntrack_tuple *tuple) +{ + return nf_ct_get_tuplepr(skb, nhoff, l3num, tuple); +} +#define nf_ct_get_tuplepr rpl_nf_ct_get_tuplepr +#endif + +#endif /* _NF_CONNTRACK_WRAPPER_H */