Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Jun 2012 10:32:06 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Emanuel Haupt <ehaupt@FreeBSD.org>, freebsd-net@FreeBSD.org
Subject:   Re: 'ifconfig tun0 destroy' gets stuck
Message-ID:  <4FD058F6.1000206@FreeBSD.org>
In-Reply-To: <4FD0537C.7070802@FreeBSD.org>
References:  <4FD0537C.7070802@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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