Commit e75762fd authored by Rob Landley's avatar Rob Landley Committed by Eric Van Hensbergen

net/9p: enable 9p to work in non-default network namespace

Teach 9p filesystem to work in container with non-default network namespace.
(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...)

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/lxcSigned-off-by: default avatarRob Landley <rob@landley.net>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent fe1cbaba
...@@ -916,8 +916,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) ...@@ -916,8 +916,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
sin_server.sin_family = AF_INET; sin_server.sin_family = AF_INET;
sin_server.sin_addr.s_addr = in_aton(addr); sin_server.sin_addr.s_addr = in_aton(addr);
sin_server.sin_port = htons(opts.port); sin_server.sin_port = htons(opts.port);
err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_INET,
SOCK_STREAM, IPPROTO_TCP, &csocket, 1);
if (err) { if (err) {
P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n");
return err; return err;
...@@ -954,7 +954,8 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) ...@@ -954,7 +954,8 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
sun_server.sun_family = PF_UNIX; sun_server.sun_family = PF_UNIX;
strcpy(sun_server.sun_path, addr); strcpy(sun_server.sun_path, addr);
err = sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_UNIX,
SOCK_STREAM, 0, &csocket, 1);
if (err < 0) { if (err < 0) {
P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n");
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment