misc/173475: /dev/tun stayes opened by PID after process is terminated

Ralf Wenk IZ-FreeBSD0701 at hs-karlsruhe.de
Thu Nov 8 15:30:02 UTC 2012

>Number:         173475
>Category:       misc
>Synopsis:       /dev/tun stayes opened by PID after process is terminated
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 08 15:30:01 UTC 2012
>Originator:     Ralf Wenk
>Release:        FreeBSD 10.0-CURRENT i386
Hochschule Karlsruhe, University of Applied Sciences
FreeBSD IZ-T193196065251a 10.0-CURRENT FreeBSD 10.0-CURRENT #0: Thu Nov  8 11:48:33 CET 2012     root at IZ-T193196065251a:/usr/obj/usr/src/sys/E4300  i386
After the first use of a tun interface with vpnc I am unable to reuse it,
getting the error message "Failed to bind to Address already in use".

netstat shows the connection as active:
# netstat -anf inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
udp4       0      0     

ifconfig tun0 and tun1 showed tun0 is still opened by the PID of the vpnc-process:
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1412
        inet --> netmask 0xffffffff 
        Opened by PID 1469
tun1: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1500

but the process has been terminated:

# ps ax | grep 1469
1916  3  S+    0:00.01 grep 1469

This could be a regession because I was using vpnc on FreeBSD 8 without such
a problem.
Generate the tun-interfaces by starting vpnc. Then terminate vpnc and try to
restart vpnc. The address is and stays in use.
If there was network traffic over the VPN tunnel when the vpnc-process terminates
netstat shows Send-Q is not zero and that stays till the next reboot as well.


More information about the freebsd-bugs mailing list