From owner-freebsd-net@FreeBSD.ORG Mon Jul 10 11:27:19 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B93B916A4DA for ; Mon, 10 Jul 2006 11:27:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F2D643D55 for ; Mon, 10 Jul 2006 11:27:19 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 9359546C25; Mon, 10 Jul 2006 07:27:18 -0400 (EDT) Date: Mon, 10 Jul 2006 12:27:18 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Remi Denis-Courmont In-Reply-To: <1152517513.44b20589e1bbc@ssl0.ovh.net> Message-ID: <20060710122628.C83829@fledge.watson.org> References: <1152517513.44b20589e1bbc@ssl0.ovh.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org Subject: Re: Interface name or ID of /dev/tun tunnels X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2006 11:27:19 -0000 On Mon, 10 Jul 2006, Remi Denis-Courmont wrote: > Is there any clean way to find out the name, or better yet the ID (since ID > are immutable while names are not), of a tunnel device allocated from > /dev/tun ? > > The question was already raised here, but I could find no answer: > http://lists.freebsd.org/pipermail/freebsd-net/2004-March/003338.html > > If not, would it be possible to add, say, an ioctl() on tun/tap devices to > return their ID (which could be converted to a name via if_indextoname()), > or something similar? That should retain full backward compatibility... > > Or maybe there is another way to configure the tunnel a la ifconfig with > only the file descriptor?? Take a look at devname(3), which includes an example of how to identify which device was opened via /dev/tun. Robert N M Watson Computer Laboratory University of Cambridge