From: Arnd Bergmann <arnd@arndb.de>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH, RFC] tap-linux: support opening arbitrary char devices
Date: Thu, 3 Dec 2009 14:33:17 +0100 [thread overview]
Message-ID: <200912031433.17888.arnd@arndb.de> (raw)
In-Reply-To: <4B168BCA.4010602@codemonkey.ws>
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 <><
prev parent reply other threads:[~2009-12-03 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 19:34 [Qemu-devel] [PATCH, RFC] tap-linux: support opening arbitrary char devices Arnd Bergmann
2009-12-02 15:46 ` Anthony Liguori
2009-12-03 13:33 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200912031433.17888.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.