Statistics
| Branch: | Revision:

root / net / tap.c @ 34b5d2c6

History | View | Annotate | Download (23.1 kB)

# Date Author Comment
c87826a8 06/07/2013 04:48 pm Jason Wang

tap: fix NULL dereference when passing invalid parameters to tap

This patch forbid the following invalid parameters to tap:

1) fd and vhostfds were specified but vhostfd were not specified
2) vhostfds were specified but fds were not specified
3) fds and vhostfd were specified...

7873df40 05/03/2013 02:53 pm Jason Wang

tap: properly initialize vhostfds

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were
forgot, this will lead qemu to ignore all fds passed by management through
vhostfds, and tries to create vhost_net device itself. Fix by adding this check...

0d09e41a 04/08/2013 07:13 pm Paolo Bonzini

hw: move headers to include/

Many of these should be cleaned up with proper qdev-/QOM-ification.
Right now there are many catch-all headers in include/hw/ARCH depending
on cpu.h, and this makes it necessary to compile these files per-target.
However, fixing this does not belong in these patches....

d32fcad3 03/25/2013 12:14 pm Scott Feldman

net: increase buffer size to accommodate Jumbo frame pkts

Socket buffer sizes were hard-coded to 4K for VDE and socket netdevs. Bump this
up to 68K (ala tap netdev) to handle maximum GSO packet size (64k) plus plenty
of room for the ethernet and virtio_net headers....

085d8134 03/22/2013 02:25 pm Peter Maydell

Fix typos and misspellings

Fix various typos and misspellings. The bulk of these were found with
codespell.

Signed-off-by: Peter Maydell <>
Reviewed-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

ce675a75 02/27/2013 05:10 pm Jason Wang

tap: forbid creating multiqueue tap when hub is used

Obviously, hub does not support multiqueue tap. So this patch forbids creating
multiple queue tap when hub is used to prevent the crash when command line such
as "-net tap,queues=2" is used.

Cc: ...

02cd8090 02/02/2013 02:05 am Anthony Liguori

tap: unbreak -netdev tap,fd=X

The multiqueue patch series broke -netdev tap,fd=X which manifests
as libvirt not being able to start a guest. This was because it
passed NULL for the netdev name which results in an anonymous netdev
device regardless of what the user specified....

16dbaf90 02/01/2013 07:03 pm Jason Wang

tap: support enabling or disabling a queue

This patch introduce a new bit - enabled in TAPState which tracks whether a
specific queue/fd is enabled. The tap/fd is enabled during initialization and
could be enabled/disabled by tap_enalbe() and tap_disable() which calls platform...

264986e2 02/01/2013 07:03 pm Jason Wang

tap: multiqueue support

Recently, linux support multiqueue tap which could let userspace call TUNSETIFF
for a signle device many times to create multiple file descriptors as
independent queues. User could also enable/disabe a specific queue through
TUNSETQUEUE....

5193e5fb 02/01/2013 07:03 pm Jason Wang

tap: factor out common tap initialization

This patch factors out the common initialization of tap into a new helper
net_init_tap_one(). This will be used by multiqueue tap patches.

Signed-off-by: Jason Wang <>
Signed-off-by: Anthony Liguori <>

ec45f083 02/01/2013 06:50 pm Jason Wang

net: tap: using bool instead of bitfield

Signed-off-by: Jason Wang <>
Signed-off-by: Anthony Liguori <>

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

83c9089e 12/19/2012 09:31 am Paolo Bonzini

monitor: move include files to include/monitor/

Signed-off-by: Paolo Bonzini <>

1422e32d 12/19/2012 09:31 am Paolo Bonzini

net: reorganize headers

Move public headers to include/net, and leave private headers in net/.
Put the virtio headers in include/net/tap.h, removing the multiple copies
that existed. Leave include/net/tap.h as the interface for NICs, and
net/tap_int.h as the interface for OS-specific parts of the tap backend....

f8fe7964 12/19/2012 09:29 am Paolo Bonzini

janitor: do not include qemu-char everywhere

Touching char/char.h basically causes the whole of QEMU to
be rebuilt. Avoid this, it is usually unnecessary.

Signed-off-by: Paolo Bonzini <>

58ddcd50 11/20/2012 04:38 pm Michael S. Tsirkin

tap: reset vnet header size on open

For tap, we currently assume the vnet header size is 10
(the default value) but that might not be the case
if tap is persistent and has been used by qemu previously.
To fix, set host header size in tap device on open.
...

a245fc18 10/08/2012 02:59 pm Paolo Bonzini

net: consolidate NetClientState header files into one

This patch doesn't seem much useful alone, I must admit. However,
it makes sense as part of the upcoming directory reorganization,
where I want to have include/net/tap.h as the net<->hw interface
for tap. Then having both net/tap.h and include/net/tap.h does...

a96ed02f 09/07/2012 09:15 am Nicholas Bellinger

monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param

This patch renames+moves the net_handle_fd_param() caller used to
obtain a file descriptor from either qemu_parse_fd() (the normal case)
or from monitor_get_fd() (migration case) into a generically prefixed...

4e68f7a0 08/01/2012 03:32 pm Stefan Hajnoczi

net: Rename VLANClientState to NetClientState

The vlan feature is no longer part of net core. Rename VLANClientState
to NetClientState because net clients are not explicitly associated with
a vlan at all, instead they have a peer net client to which they are...

d33d93b2 08/01/2012 02:28 pm Stefan Hajnoczi

net: Use hubs for the vlan feature

Stop using the special-case vlan code in net.c. Instead use the hub net
client to implement the vlan feature. The next patch will remove vlan
code from net.c completely.

Signed-off-by: Stefan Hajnoczi <>...

ab5f3f84 08/01/2012 02:28 pm Stefan Hajnoczi

net: Drop vlan argument to qemu_new_net_client()

Since hubs are now used to implement the 'vlan' feature and the vlan
argument is always NULL, remove the argument entirely and update all net
clients that use qemu_new_net_client().

Signed-off-by: Stefan Hajnoczi <>...

2be64a68 07/23/2012 01:55 pm Laszlo Ersek

hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)

NET_CLIENT_TYPE_ -> NET_CLIENT_OPTIONS_KIND_

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

6687b79d 07/23/2012 01:55 pm Laszlo Ersek

convert net_client_init() to OptsVisitor

The net_client_init() prototype is kept intact.

Based on "is_netdev", the QemuOpts-rooted QemuOpt-list is parsed as a
Netdev or a NetLegacy. The original meat of net_client_init() is moved to
and simplified in net_client_init1():...

08c573a8 07/23/2012 01:55 pm Laszlo Ersek

convert net_init_tap() to NetClientOptions

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

f79b51b0 07/23/2012 01:55 pm Laszlo Ersek

convert net_init_bridge() to NetClientOptions

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

1a0c0958 07/23/2012 01:55 pm Laszlo Ersek

remove unused QemuOpts parameter from net init functions

v1->v2:
- unchanged

v2->v3:
- keep "qemu-option.h" included in "net/slirp.h"

Signed-off-by: Laszlo Ersek <>
Signed-off-by: Stefan Hajnoczi <>

37003adf 06/15/2012 04:41 pm Paolo Bonzini

qmp: include monitor.h when needed

This is needed to get file descriptors from SCM_RIGHTS.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Luiz Capitulino <>

42dcc547 06/04/2012 07:49 pm Luiz Capitulino

net: purge the monitor object from all init functions

The only backend that really uses it is the socket one, which calls
monitor_get_fd(). But it can use 'cur_mon' instead.

Signed-off-by: Luiz Capitulino <>
Reviewed-By: Laszlo Ersek <>

a7c36ee4 02/02/2012 12:24 am Corey Bryant

Add support for net bridge

The most common use of -net tap is to connect a tap device to a bridge. This
requires the use of a script and running qemu as root in order to allocate a
tap device to pass to the script.

This model is great for portability and flexibility but it's incredibly...

885660bd 12/15/2011 06:22 pm Michael Roth

network scripts: don't block SIGCHLD before forking

This patch fixes a bug where child processes of launch_script() can
misbehave due to SIGCHLD being blocked. In the case of `sudo`, this
causes a permanent hang.

Previously a SIGCHLD handler was added to reap fork_exec()'d zombie...

9bf0960a 06/08/2011 11:04 am Alexandre Raymond

Fix compilation warning due to missing header for sigaction (followup)

This patch removes all references to signal.h when qemu-common.h is included
as they become redundant.

Signed-off-by: Alexandre Raymond <>
Signed-off-by: Stefan Hajnoczi <>

5430a28f 02/02/2011 12:50 am mst@redhat.com

vhost: force vhost off for non-MSI guests

When MSI is off, each interrupt needs to be bounced through the io
thread when it's set/cleared, so vhost-net causes more context switches and
higher CPU utilization than userspace virtio which handles networking in...

43849424 11/16/2010 04:40 pm Michael S. Tsirkin

tap: clear vhost_net backend on cleanup

Frontends calling tap_get_vhost_net get an invalid pointer after the
peer backend has been deleted. Jason Wang <> reports
this leading to a crash in ack_features when we remove the vhost-net
bakend of a virtio nic....

27a6375d 11/16/2010 04:40 pm Michael S. Tsirkin

tap: make set_offload a nop after netdev cleanup

virtio-net expects set_offload to succeed after
peer cleanup.
Since we don't have an open fd anymore, make it so.
Fixes warning about the failure of offload setting.

Reported-by: Jason Wang <>...

445d892f 09/07/2010 08:27 pm Michael S. Tsirkin

tap: add APIs for vnet header length

Add APIs to control host header length. First user
will be vhost-net.

Signed-off-by: Michael S. Tsirkin <>

ef4252b1 09/07/2010 08:27 pm Michael S. Tsirkin

tap: generalize code for different vnet header len

Make host vnet header length a structure field in
preparation for using this support in linux kernel.

Signed-off-by: Michael S. Tsirkin <>

9678d950 04/25/2010 09:35 pm Blue Swirl

Remove dead assignments in various common files, spotted by clang analyzer

Value stored is never read.

Signed-off-by: Blue Swirl <>

95d528a2 04/01/2010 09:56 pm Michael S. Tsirkin

tap: add interface to get device fd

Will be used by vhost to attach/detach to backend.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

82b0d80e 04/01/2010 09:56 pm Michael S. Tsirkin

tap: add vhost/vhostfd options

This adds vhost binary option to tap, to enable vhost net accelerator.
Default is off for now, we'll be able to make default on long term
when we know it's stable.

vhostfd option can be used by management, to pass in the fd. Assigning...

b202554c 04/01/2010 09:56 pm Michael S. Tsirkin

tap: add API to retrieve vhost net header

will be used by virtio-net for vhost net support

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

31dc63df 03/21/2010 09:13 pm Anthony Liguori

Revert "tap: invoke downscript when we exit abnormally"

This reverts commit 8af8ce4d6116e3d46ad298ca8fe50d3b515b1aac.

8af8ce4d 03/19/2010 10:27 pm Anthony Liguori

tap: invoke downscript when we exit abnormally

Right now, downscript is not invoked reliably. If you execute 'quit' from the
monitor, it won't be invoked.

This fixes that by converting tap to use an exit_notifier to execute the
downscript. In this case, allowing an exit notifier to include state is...

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

error: Replace qemu_error() by error_report()

error_report() terminates the message with a newline. Strip it it
from its arguments.

This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for...

2f792016 03/16/2010 05:55 pm Markus Armbruster

error: Move qemu_error & friends into their own header

62112d18 02/19/2010 08:12 pm Markus Armbruster

net: Fix bogus "Warning: vlan 0 with no nics" with -device

net_check_clients() prints this when an VLAN has host devices, but no
guest devices. It uses VLANState members nb_guest_devs and
nb_host_devs to keep track of these devices. However, -device does...

ceb69615 01/08/2010 05:58 pm Michael S. Tsirkin

net: add API to disable/enable polling

When vhost is bound to a backend device, we need to stop polling it when
vhost is started, and restart polling when vhost is stopped.
Add an API for that for use by vhost, and implement in tap backend.

Signed-off-by: Michael S. Tsirkin <>...

df6c2a0f 12/03/2009 05:41 pm Mark McLoughlin

net: initialize vnet_hdr in net_init_tap()

net_tap_init() always sets vnet_hdr using qemu_opt_get_bool(), but
initialize it in net_init_tap() just to reduce confusion.

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

665a3b07 12/03/2009 05:41 pm Mark McLoughlin

net: remove VLANClientState members now in NetClientInfo

Add a NetClientInfo pointer to VLANClientState and use that
for the typecode and function pointers.

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

3e35ba93 12/03/2009 05:41 pm Mark McLoughlin

net: convert tap to NetClientInfo

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

929fe497 11/21/2009 11:32 am Juergen Lock

Avoid segfault on net_tap_init() failure

Check for fd == -1 there.

Signed-off-by: Juergen Lock <>
Signed-off-by: Blue Swirl <>

be1636b3 11/09/2009 04:43 pm Mark McLoughlin

tap: disable draining queue in one go

If qemu_send_packet_async() returns zero, it means the packet has been
queued and the sent callback will be invoked once it has been flushed.

This is only possible where the NIC's receive() handler returns zero
and promises to notify the networking core that room is available in its...

5819c918 11/09/2009 04:43 pm Mark McLoughlin

tap: drain queue in tap_send()

Okay, let's try re-enabling the drain-entire-queue behaviour, with a
difference - before each subsequent packet, use qemu_can_send_packet()
to check that we can send it. This is similar to how we check before
polling the tap fd and avoids having to drop a packet if the receiver...

71f4effc 10/30/2009 11:38 pm Alexander Graf

Unbreak tap compilation on OS X

Currently compiling the tap sources breaks on Mac OS X. This is because of:

1) tap-linux.h requiring Linux includes
2) typos
3) missing #includes

This patch adds what's necessary to compile tap happily on Mac OS X....

9c282718 10/30/2009 03:39 pm Mark McLoughlin

net: move UFO support detection to tap-linux.c

Only supported on Linux

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

88b3ec02 10/30/2009 03:39 pm Mark McLoughlin

net: move AIX code into net/tap-aix.c

Okay, this makes the tap options available on AIX even though there's
no support, but if we want to do it right we should have not compile
the tap code at all on AIX using e.g. CONFIG_TAP.

Signed-off-by: Mark McLoughlin <>...

c28b1c10 10/30/2009 03:39 pm Mark McLoughlin

net: move linux code into net/tap-linux.c

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

15ac913b 10/30/2009 03:39 pm Mark McLoughlin

net: move tap_set_sndbuf() to tap-linux.c

TUNSETSNDBUF is only available on linux

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

dc69004c 10/30/2009 03:39 pm Mark McLoughlin

net: move tap_probe_vnet_hdr() to tap-linux.c

Only Linux has support for IFF_VNET_HDR

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

1faac1f7 10/30/2009 03:39 pm Mark McLoughlin

net: move tap_set_offload() code into tap-linux.c

TUNSETOFFLOAD is only available on Linux

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

5281d757 10/30/2009 03:39 pm Mark McLoughlin

net: split all the tap code out into net/tap.c

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

e7e92325 10/30/2009 03:39 pm Mark McLoughlin

net: split BSD tap_open() out into net/tap-bsd.c

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

966ea5ec 10/30/2009 03:39 pm Mark McLoughlin

net: move solaris code to net/tap-solaris.c

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>