Sending a package via macvtap linux interface

Linux supports the interface type, macvtap. I can't find great documentation, but it's a good starter: http://virt.kernelnewbies.org/MacVTap

I am trying to use this to create a new virtual network device that I can programmatically read and write to send raw packets. While I can read normally from the tap interface, I cannot figure out how to write it.

  • I open the crane device with the usual syscall open.
  • I tried to use writeto send the package, but I get a response Invalid argument (EINVAL).
  • Also tried to use sendmsg, but of course, get an error message that I have a simple file descriptor, not a socket.

Can this be done? Or do macvtap interfaces support read only from the tap interface and require the use of raw sockets or something else to send packets?

(Libvirt code for macvtap is here: https://gitorious.org/libvirt/libvirt/source/63889e0c775010d8d70b71d25340bab995aa83ce:src/util/virmacaddr.c )

Blockquote

+4
source share
1 answer

, . , , macvlan tcp , , , ( , ). IFF_VNET_HDR TUNSETIFF ioctl, .

+2

All Articles