From patchwork Mon May 2 18:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 617654 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 3qzCKB6TSSz9s9n for ; Tue, 3 May 2016 04:20:30 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id EA2DF1039A; Mon, 2 May 2016 11:19:46 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 62E2710312 for ; Mon, 2 May 2016 11:19:45 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id E36A31612E1 for ; Mon, 2 May 2016 12:19:44 -0600 (MDT) X-ASG-Debug-ID: 1462213174-0b3237321125870001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id 2yUlWOmuNx38Kwz4 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 02 May 2016 12:19:34 -0600 (MDT) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO relay5-d.mail.gandi.net) (217.70.183.197) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 2 May 2016 18:19:34 -0000 Received-SPF: pass (mx3-pf1.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 mfilter43-d.gandi.net (mfilter43-d.gandi.net [217.70.178.174]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 2B9A441C08A; Mon, 2 May 2016 20:19:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter43-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter43-d.gandi.net (mfilter43-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id ZQlpCH3Kj8KH; Mon, 2 May 2016 20:19:31 +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 8914A41C087; Mon, 2 May 2016 20:19:30 +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-V1-501038817 X-CudaMail-DTE: 050216 X-CudaMail-Originating-IP: 217.70.183.197 Date: Mon, 2 May 2016 11:19:12 -0700 X-ASG-Orig-Subj: [##CM-V1-501038817##][PATCHv2 3/9] compat: ipv6: Pass struct net into nf_ct_frag6_gather. Message-Id: <1462213158-60221-4-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.14.2] X-Barracuda-Start-Time: 1462213174 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 3/9] compat: ipv6: Pass struct net into 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" Upstream commit: ipv6: Pass struct net into nf_ct_frag6_gather The function nf_ct_frag6_gather is called on both the input and the output paths of the networking stack. In particular ipv6_defrag which calls nf_ct_frag6_gather is called from both the the PRE_ROUTING chain on input and the LOCAL_OUT chain on output. The addition of a net parameter makes it explicit which network namespace the packets are being reassembled in, and removes the need for nf_ct_frag6_gather to guess. Signed-off-by: "Eric W. Biederman" Acked-by: Pablo Neira Ayuso Signed-off-by: David S. Miller Upstream: b72775977c39 ("ipv6: Pass struct net into nf_ct_frag6_gather") Signed-off-by: Joe Stringer --- v2: No changes. v1: Initial Post. --- datapath/conntrack.c | 2 +- datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h | 3 ++- datapath/linux/compat/nf_conntrack_reasm.c | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 548a05fc244e..6cf97942ccf2 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -333,7 +333,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, struct sk_buff *reasm; memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm)); - reasm = nf_ct_frag6_gather(skb, user); + reasm = nf_ct_frag6_gather(net, skb, user); if (!reasm) return -EINPROGRESS; 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 416cafff03b1..fe99ced37227 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 @@ -14,7 +14,8 @@ #if defined(HAVE_NF_CT_FRAG6_CONSUME_ORIG) || \ defined(HAVE_NF_CT_FRAG6_OUTPUT) #define OVS_NF_DEFRAG6_BACKPORT 1 -struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user); +struct sk_buff *rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, + u32 user); int __init rpl_nf_ct_frag6_init(void); void rpl_nf_ct_frag6_cleanup(void); void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb); diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index ef29115b6fbd..701bd15d8efd 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -487,12 +487,11 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) return 0; } -struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user) +struct sk_buff *rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, + u32 user) { struct sk_buff *clone; struct net_device *dev = skb->dev; - struct net *net = skb_dst(skb) ? dev_net(skb_dst(skb)->dev) - : dev_net(skb->dev); struct frag_hdr *fhdr; struct frag_queue *fq; struct ipv6hdr *hdr;