From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGBoK-0005Gi-28 for qemu-devel@nongnu.org; Thu, 03 Dec 2009 08:33:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGBoE-0005AO-Df for qemu-devel@nongnu.org; Thu, 03 Dec 2009 08:33:31 -0500 Received: from [199.232.76.173] (port=43912 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGBoD-00059y-6G for qemu-devel@nongnu.org; Thu, 03 Dec 2009 08:33:26 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:55590) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGBoC-0005wE-N8 for qemu-devel@nongnu.org; Thu, 03 Dec 2009 08:33:25 -0500 From: Arnd Bergmann Subject: Re: [Qemu-devel] [PATCH, RFC] tap-linux: support opening arbitrary char devices Date: Thu, 3 Dec 2009 14:33:17 +0100 References: <200911262034.04440.arnd@arndb.de> <4B168BCA.4010602@codemonkey.ws> In-Reply-To: <4B168BCA.4010602@codemonkey.ws> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200912031433.17888.arnd@arndb.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Wednesday 02 December 2009, Anthony Liguori wrote: > Arnd Bergmann wrote: > > With the upcoming macvtap, we will want to open devices other than > > /dev/net/tun but no longer need to call TUNSETIFF. > > > > What are the names of these devices and how do you the character devices > get created in the first place? Like a macvlan device, you use iproute2 to set up the interface, e.g. ip link add link eth0 type macvtap mode vepa This is consistent with how you'd set up macvlan, veth or vlan devices. With my current code, the name that gets used for the character device in absence of a matching udev rule will be /dev/tap%d with %d being the interface index of the network device. > > This makes it possible to do 'qemu -net tap,ifname=/dev/tap/macvtap0' > > to refer to a chardev in addition to the current way of doing > > 'qemu -net tap,ifname=tap0' to refer to a tap network interface > > set with TUNSETIFF. This is consistent with what we do on BSD. > > We definitely don't want to overload ifname like this. > /dev/tap/macvtap0 is clearly not the interface name. tap interfaces on other operating systems already differ in this respect, and macvtap seems to be much closer to what BSD and Solaris do than the Linux tun/tap interface, judging from how they are used in qemu. Assuming you have a virtual interface "virteth0" (name made up to be different from existing ones) with interface index 3, the syntax would be * Linux, with tap: (which doesn't really work with arbitrary devices): qemu -net tap,ifname=virteth0 * Solaris: (opens /dev/tap3) qemu -net tap,ifname=3 * BSD: (opens /dev/tap3) qemu -net tap,ifname=tap3 I chose the full path name to be sure it does not conflict with existing usage, "3" and "tap3" are both valid interface names, "/dev/tap3" is not. If you prefer, I can add some logic to determine the character device name from the network interface name, so that you can call it consistently with the interface name on linux, wether using tun/tap or macvtap. That patch will be somewhat more complicated than the one I posted. Alternatively, I can use the documented "name=" parameter for pointing to the character device, but that would be inconsitent with the current usage on all the supported OSs. Arnd <><