Statistics
| Branch: | Revision:

root / net.c @ 9ce56db6

History | View | Annotate | Download (36.3 kB)

# Date Author Comment
2ffcb18d 06/14/2010 07:12 pm Markus Armbruster

Make netdev_del delete the netdev even when it's in use

To hot-unplug guest and host part of a network device, you do:

device_del NIC-ID
netdev_del NETDEV-ID

For PCI devices, device_del merely tells ACPI to unplug the device.
The device goes away for real only after the guest processed the ACPI...

60a3992e 06/10/2010 05:21 pm Anthony Liguori

Merge remote branch 'mst/for_anthony' into staging

50e32ea8 06/09/2010 12:58 pm Amit Shah

net: Fix hotplug with pci_add

The correct model type wasn't getting added when hotplugging nics with
pci_add.

Testcase: start VM with default nic type. In the qemu_monitor:

(qemu) pci_add auto nic model=virtio

This results in a nic hot-plug of the same nic type as the default....

637503d1 06/01/2010 09:48 pm Luiz Capitulino

Monitor: Drop QMP documentation from code

Previous commit added QMP documentation to the qemu-monitor.hx
file, it's is a copy of this information.

While it's good to keep it near code, maintaining two copies of
the same information is too hard and has little benefit as we...

c9b26a4c 04/19/2010 12:55 am Markus Armbruster

monitor: Use argument type 'b' for set_link

Second argument is now "on" or "off" instead of "up" or "down".

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

5369e3c0 04/19/2010 12:55 am Markus Armbruster

monitor: Convert do_set_link() to QObject, QError

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

ae82d324 04/19/2010 12:55 am Markus Armbruster

monitor: New commands netdev_add, netdev_del

Monitor commands to go with -netdev.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

c389c43e 04/19/2010 12:46 am Markus Armbruster

error: Drop extra messages after qemu_opts_set() and qemu_opts_parse()

Both functions report errors nicely enough now, no need for additional
messages.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

5294e2c7 04/19/2010 12:46 am Markus Armbruster

error: Convert net_client_init() to QError

The conversion is shallow: client type init() methods aren't
converted. Converting them is a big job for relatively little
practical benefit, so leave it for later.

Signed-off-by: Markus Armbruster <>...

da1fcfda 04/10/2010 03:09 am Eduardo Habkost

net: remove broken net_set_boot_mask() boot device validation

There are many problems with net_set_boot_mask():

1) It is broken when using the device model instead of "-net nic". Example:
$ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n...

c2564608 04/10/2010 03:09 am Eduardo Habkost

net: remove NICInfo.bootable field

It is just set by net_set_boot_mask() and never used. The logic for rom loading
changed a lot since this field was introduced. It is not needed anymore.

Signed-off-by: Eduardo Habkost <>
Acked-by: Juan Quintela <>...

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

8212c64f 03/16/2010 06:45 pm Markus Armbruster

qemu-option: Move the implied first name into QemuOptsList

We sometimes permit omitting the first option name, for example
-device foo is short for -device driver=foo. The name to use
("driver" in the example) is passed as argument to qemu_opts_parse()....

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

27f3f8a3 03/09/2010 04:47 pm Markus Armbruster

qdev: Catch attempt to attach more than one device to a netdev

Guest device and host netdev are peers, i.e. it's a 1:1 relation.
However, we fail to enforce that:

$ qemu -nodefaults --nographic -netdev user,id=net0 -device e1000,netdev=net0 -device virtio-net-pci,netdev=net0 -monitor stdio...
75422b0d 03/08/2010 07:30 pm Amit Shah

qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors

net.c used a constant to signify no MSI vectors were specified. Extend
that to all qdev devices.

Signed-off-by: Amit Shah <>
Reported-by: "Michael S. Tsirkin" <>...

238431a9 02/21/2010 06:01 pm Blue Swirl

Allow const QemuOptDesc

Signed-off-by: Blue Swirl <>

64e69d50 02/20/2010 10:20 am Blue Swirl

Fix warning on OpenBSD

/src/qemu/net.c: In function `net_check_clients':
/src/qemu/net.c:1287: warning: `has_nic' might be used uninitialized in this function
/src/qemu/net.c:1287: warning: `has_host_dev' might be used uninitialized in this function

Signed-off-by: Blue Swirl <>

efe32fdd 02/19/2010 08:12 pm Markus Armbruster

net: net_check_clients() checks only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

a0104e0e 02/19/2010 08:12 pm Markus Armbruster

net: info network shows only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

2583ba97 02/19/2010 08:12 pm Markus Armbruster

net: Monitor command set_link finds only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

7f76abe1 02/19/2010 08:12 pm Markus Armbruster

net: Remove unused net_client_uninit()

Unused since commit 9ad4531e.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

668680f7 02/19/2010 08:12 pm Markus Armbruster

net: net_check_clients() runs too early to see -device, fix

Call it right after -device devices get created.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

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

6265eb26 02/10/2010 10:00 pm Jim Meyering

don't dereference NULL after failed strdup

Most of these are obvious NULL-deref bug fixes, for example,
the ones in these files:

block/curl.c
net.c
slirp/misc.c

and the first one in block/vvfat.c.
The others in block/vvfat.c may not lead to an immediate segfault, but I...

cb4522cc 12/12/2009 03:59 pm Gerd Hoffmann

default devices: network

Add a default_net variable which specified whenever a default network
should be created. It is cleared in case any -net option is specified
and it is also added to the new -nodefaults switch.

Signed-off-by: Gerd Hoffmann <>...

57f9ef17 12/03/2009 05:41 pm Mark McLoughlin

net: add qemu_foreach_nic()

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

0f2fbf40 12/03/2009 05:41 pm Mark McLoughlin

net: print correct error for '-netdev ""'

Reported-by: Markus Armbruster <>
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

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

net: move parse_macaddr() to net/util.[ch]

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

68da46ee 12/03/2009 05:41 pm Mark McLoughlin

net: remove qemu_new_vlan_client()

... and VLANClientState::opaque and qemu_find_vlan_client().

All of these are now unused

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

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

net: introduce NICState and qemu_new_nic()

Common state for all NICs.

The opaque member will replace the opaque member in VLANClientState
since only NICs need it.

The conf member will allow us to iterate over NICs, access the MAC
addr for the NIC and send a packet from each NIC in qemu_announce_self()....

45460d1a 12/03/2009 05:41 pm Mark McLoughlin

net: introduce qemu_new_net_client()

A replacement for qemu_new_vlan_client(), using NetClientInfo to
replace most arguments.

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

5c361cc3 12/03/2009 05:41 pm Mark McLoughlin

net: move vde code from net.c to net/vde.c

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

42281ac9 12/03/2009 05:41 pm Mark McLoughlin

net: move socket backend code from net.c to net/socket.c

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

1abecf77 12/03/2009 05:41 pm Mark McLoughlin

net: move dump backend code from net.c to net/dump.c

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

1df49e04 12/03/2009 05:41 pm Mark McLoughlin

net: clean up includes in net.c

This is probably a little drastic, but the includes in this file are
now totally out of control when compared with what includes are
actually needed.

This may break the build on e.g. *BSD, but it will be easily fixed by
re-instating an include....

68ac40d2 12/03/2009 05:41 pm Mark McLoughlin

net: move slirp code from net.c to net/slirp.c

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

a167ba50 11/29/2009 07:00 pm Aurelien Jarno

Add support for GNU/kFreeBSD

Signed-off-by: Aurelien Jarno <>

893379ef 11/09/2009 04:43 pm Mark McLoughlin

net: disable receiving if client returns zero

If a receiver returns zero, that means its queue is full and it will
notify us when room is available using qemu_flush_queued_packets().

Take note of that and disable that receiver until it flushes its queue....

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

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

net: move more stuff into net/tap-win32.c, add net/tap.h

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

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

net: move tap-linux.h under net/

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

6c9f58ba 10/27/2009 07:29 pm Sridhar Samudrala

Enable UFO on virtio-net and tap devices

Enable UFO on the host tap device if supported and allow setting UFO
on virtio-net in the guest.

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

b1c28b46 10/27/2009 07:29 pm Mark McLoughlin

net: add tap_set_offload()

This API allows virtio-net to enable various offload features on a
tap interface - e.g. to tell the host kernel it can pass up partial
checksums to userspace.

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

c0b8e49c 10/27/2009 07:29 pm Mark McLoughlin

net: add flags parameter to packet queue interface

This allows for the addition of a raw flag, and leaves the way open
for other flags too.

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

ca77d175 10/27/2009 07:29 pm Mark McLoughlin

net: add an API for 'raw' packets

In the case where a NIC and backend agree on a packet header format,
this API allows injecting packets which lack the agreed upon header.

We need this for sending our gratuitous ARP.

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

70783b9c 10/27/2009 07:29 pm Mark McLoughlin

net: add receive_raw parameter to qemu_new_vlan_client()

Trivial patch to allow supplying a receive_raw function.

A future cleanup should combine this function pointer parameters into a
table.

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

2596774a 10/27/2009 07:29 pm Mark McLoughlin

net: implement tap support for receive_raw()

tap_receive_raw() always prepends a vnet header if IFF_VNET_HDR is
enabled.

tap_receive() only prepends when the a header is required but the NIC
doesn't supply one.

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

76682299 10/27/2009 07:29 pm Mark McLoughlin

net: import linux tap ioctl definitions

Making features dependent on the availability of newer versions if_tun.h
is going to get seriously clumsy, so let's just import the definitions
we need. It's only a small handful.

If and when we're comfortable depending on 2.6.30 headers, we can remove...

38c75be3 10/27/2009 07:29 pm Mark McLoughlin

net: make tap_receive() re-use tap_receive_iov() code

In future we will want to prepend a virtio_net header if the NIC didn't
supply one but IFF_VNET_HDR is enabled on the interface. This is most
easily achived by using writev() in all cases.

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

8e0f8e5b 10/27/2009 07:29 pm Mark McLoughlin

net: enable IFF_VNET_HDR on tap fds if available

For now, we just add an empty header before writing and strip the header
after reading.

We really only want IFF_VNET_HDR when virtio_net is using it, but it
would significantly complicate matters to try and do that. There should...

424a7f96 10/27/2009 07:29 pm Mark McLoughlin

net: refactor tap initialization

Re-factor things so that there is only one call site for
net_tap_fd_init().

Two concerns about the QemuOpts usage here - firstly, we set the script
arguments to their default value and, secondly, we set the ifname value
to the name allocated by the kernel if none is supplied. Are we okay...

baf74c95 10/27/2009 07:29 pm Mark McLoughlin

net: add a vnet_hdr=on|off parameter

This allows people to disable the IFF_VNET_HDR flag, e.g. for debugging
purposes or if they know they may migrate the guest to a machine without
IFF_VNET_HDR support.

It also allows making the lack of IFF_VNET_HDR support an error...

bb6e6364 10/27/2009 07:29 pm Mark McLoughlin

net: add a client type code

This is so as to allow APIs which operate on specific client types
without having to add a function table entry which is only implemented
by a single client type.

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

24e32363 10/27/2009 07:29 pm Mark McLoughlin

net: add tap_has_vnet_hdr() and tap_using_vnet_hdr() APIs

These lamely named functions allow virtio-net to query whether
IFF_VNET_HDR is enabled on a tap interface and inform the tap code
that virtio-net will supply packets with a vnet header.

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

2ef924b4 10/27/2009 07:28 pm Gerd Hoffmann

qdev: add netdev property

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

76d32cba 10/27/2009 07:28 pm Gerd Hoffmann

net: add macaddr type.

Add new type for mac addresses.

Add function which sets the qemu default mac address if it finds the mac
address uninitialized (i.e. all zeros).

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

f7105843 10/15/2009 05:32 pm Mark McLoughlin

net: refactor packet queueing code

The packet queue code is fairly standalone, has some complex details and
easily reusable. It makes sense to split it out on its own. This patch
doesn't contain any functional changes.

Patchworks-ID: 35511
Signed-off-by: Mark McLoughlin <>...

9a6ecb30 10/15/2009 05:32 pm Mark McLoughlin

net: add queue for peer-to-peer packet forwarding

Now that we have re-factored the packet queue code, we can re-use
it for peer-to-peer also.

Patchworks-ID: 35520
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

c1671a08 10/15/2009 05:32 pm Mark McLoughlin

net: fix multiple NICs causing net opts process to stop

For NICs, net_init_client() returns the index into the NICInfo table.

qemu_opts_foreach() interprets non-zero as an error return an stops
iterating over the options.

So, if you have more than one '-net nic' on the command line, subsequent...

577c4af9 10/15/2009 05:32 pm Mark McLoughlin

net: maintain a list of vlan-less clients

Allows them to be cleaned up at shutdown.

This is pretty lame, but will eventually go away as we make vlans
the special case.

Patchworks-ID: 35518
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

5869c4d5 10/15/2009 05:32 pm Mark McLoughlin

net: add -net nic,netdev= option

Patchworks-ID: 35515
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

283c7c63 10/15/2009 05:32 pm Mark McLoughlin

net: allow NICs to be connected to netdevs

Introduce a 'peer' member to VLANClientState as an alternative
to a vlan. The idea being that packets are transfered directly
from peer clients rather than going through a vlan.

Patchworks-ID: 35516
Signed-off-by: Mark McLoughlin <>...

d80b9fc6 10/15/2009 05:32 pm Mark McLoughlin

net: allow clients not associated with a vlan

Allow net clients to be created which are not connected to any vlan.

This is needed by Gerd in order to allow adding -device nic, where
the absence of a vlan parameter will not imply vlan=0. Also needed
to allow adding a -netdevice option which doesn't connect the backend...

7f161aae 10/15/2009 05:32 pm Mark McLoughlin

net: add QemuOptsList arg to net_client_parse()

Patchworks-ID: 35505
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

f6b134ac 10/15/2009 05:32 pm Mark McLoughlin

net: handle -netdevice options

Same as for -net except for:

- only tap, user, vde and socket types are supported
- the vlan parameter is not allowed
- the name parameter is not allowed but the id parameter is
required

Patchworks-ID: 35517
Signed-off-by: Mark McLoughlin <>...

8b077c9f 10/15/2009 05:32 pm Mark McLoughlin

net: pass monitor handle to client init functions

Needed for e.g. looking up a file descriptor name using
monitor_get_fd() in net_init_tap()

Patchworks-ID: 35509
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

6d952ebe 10/15/2009 05:32 pm Mark McLoughlin

net: handle id= parameter for -net

Use id= in the same was as the current name= parameter; if both are
specified, id= is used.

Patchworks-ID: 35514
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

dea7b3b9 10/15/2009 05:32 pm Mark McLoughlin

net: remove id field from NICInfo

Just use the name field instead since we now use the id paramater as
the name, if supplied. Only implication with this change is that if
id is not supplied, the value of the name paramater is used as an
id.

Patchworks-ID: 35512...

5610c3aa 10/15/2009 05:32 pm Mark McLoughlin

net: use qtailq for vlan and client lists

Patchworks-ID: 35507
Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

a3a766e7 10/12/2009 05:42 pm Juan Quintela

slirp: fix !CONFIG_SLIRP compilation

This moves the code that depens on slirp under CONFIG_SLIRP again.

Patchworks-ID: 35372
Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

7f1c9d20 10/06/2009 10:36 pm Mark McLoughlin

Port host_net_add monitor command to QemuOpts

Here is where we rely on qemu_opts_parse() to handle an empty string.
We could alternatively explicitly handle this here by using
qemu_opts_create() when we're not supplied any parameters, but its
cleaner this way....

13cf8f21 10/06/2009 10:36 pm Mark McLoughlin

Port usb net to QemuOpts

We need net_client_init_from_opts() exported for this

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

dc1c9fe8 10/06/2009 10:36 pm Mark McLoughlin

Final net cleanup after conversion to QemuOpts

Now that net_client_init() has no users, kill it off and rename
net_client_init_from_opts().

There is no further need for the old code in net_client_parse() either.
We use qemu_opts_parse() 'firstname' facitity for that. Instead, move...

f83c6e10 10/06/2009 10:36 pm Mark McLoughlin

Port -net none and -net nic to QemuOpts

We use a table of network types to look up the initialization function
and parameter descriptions in net_client_init().

For now, we use QemuOpts for the 'none' and 'nic' types. Subsequent
patches port the other types too and the special casing is removed....

ec302ffd 10/06/2009 10:36 pm Mark McLoughlin

Port -net user to QemuOpts

The handling of guestfwd and hostfwd requires the previous changes
to allow multiple values for each parameter. The only way to access
those multiple values is to use qemu_opt_foreach().

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

8a1c5235 10/06/2009 10:36 pm Mark McLoughlin

Port -net tap to QemuOpts

Some parameters are not valid with fd=. Rather than having a separate
parameter description table for validating fd=, it's easir to just
check for those invalid parameters later.

Note, the need to possible lookup a file descriptor name from the...

88ce16ca 10/06/2009 10:36 pm Mark McLoughlin

Port -net socket to QemuOpts

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

dd51058d 10/06/2009 10:36 pm Mark McLoughlin

Port -net vde to QemuOpts

The net_vde_init() change is needed because we now pass NULL pointers
instead of empty strings for group/sock if they're not set.

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

ed2955c2 10/06/2009 10:36 pm Mark McLoughlin

Port -net dump to QemuOpts

Note, not incrementing nb_host_devs in net_init_dump() is intentional.

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

7b3fb251 10/06/2009 10:36 pm Mark McLoughlin

Clean up legacy code in net_client_init()

Now that we've ported everything over to QemuOpts, we can kill off
all the cruft in net_client_init().

Note, the 'channel' type requires special handling as it uses a
format that QemuOpts can't parse

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

fb12577c 10/06/2009 10:36 pm Markus Armbruster

Drop config_error(), use qemu_error() instead

Diagnostic output goes to stderr, except when we're in a monitor
command, when it goes to the monitor instead.

config_error() implements this with a monitor argument: if it's
non-null, report there, else to stderr. This obliges us to pass the...

32a8e14a 10/06/2009 10:36 pm Mark McLoughlin

Use qemu_strdup() for NICInfo string fields

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

9203f520 10/06/2009 10:36 pm Mark McLoughlin

Make NICInfo string fields non-const

We now only assign strdup()ed strings to these fields, never static
strings.

aliguori: fix build for ppc_prep and mips_jazz

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

d2cffe30 10/06/2009 10:36 pm Mark McLoughlin

Move memset() from net_client_uninit() to net_client_init()

zeroing a structure before using it is more common than zeroing after
using it. Also makes the setting of nd->used more obvious.

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

02374aa0 10/06/2009 10:36 pm Mark McLoughlin

Use qemu_strdup() for VLANClientState string fields

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

3a179c66 10/06/2009 10:36 pm Markus Armbruster

Make net_client_init() consume slirp_configs even on error

net_slirp_init() walks slirp_configs, and stops when it encounters one
that doesn't work. Instead of consuming slirp_configs members there,
consume them in the sole caller. This makes sure all are consumed....

0752706d 10/06/2009 10:36 pm Markus Armbruster

Don't exit() in config_error()

Propagating errors up the call chain is tedious. In startup code, we
can take a shortcut: terminate the program. This is wrong elsewhere,
the monitor in particular.

config_error() tries to cater for both customers: it terminates the...

9ee05825 10/05/2009 05:32 pm Markus Armbruster

Make it obvious that pci_nic_init() can't fail

Before this patch, pci_nic_init() returns NULL when it can't find the
model in pci_nic_models[]. Except this can't happen, because
qemu_check_nic_model_list() just searched for model in
pci_nic_models[], and terminated the program on failure....

07caea31 10/05/2009 05:32 pm Markus Armbruster

Fix pci_add nic not to exit on bad model

Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to
create the NIC. When MODEL is unknown or "?", this prints to stderr
and terminates the program.

Change pci_nic_init() not to treat "?" specially, and to return NULL...

a9796703 10/05/2009 05:32 pm Glauber Costa

Correctly free nd structure

When we "free" a NICInfo structure, we can leak pointers, since we don't do
much more than setting used = 0.

We free() the model parameter, but we don't set it to NULL. This means that
a new user of this structure will see garbage in there. It was not noticed...

acedcfbf 09/30/2009 09:56 pm Michael S. Tsirkin

net: fix coding style nit

Put space between = and - assigning a negative number
to avoid confusion with old-style "-="
(which we also have, and need to be fixed).

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

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

6ee093c9 09/11/2009 06:19 pm Juan Quintela

Unexport ticks_per_sec variable. Create get_ticks_per_sec() function

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

f40d7537 09/04/2009 08:47 pm Blue Swirl

Include sys-queue.h early to override system queue definitions on BSD

Signed-off-by: Blue Swirl <>

f18c16de 09/04/2009 05:37 pm Luiz Capitulino

monitor: Port handler_2 to use QDict

This commit ports command handlers that receive two arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

1d4daa91 09/04/2009 05:37 pm Luiz Capitulino

monitor: Port handler_3 to use QDict

This commit ports command handlers that receive three arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

9da43187 09/04/2009 05:37 pm Jan Kiszka

net: Fix send queue ordering

Ensure that packets enqueued for delayed delivery are dequeued in FIFO
order. At least one simplistic guest TCP/IP stack became unhappy due to
sporadically reordered packet streams.

At this chance, switch the send queue implementation to TAILQ....