qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH, RFC] tap-linux: support opening arbitrary char


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
User-agent: KMail/1.12.2 (Linux/2.6.31-14-generic; KDE/4.3.2; x86_64; ; )

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 <><




reply via email to

[Prev in Thread] Current Thread [Next in Thread]