From 39ca4c083264c9646b986f76d018fd808bac89fc Mon Sep 17 00:00:00 2001 From: Juergen Lock Date: Fri, 20 Nov 2009 23:19:53 +0100 Subject: 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 Signed-off-by: Blue Swirl --- net/tap-bsd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'net') 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; } -- cgit v1.2.3