Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jul 2006 12:27:18 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Remi Denis-Courmont <rdenis@simphalempin.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Interface name or ID of /dev/tun tunnels
Message-ID:  <20060710122628.C83829@fledge.watson.org>
In-Reply-To: <1152517513.44b20589e1bbc@ssl0.ovh.net>
References:  <1152517513.44b20589e1bbc@ssl0.ovh.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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