From owner-freebsd-current@FreeBSD.ORG Fri Sep 19 18:40:08 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C48691065676 for ; Fri, 19 Sep 2008 18:40:08 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.236]) by mx1.freebsd.org (Postfix) with ESMTP id 97F3C8FC12 for ; Fri, 19 Sep 2008 18:40:08 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so489551rvf.43 for ; Fri, 19 Sep 2008 11:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=B/4GHLkw/3ZsjHpqK88h79duBcnVAn3+FHNPRTviYJ0=; b=ojG31pQf49j1mObtDBuWX8a1qy5EP++HOB+UkcWUxGP/hNyTTwpq1vOvG8ZCP92/XN pu3xEvw41Gd4rI+t/mhUoQWTuJgYT4yfbVFUY3TMHld5ZFjL+zqfrQ40tQmtD+VVIbJh PDaR5ESrGlfU1pWz4HyYTGVvDlRGuwHGK9nOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=n7D+BGHBXjzr8xihdHQj1696nO4wEJ88OTRUHfIaOFTMzhVQeBqfHSZbioXyByuTzZ AeZKpRx2GXe/lbK6eUIh/6BNc2BGZ/EXSN4s5rIzDU9w1Jm7CVW7LdjCW8FoMvhFbp/U 3F9hQDdtCK+15/73wZJdCNHcttdsqjyyAwy3c= Received: by 10.141.34.12 with SMTP id m12mr267848rvj.26.1221849608126; Fri, 19 Sep 2008 11:40:08 -0700 (PDT) Received: by 10.141.197.13 with HTTP; Fri, 19 Sep 2008 11:40:07 -0700 (PDT) Message-ID: Date: Fri, 19 Sep 2008 11:40:07 -0700 From: "Maksim Yevmenkin" To: "Ed Schouten" In-Reply-To: <20080919101700.GS81522@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48D2F942.4070801@FreeBSD.org> <20080919101700.GS81522@hoeg.nl> Cc: "current@freebsd.org" 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 18:40:08 -0000 On 9/19/08, Ed Schouten wrote: > Hello Maxim, > > > * Maxim Sobolev wrote: > > 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). > > > I'd say the best way to fix this would be to convert tun and tap to > devfs_[gs]et_cdevpriv() and turn tun and tap into single device nodes. > That's what we've already been doing to bpf, snp, audit_pipe, etc. > Unfortunately I'm no expert when it comes to our tun and tap > implementations. not so fast please :) the tap/tun/vkbd (and maybe others) have split personality. that is, on one side there is a network interface or keyboard, and on the other side is character device. those are always go in pairs. as far as i understand, of dev_stdclone/clone_create/clonedevs list/etc. is here to free up driver from managing resources (such as minor numbers). sure we can convert those drivers to devfs_set/get_cdevpriv, however, split personality drivers will still have to manage something similar to minor numbers (to name network interfaces/keyboards associated with the particular cdevpriv instance). also we need to make sure that any code still could use /dev/tunX/tapX names and get correct tunX/tapX interface (provided, of course, one is available). thanks, max