openbsd-ports/emulators/qemu/patches/patch-net_tap-bsd_c

25 lines
959 B
Plaintext

$OpenBSD: patch-net_tap-bsd_c,v 1.1 2010/05/27 17:55:05 fgsch Exp $
--- net/tap-bsd.c.orig Mon Mar 22 23:29:35 2010
+++ net/tap-bsd.c Mon Mar 22 23:30:23 2010
@@ -46,7 +46,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_
char *dev;
struct stat s;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
/* if no ifname is given, always start the search from tap0. */
int i;
char dname[100];
@@ -55,7 +55,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_
if (*ifname) {
snprintf(dname, sizeof dname, "/dev/%s", ifname);
} else {
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
snprintf(dname, sizeof dname, "/dev/tap%d", i);
+#else
+ snprintf(dname, sizeof dname, "/dev/tun%d", i);
+#endif
}
TFR(fd = open(dname, O_RDWR));
if (fd >= 0) {