From owner-freebsd-usb@FreeBSD.ORG Fri Nov 20 15:41:14 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B96C31065696 for ; Fri, 20 Nov 2009 15:41:14 +0000 (UTC) (envelope-from sasha.devel@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id 4FAA08FC08 for ; Fri, 20 Nov 2009 15:41:13 +0000 (UTC) Received: by ey-out-2122.google.com with SMTP id 22so821915eye.9 for ; Fri, 20 Nov 2009 07:41:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=HD+YsxnGpbZpy7DbRejWkNT8s9ui++x41ahf4DIKXgM=; b=LjfvOnTdhk8PLQeulitX300981plqpDScxq6OZAARFjNJGkFQzw8uw92HlCoIqGKq0 Q5g565xJfgYFEh+r6AmK5ESoHS7Ma/0cXSq7FD8TbkmTYY/z1kDJ5j1Gm0KweDpT5Iqb 2RBVDGSlaruaXkyYoMKnj7juzq5OTOicK2dsY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=HAtMnLiKjUH4Y5gVwg5TO6qg/GCh56tRYU2PgcL+pmew72IfC2dhi0BWB+Co1ScUCH o3RxsnqXJhChsC4wX371+8S07PNfX4NrkG1AQmuZJ2L/zr5Hs4T8e2lsN++E4uvvDBIG hQBAsoqI/DALHaxg/4YxMaU1Q5z4QhlJN1qAg= MIME-Version: 1.0 Received: by 10.213.68.143 with SMTP id v15mr332725ebi.45.1258731672629; Fri, 20 Nov 2009 07:41:12 -0800 (PST) In-Reply-To: <4B064F48.50506@parallels.com> References: <4B064F48.50506@parallels.com> Date: Fri, 20 Nov 2009 18:41:12 +0300 Message-ID: <7dcca81d0911200741q2eb22c20ge2718be32dff0045@mail.gmail.com> From: Alexander Samarin To: Maxim Giryaev , freebsd-usb@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: [madwimax] madwimax-0.1.1 patch for FreeBSD 8 (very buggy) X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2009 15:41:14 -0000 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)