pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/37003: pkg emulators/qemu seg faults when using tap interface

        Note: There was a bad value `' for the field `Priority'.
        It was set to the default value of `medium'.

>Number:         37003
>Category:       pkg
>Synopsis:       pkg emulators/qemu seg faults when using tap interface
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 19 01:05:00 +0000 2007
>Originator:     Cliff Wright
>Release:        NetBSD 3.0.1
System: NetBSD 3.0.1 NetBSD 3.0.1 (XEN0) #4: Tue Feb 6 
13:03:05 PST 2007 i386
Architecture: i386
Machine: i386
        When starting qemu with the tap option ( e.g.
        qemu -m 150 -net nic -net tap,script=netset freedos.img )
        a seg fault will occur.
        This is due to NetBSD handling tap device name differently,
        it does not allow an fstat, but uses an ioctl instead.
        Below is a patch I used to fix this.
        See above example.
--- vl.c.sav    2007-09-14 17:28:52.000000000 -0700
+++ vl.c        2007-09-18 14:30:18.000000000 -0700
@@ -46,7 +46,12 @@
 #include <dirent.h>
 #include <netdb.h>
 #ifdef _BSD
+#ifdef __NetBSD__
+#include <net/if.h>
+#include <net/if_tap.h>
 #include <sys/stat.h>
 #ifndef _BSD
 #include <libutil.h>
@@ -2570,7 +2575,11 @@
     int fd;
     char *dev;
+#ifdef __NetBSD__
+    struct ifreq tapif;
     struct stat s;
     fd = open("/dev/tap", O_RDWR);
     if (fd < 0) {
@@ -2578,8 +2587,13 @@
         return -1;
+#ifdef __NetBSD__
+    ioctl(fd, TAPGIFNAME, &tapif);
+    dev = tapif.ifr_name;
     fstat(fd, &s);
     dev = devname(s.st_rdev, S_IFCHR);
     pstrcpy(ifname, ifname_size, dev);
     fcntl(fd, F_SETFL, O_NONBLOCK);


Home | Main Index | Thread Index | Old Index