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

25 lines
959 B
Plaintext
Raw Normal View History

$OpenBSD: patch-net_tap-bsd_c,v 1.2 2010/11/22 11:32:01 fgsch Exp $
--- net/tap-bsd.c.orig Fri Oct 15 21:56:09 2010
+++ net/tap-bsd.c Thu Nov 18 09:21:58 2010
@@ -47,7 +47,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];
@@ -56,7 +56,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) {