From owner-freebsd-current@FreeBSD.ORG Thu May 19 15:34:17 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E721F16A4CF for ; Thu, 19 May 2005 15:34:17 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3D7643DAD for ; Thu, 19 May 2005 15:34:16 +0000 (GMT) (envelope-from peadar.edwards@gmail.com) Received: by zproxy.gmail.com with SMTP id 13so527826nzn for ; Thu, 19 May 2005 08:34:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=kfjwSKgkC0382ycq8awLN81xxn2wL7oRYGfYXROqU90g5IlwYYPKDwbOjCCuFUk5BY26oxtYeXFaQUsj0Vnwq9ZKl19blE6mFzhLmmdx5gc6bs1CLQQ3GnjDdeTvcKZec/93ecocIyNM3q9qHJjDVYw9iWZ/sYJLPlbWAS9XwsE= Received: by 10.36.12.2 with SMTP id 2mr513687nzl; Thu, 19 May 2005 08:34:15 -0700 (PDT) Received: by 10.36.68.15 with HTTP; Thu, 19 May 2005 08:34:15 -0700 (PDT) Message-ID: <34cb7c84050519083477639cd5@mail.gmail.com> Date: Thu, 19 May 2005 16:34:15 +0100 From: Peter Edwards To: Matti Saarinen , Scot Hetzel , freebsd-current@freebsd.org In-Reply-To: <790a9fff0505190809428abb15@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3241_23428101.1116516855132" References: <790a9fff0505190809428abb15@mail.gmail.com> cc: peadar@freebsd.org Subject: Re: CURRENT: ifconfig tap0 results in core dump X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: peadar@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2005 15:34:18 -0000 ------=_Part_3241_23428101.1116516855132 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > > % ifconfig tap0 > > tap0: flags=3D8802 mtu 1500 > > inet6 fe80::2bd:9ff:fe7c:100%tap0 prefixlen 64 scopeid 0x5 > > zsh: segmentation fault (core dumped) ifconfig tap0 > > > > > > I remember that ifconfig didn't dump core when my laptop ran CURRENT > > from a few months ago. > > > You'll probably need to build a version of ifconfig with debugging > symbols. And then provide a backtrace of the core dump. >=20 > How soon after killing openvpn, do you use the ifconfig command. It > might be possible that devfs was in the process of removing tap0, when > you used the ifconfig command. >=20 Hm. It looks like the "close" code for if_tap clears out the addresses of the interface with a pretty blunt-edged "bzero", rather than removing them in any clean fashion. As a result, ifconfig gets confused over the address families in the tags it sees on the addresses it enumerates off the tap interface, and collapses with a corefile. if_tap's "close" seems to be trying to do part of what's done in if_detach, so I split out what I think are the relevant bits from there and used it in both places. Any networking experts care to take a look at the patch? I suspect there's a whole mess of locking I'm not doing for a start, but I think it might be an improvement over the current situation. Cheers, Peadar. ------=_Part_3241_23428101.1116516855132 Content-Type: text/plain; name="iftap.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="iftap.txt" SW5kZXg6IG5ldC9pZi5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC91c3IvY3ZzL0ZyZWVCU0QtQ1ZT L3NyYy9zeXMvbmV0L2lmLmMsdgpyZXRyaWV2aW5nIHJldmlzaW9uIDEuMjI3CmRpZmYgLXUgLXcg LXIxLjIyNyBpZi5jCi0tLSBuZXQvaWYuYwkyMCBBcHIgMjAwNSAwOTozMDo1NCAtMDAwMAkxLjIy NworKysgbmV0L2lmLmMJOSBNYXkgMjAwNSAxNTozMzo0MCAtMD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