From owner-freebsd-net@FreeBSD.ORG Thu Jun 7 07:32:10 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 785551065676; Thu, 7 Jun 2012 07:32:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9560F8FC1A; Thu, 7 Jun 2012 07:32:09 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA16212; Thu, 07 Jun 2012 10:32:08 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1ScXCR-000CUq-Qa; Thu, 07 Jun 2012 10:32:07 +0300 Message-ID: <4FD058F6.1000206@FreeBSD.org> Date: Thu, 07 Jun 2012 10:32:06 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120503 Thunderbird/12.0.1 MIME-Version: 1.0 To: Emanuel Haupt , freebsd-net@FreeBSD.org References: <4FD0537C.7070802@FreeBSD.org> In-Reply-To: <4FD0537C.7070802@FreeBSD.org> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=x-viet-vps Content-Transfer-Encoding: 7bit Cc: Subject: Re: 'ifconfig tun0 destroy' gets stuck X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 07:32:10 -0000 on 07/06/2012 10:08 Andriy Gapon said the following: > > I experience a problem where vpnc can not exit cleanly and gets stuck. > pstree shows this chain: > |-+= 31375 root vpnc > | \-+- 13412 root /bin/sh /usr/local/sbin/vpnc-script-custom > | \--- 13446 root ifconfig tun0 destroy > > $ procstat -k 13446 > PID TID COMM TDNAME KSTACK > 13446 102739 ifconfig - mi_switch sleepq_switch > sleepq_wait _cv_wait_unlock tun_destroy tun_clone_destroy ifc_simple_destroy > if_clone_destroyif if_clone_destroy ifioctl soo_ioctl kern_ioctl sys_ioctl > amd64_syscall Xfast_syscall > > My system is FreeBSD 10.0-CURRENT amd64 r236503. > > I think that this started happening recently but I am not sure exactly when. > Maybe after recent vpnc-scripts update or maybe after base system + kernel update. Few minutes later... :-) It seems that tun_destroy waits until a tun device is closed, but vpnc does things in the opposite order: it first executes vpnc-script which does ifconfig destroy and only then closes the tun fd. Changing the order in close_tunnel() seems to help, but I am not sure if this is correct. -- Andriy Gapon