Create RAW socket?


Dear all,

I was looking at OCaml to build some pretty simple vSwitch and so I need to open a RAW socket in order to manage Ethernet frames.

But I’m unable to bind the socket to an interface.
This is how I create the socket

let create_socket iface = 
  let sock = Lwt_unix.socket Unix.PF_INET Unix.SOCK_RAW 0 in
  let sockaddr = .... ? What is supposed to be there? in
  bind sock sockaddr;

It is possible to create RAW socket in OCaml?
I’m supposed to wrap some C code like this lib ocaml-rawlink