diff options
author | Juergen Lock <nox@jelal.kn-bremen.de> | 2009-11-20 23:19:53 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-11-21 09:32:02 +0000 |
commit | 39ca4c083264c9646b986f76d018fd808bac89fc (patch) | |
tree | 7431d19cbc275f8fee16dcc195117015afe311ae /net/tap-bsd.c | |
parent | 22a2bdcbae5aa256eb3d4179b29f1699b62dc110 (diff) | |
download | qemu-39ca4c083264c9646b986f76d018fd808bac89fc.tar.gz qemu-39ca4c083264c9646b986f76d018fd808bac89fc.tar.bz2 qemu-39ca4c083264c9646b986f76d018fd808bac89fc.zip |
Fix tap breakage on BSD hosts (no IFF_VNET_HDR)
net/tap-bsd.c was assuming IFF_VNET_HDR was always available, which
I think isn't true on any BSD.
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'net/tap-bsd.c')
-rw-r--r-- | net/tap-bsd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/tap-bsd.c b/net/tap-bsd.c index ac84383f0f..bde2083e57 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -59,6 +59,17 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required dev = devname(s.st_rdev, S_IFCHR); pstrcpy(ifname, ifname_size, dev); + if (*vnet_hdr) { + /* BSD doesn't have IFF_VNET_HDR */ + *vnet_hdr = 0; + + if (vnet_hdr_required && !*vnet_hdr) { + qemu_error("vnet_hdr=1 requested, but no kernel " + "support for IFF_VNET_HDR available"); + close(fd); + return -1; + } + } fcntl(fd, F_SETFL, O_NONBLOCK); return fd; } |