[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Current state of the UNIX backend



On 24 May 2013, at 19:23, Vincent Bernardoff <vb@xxxxxxxxxxxxxx> wrote:

> Hi all,
> 
> Apparently, the current state of mirage for UNIX-direct is broken for me.
> 
> Could you test it for me, Mac users:
> 
> cd mirage-skeleton/basic
> mirari configure --unix
> mirari build --unix
> sudo ./mir-hello
> 
> On my test machine it fails with:
> 
> Fatal error: exception Unix.Unix_error(3, "set_nonblock", "")

I added a test_nonblock.ml to ocaml-tuntap to build a small repro case.

$ sudo dtruss ./_build/test/test_nonblock.native

 3321/0x46aed:  open("/dev/tap0\0", 0x2, 0x4)            = 5 0
 3321/0x46aed:  fcntl(0xB, 0x3, 0x0)             = -1 Err#9

Notice that the fd we opened was '5' and the fd actually passed to fcntl is 
0xB.  Which is a bit off, and looking at the tuntap_stubs.c shows:

diff --git a/lib/tuntap_stubs.c b/lib/tuntap_stubs.c
index cb5e11d..703d477 100644
--- a/lib/tuntap_stubs.c
+++ b/lib/tuntap_stubs.c
@@ -121,7 +121,7 @@ tun_alloc(char *dev, int kind, int pi, int persist, int 
user, int group)
       caml_failwith("Unable to open the TUN or TAP interface");
     }
 
-  return Val_int(fd);
+  return fd;
 }
 
 CAMLprim value

Your sendmsg was likely also failing due to this problem -- if you get an EBADF 
error, it normally means the file descriptor integer is somehow wrong.  I'll 
send you a pull request with the fixes and tests...

Btw, Jeremy Yallop will be showing off a new type-safe FFI library he's been 
building at the next OCaml Labs meeting on Friday, which will make bugs like 
this a thing of the past...

The UNIX backend isn't quite working yet on MacOS X after this.  I get:
Manager: plug tap0
[netif-input] error : Unix.Unix_error(Unix.EIO, "read", "")
[netif-input] error : Unix.Unix_error(Unix.EIO, "read", "")
[netif-input] error : Unix.Unix_error(Unix.EIO, "read", "")

...which probably means that the interface isn't up yet.

-anil


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.