netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: netdev@vger.kernel.org
Subject: [PATCHv2 net-next] vxlan: put UDP socket in correct namespace
Date: Mon, 1 Oct 2012 21:49:21 -0700	[thread overview]
Message-ID: <20121001214921.78d9ed72@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <87626tbsgq.fsf@xmission.com>

Move vxlan UDP socket to correct network namespace

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
v2 need to change sock_release to sk_release_kernel

--- 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;
 	}
 }

  reply	other threads:[~2012-10-02  4:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20121001141609.14639bc0@nehalam.linuxnetplumber.net>
     [not found] ` <20121001145838.5eafef4c@nehalam.linuxnetplumber.net>
2012-10-01 22:40   ` network namespace and kernel bind issue Eric W. Biederman
2012-10-01 22:57     ` Stephen Hemminger
2012-10-01 23:11       ` Eric W. Biederman
2012-10-01 23:32         ` Stephen Hemminger
2012-10-02  0:35           ` Eric W. Biederman
2012-10-02  0:48             ` Stephen Hemminger
2012-10-02  6:15               ` Julian Anastasov
2012-10-02 15:51                 ` Stephen Hemminger
2012-10-02  0:51             ` [PATCH net-next] vxlan: put UDP socket in correct namespace Stephen Hemminger
2012-10-02  0:58               ` Eric W. Biederman
2012-10-02  4:49                 ` Stephen Hemminger [this message]
2012-10-02 15:18                   ` [PATCHv2 " Eric W. Biederman
2012-10-02 18:39                     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121001214921.78d9ed72@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=ebiederm@xmission.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).