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

Re: [MirageOS-devel] TunTap vs PACKET sockets

One important difference between (packet sockets, BPF, libpcap, BSD divert 
sockets) and (tun, tap) is how you integrate with the host network stack. In 
the former, sending via one of those mechanisms enters the host stack via the 
output path, and receiving occurs via the input path. The latter mechanisms 
introduce synthetic network interfaces in the host stack, so when you send on a 
tap/tun device, it enters the input side of the host network stack, and you 
receive via its output path.

There are implications to either choice. For example, if you send via BPF, your 
packets may not make it back to the host stackâs input path â so you can talk 
to other hosts on the network, but not the one that hosts your application â 
you should view this as âborrowingâ the host stackâs network interface. If you 
use tap/tun, youâll need to set up IP forwarding or link-layer bridging for 
your packets to reach other hosts â but theyâll enter the normal stack input 
paths without a problem. You should view this as âtalking to the host network 
stack as though you are a remote machineâ.


> On 19 Nov 2015, at 12:27, Richard Mortier <richard.mortier@xxxxxxxxxxxx> 
> wrote:
> A question came up in conversation recently that I was (to my shame!)
> unable to answer-- I wondered if anyone on the list might be able to
> assist :)
> We make use of tun/tap (specifically, a tap device) for the direct
> access Mirage network stack. This (it has seemed to me) has always
> been a bit fiddly to get right, and sensitive to installing the right
> versions of support packages.
> What's the rationale for / trade-off of using tun/tap vs using packet sockets?
> (Is it simply that packet sockets are not supported on OSX?)
> Does anyone more up-to-date with latest OSX APIs know if there's
> anything more than BPF for direct network device access at the moment?
> Cheers,
> -- 
> Richard Mortier
> richard.mortier@xxxxxxxxxxxx
> _______________________________________________
> MirageOS-devel mailing list
> MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

MirageOS-devel mailing list



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