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

Re: mirari updates

This is something I did a while back in order to allow interfaces to open in Mac environments. It was the only way to open raw ethernet sockets in MacOSX. The equivalent action in Linux should open a raw ethernet socket using Libc (Something along this lines http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html). At the moment I haven't fixed the Linux code to work. In the case of LinuxÂI had an ifdefÂfunction which implements an empty function for this.Â

It is a bit complicated to handle this case because there is a different approach on how to read packets from pcapÂfd in Macosx and from raw ethernet sockets in Linux. The difference is that in pcapÂyou need to skip the pcapÂheader. This is not the case in Linux. I can fix quickly the code if you could give me some hint on how I could detect in Ocaml the OS type.Â

On 28 February 2013 11:07, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
On 27 Feb 2013, at 22:15, Vincent B. <vb@xxxxxxxxx> wrote:
> No, I have a problem with the UNIX backend, the function pcap_opendev is not implemented in Linux. I have tried to implement that this afternoon, only to find out in the end that this was not straightforward (pcap_open_live returns a pcap_t * and not a fd). I did not have the time to inquire further. I spent hours trying to make the buildsystem (which is based on a cmd script + ocamlbuild/custom myocamlbuild -- maybe we should port that on obuild ?) link the resulting libs with pcap (-lpcap). I did not manage to do that either, wasnât proficient enough in ocamlbuild scripting.

Truth be told, I have no idea what pcap is doing in there. ÂHaris, is it to avoid requiring a tuntap bridge and to work with an existing interface?

I'd be inclined to not expose it all to Linux for the moment, since it already has the bridging support for tuntap. MacOS X doesn't have kernel-level bridging, so I can see why pcap is useful there.

Btw, the cmd script was just a quick shim. ÂReplacing it with obuild would be great, if it can handle all the C bindings. ÂIt may be better to build the C components with a conventional Makefile, and the OCaml libraries with obuild.


Charalampos Rotsos
PhD student
The University of Cambridge
Computer Laboratory
William Gates Building
JJ Thomson Avenue

Phone: +44-(0) 1223 767032
Email: cr409@xxxxxxxxxxxx



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