Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2009 18:41:12 +0300
From:      Alexander Samarin <sasha.devel@gmail.com>
To:        Maxim Giryaev <gem@parallels.com>, freebsd-usb@freebsd.org
Subject:   Re: [madwimax] madwimax-0.1.1 patch for FreeBSD 8 (very buggy)
Message-ID:  <7dcca81d0911200741q2eb22c20ge2718be32dff0045@mail.gmail.com>
In-Reply-To: <4B064F48.50506@parallels.com>
References:  <4B064F48.50506@parallels.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Maxim Giryaev =D0=BF=D0=B8=D1=88=D0=B5=D1=82:
> I create similar patch, you can see it here: http://code.google.com/p/mad=
wimax/issues/detail?id=3D39
> 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() return=
s 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 =3D 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 =3D socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
+        res =3D fd;
+        perror("socket");
+    } else {
+        if ((res =3D ioctl(fd, SIOCIFDESTROY, &ifr)) < 0) {
+            perror("ioctl(SIOCIFDESTROY)");
+        }
+        close(fd);
+    }
+#endif
+    return res;
+}

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7dcca81d0911200741q2eb22c20ge2718be32dff0045>