Interface auto-cloning bug or feature?

Alexey Shuvaev shuvaev at physik.uni-wuerzburg.de
Fri Sep 19 08:42:04 UTC 2008


On Thu, Sep 18, 2008 at 05:58:42PM -0700, Maxim Sobolev wrote:
> Hi,
>
> I've noticed that stat/open call on /dev/tun always creates new
> interface, despite the fact that existing spare interfaces may be
> available. I believe that it's a bug, since the whole purpose of
> auto-cloning is to create new instance only when no existing one could
> be allocated. At least that's my reading of the manual page for the tun(4).
>
> <quote>
>      If the sysctl(8) variable net.link.tun.devfs_cloning is non-zero,
> the tun
>      interface permits opens on the special control device /dev/tun.  When
>      this device is opened, tun will return a handle for the lowest
> unused tun
>      device (use devname(3) to determine which).
> </quote>
>
> -Maxim
>
> [root at sp1 /usr/home/sobomax]# ifconfig -a
> tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> [root at sp1 /usr/home/sobomax]# stat /dev/tun
> 67174144 96 crw------- 1 uucp dialer 96 0 "May  2 22:21:28 2008" "May  2
> 22:21:28 2008" "May  2 22:21:28 2008" "Dec 31 23:59:59 1969" 4096 0 0
> /dev/tun
> [root at sp1 /usr/home/sobomax]# ifconfig -a
> tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> [root at sp1 /usr/home/sobomax]# stat /dev/tun
> 67174144 99 crw------- 1 uucp dialer 99 0 "May  2 22:21:28 2008" "May  2
> 22:21:28 2008" "May  2 22:21:28 2008" "Dec 31 23:59:59 1969" 4096 0 0
> /dev/tun
> [root at sp1 /usr/home/sobomax]# ifconfig -a
> tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun2: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> [root at sp1 /usr/home/sobomax]# stat /dev/tun
> 67174144 105 crw------- 1 uucp dialer 105 0 "May  2 22:21:28 2008" "May
>  2 22:21:28 2008" "May  2 22:21:28 2008" "Dec 31 23:59:59 1969" 4096 0
> 0 /dev/tun
> [root at sp1 /usr/home/sobomax]# ifconfig -a
> tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun2: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
> tun3: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
>
Me too.
I have seen that using ppp(8) and security/vpnc.

Alexey.


More information about the freebsd-current mailing list