Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2008 17:58:42 -0700
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        "current@freebsd.org" <current@FreeBSD.org>
Subject:   Interface auto-cloning bug or feature?
Message-ID:  <48D2F942.4070801@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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@sp1 /usr/home/sobomax]# ifconfig -a
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
[root@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@sp1 /usr/home/sobomax]# ifconfig -a
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
tun1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
[root@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@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@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@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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48D2F942.4070801>