Skip to contentSkip to conversation

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

Qemu-devel Ted Lemon 2 participants 5 messages Sep 25, 2010 – Apr 2, 2011

lore
Share & tools
lore

Ted Lemon

author
#0 lore raw

Public bug reported:

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.

** Affects: qemu
Importance: Undecided
Status: New

Signature · 11 lines
tap-bsd.c has no test for Mac OS X
https://bugs.launchpad.net/bugs/647793
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

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.
author
#1 lore raw

** Patch added: "tap-bsd.diff"
https://bugs.launchpad.net/bugs/647793/+attachment/1636699/+files/tap-bsd.diff

Signature · 11 lines
tap-bsd.c has no test for Mac OS X
https://bugs.launchpad.net/bugs/647793
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

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.
#2 lore raw
In reply to Ted Lemon

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!

Signature · 11 lines
tap-bsd.c has no test for Mac OS X
https://bugs.launchpad.net/bugs/647793
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

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.
author
#3 lore raw
In reply to Ted Lemon

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

Quoted 1 line

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.

Signature · 11 lines
tap-bsd.c has no test for Mac OS X
https://bugs.launchpad.net/bugs/647793
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

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.
#4 lore raw
In reply to Ted Lemon

this seems to be fixed in QEMU 0.14

** Changed in: qemu
Status: New => Fix Released

Signature · 18 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/647793

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

Status in QEMU:
  Fix Released

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.