From patchwork Sat May 21 10:00:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Landley X-Patchwork-Id: 805552 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4LA0cjC007711 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 21 May 2011 10:01:00 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QNiyp-0004so-QS; Sat, 21 May 2011 10:00:19 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QNiyo-0004si-2Y for v9fs-developer@lists.sourceforge.net; Sat, 21 May 2011 10:00:18 +0000 X-ACL-Warn: Received: from mail-iy0-f175.google.com ([209.85.210.175]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1QNiyn-00081z-0m for v9fs-developer@lists.sourceforge.net; Sat, 21 May 2011 10:00:18 +0000 Received: by iye7 with SMTP id 7so5097664iye.34 for ; Sat, 21 May 2011 03:00:11 -0700 (PDT) Received: by 10.42.169.67 with SMTP id a3mr6168929icz.160.1305972011616; Sat, 21 May 2011 03:00:11 -0700 (PDT) Received: from [192.168.42.210] (mfc2836d0.tmodns.net [208.54.40.252]) by mx.google.com with ESMTPS id a8sm1889735ibg.48.2011.05.21.03.00.09 (version=SSLv3 cipher=OTHER); Sat, 21 May 2011 03:00:10 -0700 (PDT) Message-ID: <4DD78D23.9040909@landley.net> Date: Sat, 21 May 2011 05:00:03 -0500 From: Rob Landley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: v9fs-developer@lists.sourceforge.net X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1QNiyn-00081z-0m Subject: [V9fs-developer] [PATCH] Make 9p work in container with non-default network namespace. X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 21 May 2011 10:01:01 +0000 (UTC) (Note: I also patched the unix domain socket code but don't have a test case for that. It's the same fix, I just don't have a server for it...) From: Rob Landley Teach 9p filesystem to work in container with non-default network namespace. To test, run diod server (http://code.google.com/p/diod): diod -n -f -L stderr -l 172.23.255.1:9999 -c /dev/null -e /root and then mount like so: mount -t 9p -o port=9999,aname=/root,version=9p2000.L 172.23.255.1 /mnt A container test environment is described at http://landley.net/lxc Signed-off-by: Rob Landley --- net/9p/trans_fd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index aa5672b..707a988 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -918,8 +918,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) sin_server.sin_family = AF_INET; sin_server.sin_addr.s_addr = in_aton(addr); sin_server.sin_port = htons(opts.port); - err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); - + err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_INET, + SOCK_STREAM, IPPROTO_TCP, &csocket, 1); if (err) { P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); return err; @@ -956,7 +956,8 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) sun_server.sun_family = PF_UNIX; strcpy(sun_server.sun_path, addr); - err = sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); + err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_UNIX, + SOCK_STREAM, 0, &csocket, 1); if (err < 0) { P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); return err;