From owner-freebsd-current@FreeBSD.ORG Fri Sep 19 08:42:03 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0B421065670 for ; Fri, 19 Sep 2008 08:42:03 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from mailrelay.rz.uni-wuerzburg.de (wrzx28.rz.uni-wuerzburg.de [132.187.3.28]) by mx1.freebsd.org (Postfix) with ESMTP id 690928FC0C for ; Fri, 19 Sep 2008 08:42:03 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from virusscan.mail (localhost [127.0.0.1]) by mailrelay.mail (Postfix) with ESMTP id B673EA06EE for ; Fri, 19 Sep 2008 10:42:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by virusscan.mail (Postfix) with ESMTP id A7101A06E0 for ; Fri, 19 Sep 2008 10:42:02 +0200 (CEST) Received: from mail.physik.uni-wuerzburg.de (wthp192.physik.uni-wuerzburg.de [132.187.40.192]) by mailmaster.uni-wuerzburg.de (Postfix) with ESMTP id 91E31A06EA for ; Fri, 19 Sep 2008 10:42:02 +0200 (CEST) Received: from wep4035.physik.uni-wuerzburg.de ([132.187.37.35]) by mail.physik.uni-wuerzburg.de (Lotus Domino Release 8.0.2) with ESMTP id 2008091910420194-32536 ; Fri, 19 Sep 2008 10:42:01 +0200 Received: by wep4035.physik.uni-wuerzburg.de (sSMTP sendmail emulation); Fri, 19 Sep 2008 10:42:01 +0200 From: "Alexey Shuvaev" Date: Fri, 19 Sep 2008 10:42:01 +0200 To: freebsd-current@freebsd.org Message-ID: <20080919084201.GD44330@wep4035.physik.uni-wuerzburg.de> References: <48D2F942.4070801@FreeBSD.org> MIME-Version: 1.0 In-Reply-To: <48D2F942.4070801@FreeBSD.org> Organization: Universitaet Wuerzburg User-Agent: Mutt/1.5.18 (2008-05-17) X-MIMETrack: Itemize by SMTP Server on domino1/uni-wuerzburg(Release 8.0.2|August 07, 2008) at 09/19/2008 10:42:01 AM, Serialize by Router on domino1/uni-wuerzburg(Release 8.0.2|August 07, 2008) at 09/19/2008 10:42:02 AM, Serialize complete at 09/19/2008 10:42:02 AM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: by amavisd-new at uni-wuerzburg.de Subject: Re: Interface auto-cloning bug or feature? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Sep 2008 08:42:04 -0000 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). > > > 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). > > > -Maxim > > [root@sp1 /usr/home/sobomax]# ifconfig -a > tun0: flags=8010 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 mtu 1500 > tun1: flags=8010 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 mtu 1500 > tun1: flags=8010 mtu 1500 > tun2: flags=8010 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 mtu 1500 > tun1: flags=8010 mtu 1500 > tun2: flags=8010 mtu 1500 > tun3: flags=8010 mtu 1500 > Me too. I have seen that using ppp(8) and security/vpnc. Alexey.