@@ -116,7 +116,7 @@
#include "sysemu.h"
#include "qemu-timer.h"
#include "qemu-char.h"
-#include "audio/audio.h"
+#include "audio/qaudio.h"
#include "qemu_socket.h"
#include "qemu-log.h"
@@ -1461,11 +1461,27 @@
{
int fd;
char *dev;
+ char tap_dev[1024];
struct stat s;
- TFR(fd = open("/dev/tap", O_RDWR));
+#if defined (__NetBSD__)
+ // Concatenate dev path (/dev/) and tap device name (e.g. tap0)
+ if (strlcpy(tap_dev, "/dev/", sizeof(tap_dev)) >= sizeof(tap_dev)) {
+ fprintf(stderr, "error: tap device name too long\n");
+ return -1;
+ }
+
+ if (strlcat(tap_dev, ifname, sizeof(tap_dev)) >= sizeof(tap_dev)) {
+ fprintf(stderr, "error: tap device name too long\n");
+ return -1;
+ }
+#else
+ tap_dev="/dev/tap";
+#endif
+ TFR(fd = open(tap_dev, O_RDWR));
+
if (fd < 0) {
- fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
+ fprintf(stderr, "warning: could not open %s: no virtual network emulation\n",tap_dev);
return -1;
}