[madwimax] madwimax-0.1.1 patch for FreeBSD 8 (very buggy)

Alexander Samarin sasha.devel at gmail.com
Fri Nov 20 15:41:14 UTC 2009


Maxim Giryaev пишет:
> I create similar patch, you can see it here: http://code.google.com/p/madwimax/issues/detail?id=39
> Periodical crashes in libusb triggered by sigchild handler in madwimax.
> I check to way to fix it:
> 1. remove sigchild handler and call wait3() in scan_loop()
> 2. check for NULL result of  libusb20_tr_get_priv_sc1() inside  lubusb.
>
> Second way fixes crashes but periodically  libusb_submit_trasfer() returns error 99.
>
> There are no disconnects from Internet on my router during last week.
>

sighandler_wait_child does not work with any of libusb functions and
structures, so I can't understand how it can crash.. And libusb
protected inside by mutex.



PS: To destroy interface on exit:

-int tap_close(int fd, char *dev) { return close(fd); }
+int tap_close(int fd, char *dev) {
+    int res = close(fd);
+
+#if defined(__FreeBSD__)
+    // We need to destroy tun/tap interface like `ifconfig tunN destroy`
+    struct ifreq ifr;
+
+    memset(&ifr, 0, sizeof(ifr));
+    strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+
+    if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
+        res = fd;
+        perror("socket");
+    } else {
+        if ((res = ioctl(fd, SIOCIFDESTROY, &ifr)) < 0) {
+            perror("ioctl(SIOCIFDESTROY)");
+        }
+        close(fd);
+    }
+#endif
+    return res;
+}

-- 
Best regards,  Alexander Samarin
    mailto:sasha at enikasoft.ru
    https://www.fsora.ru (waits for FreeBSD 8.0-RELEASE)


More information about the freebsd-usb mailing list