From patchwork Tue Oct 2 04:49:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 188383 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7CF172C00A4 for ; Tue, 2 Oct 2012 14:50:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752176Ab2JBEt5 (ORCPT ); Tue, 2 Oct 2012 00:49:57 -0400 Received: from mail.vyatta.com ([76.74.103.46]:38598 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753Ab2JBEt4 (ORCPT ); Tue, 2 Oct 2012 00:49:56 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.vyatta.com (Postfix) with ESMTP id 8529D141030B; Mon, 1 Oct 2012 21:49:45 -0700 (PDT) X-Virus-Scanned: amavisd-new at tahiti.vyatta.com Received: from mail.vyatta.com ([127.0.0.1]) by localhost (mail.vyatta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZfclqZ5iH8nA; Mon, 1 Oct 2012 21:49:44 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-80-93.bvtn.or.frontiernet.net [50.53.80.93]) by mail.vyatta.com (Postfix) with ESMTPSA id 86A1D14101DD; Mon, 1 Oct 2012 21:49:44 -0700 (PDT) Date: Mon, 1 Oct 2012 21:49:21 -0700 From: Stephen Hemminger To: ebiederm@xmission.com (Eric W. Biederman) Cc: netdev@vger.kernel.org Subject: [PATCHv2 net-next] vxlan: put UDP socket in correct namespace Message-ID: <20121001214921.78d9ed72@nehalam.linuxnetplumber.net> In-Reply-To: <87626tbsgq.fsf@xmission.com> References: <20121001141609.14639bc0@nehalam.linuxnetplumber.net> <20121001145838.5eafef4c@nehalam.linuxnetplumber.net> <87fw5xeryf.fsf@xmission.com> <20121001155702.5b5e2188@nehalam.linuxnetplumber.net> <87y5jpdbzo.fsf@xmission.com> <20121001163226.3873ca58@nehalam.linuxnetplumber.net> <871uhhd82p.fsf@xmission.com> <20121001175107.0ec2931c@nehalam.linuxnetplumber.net> <87626tbsgq.fsf@xmission.com> Organization: Vyatta X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Move vxlan UDP socket to correct network namespace Signed-off-by: Stephen Hemminger Acked-by: "Eric W. Biederman" --- v2 need to change sock_release to sk_release_kernel -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/vxlan.c 2012-10-01 17:18:30.776513263 -0700 +++ b/drivers/net/vxlan.c 2012-10-01 21:47:40.435979178 -0700 @@ -1136,6 +1136,9 @@ static __net_init int vxlan_init_net(str pr_debug("UDP socket create failed\n"); return rc; } + /* Put in proper namespace */ + sk = vn->sock->sk; + sk_change_net(sk, net); vxlan_addr.sin_port = htons(vxlan_port); @@ -1144,13 +1147,12 @@ static __net_init int vxlan_init_net(str if (rc < 0) { pr_debug("bind for UDP socket %pI4:%u (%d)\n", &vxlan_addr.sin_addr, ntohs(vxlan_addr.sin_port), rc); - sock_release(vn->sock); + sk_release_kernel(sk); vn->sock = NULL; return rc; } /* Disable multicast loopback */ - sk = vn->sock->sk; inet_sk(sk)->mc_loop = 0; /* Mark socket as an encapsulation socket. */ @@ -1169,7 +1171,7 @@ static __net_exit void vxlan_exit_net(st struct vxlan_net *vn = net_generic(net, vxlan_net_id); if (vn->sock) { - sock_release(vn->sock); + sk_release_kernel(vn->sock->sk); vn->sock = NULL; } }