提交 39ca4c08 编写于 作者: J Juergen Lock 提交者: Blue Swirl

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: NJuergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 22a2bdcb
...@@ -59,6 +59,17 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required ...@@ -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); dev = devname(s.st_rdev, S_IFCHR);
pstrcpy(ifname, ifname_size, dev); 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); fcntl(fd, F_SETFL, O_NONBLOCK);
return fd; return fd;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册