提交 5f668643 编写于 作者: B Brad 提交者: Blue Swirl

Add support for OpenBSD to QEMU's tap driver.

Signed-off-by: NBrad Smith <brad@comstyle.com>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 4a1e19ae
......@@ -43,8 +43,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
char *dev;
struct stat s;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/* if no ifname is given, always start the search from tap0. */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
/* if no ifname is given, always start the search from tap0/tun0. */
int i;
char dname[100];
......@@ -52,7 +52,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
if (*ifname) {
snprintf(dname, sizeof dname, "/dev/%s", ifname);
} else {
#if defined(__OpenBSD__)
snprintf(dname, sizeof dname, "/dev/tun%d", i);
#else
snprintf(dname, sizeof dname, "/dev/tap%d", i);
#endif
}
TFR(fd = open(dname, O_RDWR));
if (fd >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册