tap-bsd.c has no test for Mac OS X

Bug #647793 reported by Ted Lemon
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned
Nominated for Trunk by Ted Lemon

Bug Description

The Mac OS X tun/tap driver is equivalent to the FreeBSD driver, but bsd-tap.c uses the NetBSD/OpenBSD driver, which works differently. The fix is easy--just check for __APPLE__ in the same place where you check for FreeBSD in net/tap-bsd.c.

This problem exists in the current git tree, at least as of yesterday afternoon.

Revision history for this message
Ted Lemon (mellon-fugue) wrote :
Revision history for this message
Andreas Färber (afaerber) wrote :

I've verified that the code still compiles warning-free on v10.5 with this patch applied.

Before:

$ qemu-system-sparc64 -M sun4u -m 2048 -net tap -net nic
warning: could not open /dev/tap: no virtual network emulation
qemu-system-sparc64: -net tap: Device 'tap' could not be initialized

After:

$ qemu-system-sparc64 -M sun4u -m 2048 -net tap -net nic
qemu-system-sparc64: -net tap: warning: could not open /dev/tap0 (No such file or directory): no virtual network emulation
qemu-system-sparc64: -net tap: Device 'tap' could not be initialized

Could you please resubmit it to qemu-devel using git-send-email and a full commit message with Signed-off-by?
If would also be helpful if you could supply instructions for me to properly setup and test this on Mac OS X. Thanks!

Revision history for this message
Ted Lemon (mellon-fugue) wrote :

This is really pathetic, but I'm afraid I have no clue how to do this:

> Could you please resubmit it to qemu-devel using git-send-email and a full commit message with Signed-off-by?

I tried googling and reading manuals, but I couldn't connect the dots. Can you send me a sample command line? I'm sure it's dead easy, but my experience with git is basically just downloading sources--all the projects I work on regularly still use cvs or svn.

To set this up on Mac OS X, you need to install the tun/tap drivers, because OSX doesn't come with any. These are available at tuntaposx.sourceforge.net. If you use Tunnelblick to run openvpn, it sets up tun/tap for you and then cleverly removes the kernel modules when you don't have a tunnel open, so that the drivers are there but not active. You will have to overcome this somehow; I have an older version of Tunnelblick that doesn't do this, so I don't know how to work around this problem. If you aren't using Tunnelblick, I think installing the tun/tap drivers will Just Work.

Once you have them installed, you can just start up qemu normally. I use the following script:

../qemu/sparc-softmmu/qemu-system-sparc -M SS-5 -bios ./ss5.bin -nographic -hda SunOS4.1.4 -net tap,script=tap1,vlan=0 -net nic,vlan=0

The startup script (tap1) is this:

#!/bin/sh
ifconfig tap1 192.5.5.1 netmask 255.255.255.0

Because it's running ifconfig, the whole thing has to be started as root; I think it would be fine to drop privs after that, though.

Revision history for this message
boecko (andy-boeckler) wrote :

this seems to be fixed in QEMU 0.14

Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.