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 <n...@jelal.kn-bremen.de>

--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -87,6 +87,17 @@ int tap_open(char *ifname, int ifname_si
     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;
 }


Reply via email to