summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handlerFam Zheng2015-06-124-16/+16
| | | | | | | | | | | | | | | Done with following Coccinelle semantic patch, plus manual cosmetic changes in net/*.c. @@ expression E1, E2, E3, E4; @@ - qemu_set_fd_handler2(E1, NULL, E2, E3, E4); + qemu_set_fd_handler(E1, E2, E3, E4); Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-8-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Drop tap_can_sendFam Zheng2015-06-121-11/+2
| | | | | | | | | | | | | | This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration. This is redundant with checks inside read callback. After this patch, the data will be sent to peer when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-7-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net/socket: Drop net_socket_can_sendFam Zheng2015-06-121-12/+19
| | | | | | | | | | | | | | | | This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration. This is redundant with checks inside read callback. After this patch, the data will be sent to peer when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed. If the peer is not ready, disable the read poll until send completes. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-6-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* netmap: Drop netmap_can_sendFam Zheng2015-06-121-12/+2
| | | | | | | | | | | | | | | | | | | This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration. This is redundant with checks inside read callback. After this patch, the data will be copied from s->fd to s->iov when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed. Also remove the qemu_can_send_packet() check in netmap_send. If it's true, we are good; if it's false, the qemu_sendv_packet_async would return 0 and read poll will be disabled until netmap_send_completed is called. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-5-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* l2tpv3: Drop l2tpv3_can_sendFam Zheng2015-06-121-10/+1
| | | | | | | | | | | | | | This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration. This is redundant with checks inside read callback. After this patch, the data will be copied from s->fd to s->msgvec when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-4-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* vhost-user: Improve -netdev/netdev_add/-net/... error reportingMarkus Armbruster2015-06-091-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | When -netdev vhost-user fails, it first reports a specific error, then one or more generic ones, like this: $ qemu-system-x86_64 -netdev vhost-user,id=foo,chardev=xxx qemu-system-x86_64: -netdev vhost-user,id=foo,chardev=xxx: chardev "xxx" not found qemu-system-x86_64: -netdev vhost-user,id=foo,chardev=xxx: No suitable chardev found qemu-system-x86_64: -netdev vhost-user,id=foo,chardev=xxx: Device 'vhost-user' could not be initialized With the command line, the messages go to stderr. In HMP, they go to the monitor. In QMP, the last one becomes the error reply, and the others go to stderr. Convert net_init_vhost_user() and its helpers to Error. This suppresses the unwanted unspecific error messages, and makes the specific error the QMP error reply. Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
* QemuOpts: Convert qemu_opt_foreach() to ErrorMarkus Armbruster2015-06-091-3/+4
| | | | | | | | Retain the function value for now, to permit selective conversion of its callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* QemuOpts: Drop qemu_opt_foreach() parameter abort_on_failureMarkus Armbruster2015-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | When the argument is non-zero, qemu_opt_foreach() stops on callback returning non-zero, and returns that value. When the argument is zero, it doesn't stop, and returns the callback's value from the last iteration. The two callers that pass zero could just as well pass one: * qemu_spice_init()'s callback add_channel() either returns zero or exit()s. * config_write_opts()'s callback config_write_opt() always returns zero. Drop the parameter, and always stop. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* QemuOpts: Convert qemu_opts_foreach() to ErrorMarkus Armbruster2015-06-092-6/+7
| | | | | | | | | Retain the function value for now, to permit selective conversion of its callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
* QemuOpts: Drop qemu_opts_foreach() parameter abort_on_failureMarkus Armbruster2015-06-082-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | When the argument is non-zero, qemu_opts_foreach() stops on callback returning non-zero, and returns that value. When the argument is zero, it doesn't stop, and returns the bit-wise inclusive or of all the return values. Funky :) The callers that pass zero could just as well pass one, because their callbacks can't return anything but zero: * qemu_add_globals()'s callback qdev_add_one_global() * qemu_config_write()'s callback config_write_opts() * main()'s callbacks default_driver_check(), drive_enable_snapshot(), vnc_init_func() Drop the parameter, and always stop. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
* slirp: use less predictable directory name in /tmp for smb config ↵Michael Tokarev2015-06-031-4/+3
| | | | | | | | | | | | | | | | | | | (CVE-2015-4037) In this version I used mkdtemp(3) which is: _BSD_SOURCE || /* Since glibc 2.10: */ (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) (POSIX.1-2008), so should be available on systems we care about. While at it, reset the resulting directory name within smb structure on error so cleanup function wont try to remove directory which we failed to create. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* vhost-user: add multi queue supportOuyang Changchun2015-06-011-13/+24
| | | | | | | | | | | | | Based on patch by Nikolay Nikolaev: Vhost-user will implement the multi queue support in a similar way to what vhost already has - a separate thread for each queue. To enable the multi queue functionality - a new command line parameter "queues" is introduced for the vhost-user netdev. Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* net/net: Record usage status of mac addressShannon Zhao2015-05-271-4/+55
| | | | | | | | | | | | | | | | | Currently QEMU dynamically generates mac address for the NIC which doesn't specify the mac address. But when we hotplug a NIC without specifying mac address, the mac address will increase for the same NIC along with hotplug and hot-unplug, and at last it will overflow. And if we codeplug one NIC with mac address e.g. "52:54:00:12:34:56", then hotplug one NIC without specifying mac address and the mac address of the hotplugged NIC is duplicate of "52:54:00:12:34:56". This patch add a mac_table to record the usage status and free the mac address when the NIC is unrealized. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Improve -netdev/netdev_add/-net/... tap error reportingMarkus Armbruster2015-05-271-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | When -netdev tap fails, it first reports a specific error, then a generic one, like this: $ qemu-system-x86_64 -netdev tap,id=foo qemu-system-x86_64: -netdev tap,id=foo: could not configure /dev/net/tun: Operation not permitted qemu-system-x86_64: -netdev tap,id=foo: Device 'tap' could not be initialized With the command line, the messages go to stderr. In HMP, they go to the monitor. In QMP, the second one becomes the error reply, and the first one goes to stderr. Convert net_init_tap() to Error. This suppresses the unwanted second message, and makes the specific error the QMP error reply. [Dropped duplicate "and" from error message as suggested by Eric Blake: "ifname=, script=, downscript=, and vnet_hdr=, " "queues=, and vhostfds= are invalid with helper=" --Stefan] Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-16-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Finish conversion of tap_open() to ErrorMarkus Armbruster2015-05-271-4/+0
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-15-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap-solaris: Convert tap_open() to ErrorMarkus Armbruster2015-05-271-29/+30
| | | | | | | | | | | | Fixes inappropriate use of syslog(). Not fixed: leaks on error paths, suspicious non-fatal errors. FIXMEs added instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-14-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap-bsd: Convert tap_open() to ErrorMarkus Armbruster2015-05-271-19/+14
| | | | | | | | | | | Fixes inappropriate use of stderr in monitor command handler. While there, improve some of the messages a bit. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-13-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap-linux: Convert tap_open() to ErrorMarkus Armbruster2015-05-271-8/+9
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-12-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Permit incremental conversion of tap_open() to ErrorMarkus Armbruster2015-05-277-13/+22
| | | | | | | | | Convert the trivial ones immediately: tap-aix and tap-haiku. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-11-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Convert launch_script() to ErrorMarkus Armbruster2015-05-271-12/+28
| | | | | | | | | | | | | | Fixes inappropriate use of stderr in monitor command handler. While there, improve the messages some. [Fixed Error **err -> Error *err local variable that broke the build. --Stefan] Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-10-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Convert net_init_tap_one() to ErrorMarkus Armbruster2015-05-271-32/+38
| | | | | | | | | | | | [Dropped %s from "tap: open vhost char device failed: %s" since error_setg_errno() already prints a human-readable error string and there is no format string argument. --Stefan] Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-9-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Convert tap_set_sndbuf() to ErrorMarkus Armbruster2015-05-277-14/+10
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-8-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Improve -netdev/netdev_add/-net/... bridge error reportingMarkus Armbruster2015-05-271-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When -netdev bridge fails, it first reports a specific error, then a generic one, like this: $ qemu-system-x86_64 -netdev bridge,id=foo failed to launch bridge helper qemu-system-x86_64: -netdev bridge,id=foo: Device 'bridge' could not be initialized The first message goes to stderr. Wrong for HMP, because errors need to go to the monitor there. The second message goes to stderr for -netdev, to the monitor for HMP netdev_add, and becomes the error reply for QMP netdev_add. Convert net_bridge_run_helper() to Error, and propagate its errors through net_init_bridge(). This ensures the error gets reported where the user is, and suppresses the unwanted second message. While there, improve the error messages a bit. The above example becomes: $ qemu-system-x86_64 -netdev bridge,id=foo qemu-system-x86_64: -netdev bridge,id=foo: bridge helper failed net_init_tap() also uses net_bridge_run_helper(). Propagate its errors there as well. Improves reporting these errors with -netdev tap & friends. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-7-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: net_tap_fd_init() can't fail, drop dead error handlingMarkus Armbruster2015-05-271-13/+1
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-6-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net/dump: Improve -net/host_net_add dump error reportingMarkus Armbruster2015-05-271-6/+6
| | | | | | | | | | | | | | | | | | | | When -net dump fails, it first reports a specific error, then a generic one, like this: $ qemu-system-x86_64 -net dump,id=foo,file=/eperm qemu-system-x86_64: -net dump,id=foo,file=/eperm: -net dump: can't open /eperm qemu-system-x86_64: -net dump,id=foo,file=/eperm: Device 'dump' could not be initialized Convert net_init_tap() to Error. This suppresses the unwanted second message. Improve the error messages to include strerror(errno) where appropriate. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-5-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Improve -net nic error reportingMarkus Armbruster2015-05-271-6/+6
| | | | | | | | | | | | | | | | | | | When -net nic fails, it first reports a specific error, then a generic one, like this: $ qemu-system-x86_64 -net nic,netdev=nonexistent qemu-system-x86_64: -net nic,netdev=nonexistent: netdev 'nonexistent' not found qemu-system-x86_64: -net nic,netdev=nonexistent: Device 'nic' could not be initialized Convert net_init_nic() to Error to get rid of the unwanted second error message. While there, tidy up an Overcapitalized Error Message. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-4-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Permit incremental conversion of init functions to ErrorMarkus Armbruster2015-05-2712-29/+40
| | | | | | | | | | | | | | | | | | | | | | | Error reporting for netdev_add is broken: the net_client_init_fun[] report the actual errors with (at best) error_report(), and their caller net_client_init1() makes up a generic error on top. For command line and HMP, this produces an mildly ugly error cascade. In QMP, the actual errors go to stderr, and the generic error becomes the command's error reply. To fix this, we need to convert the net_client_init_fun[] to Error. To permit fixing them one by one, add an Error ** parameter to the net_client_init_fun[]. If the call fails without returning an Error, make up the same generic Error as before. But if it returns one, use that instead. Since none of them does so far, no functional change. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Improve error message for -net hubport a bitMarkus Armbruster2015-05-272-4/+6
| | | | | | | | | | | | | | | | | | | | | Type "hubport" is valid only with -netdev. Unfortunately, that's detected late and the error message doesn't explain why: $ qemu-system-i386 -net hubport,id=foo,hubid=0 qemu-system-i386: -net hubport,id=foo,hubid=0: Device 'hubport' could not be initialized Improve the error message to "Parameter 'type' expects a net type". Not fixed: -net hubport without the parameters required by -netdev hubport still asks for those parameters: $ qemu-system-i386 -net hubport qemu-system-i386: -net hubport: Parameter 'hubid' is missing Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-2-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: add MAC address string printerScott Feldman2015-05-111-0/+7
| | | | | | | | | | We can use this in virtio-net code as well as new Rocker driver code, so up-level this. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1426306173-24884-2-git-send-email-sfeldma@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: synchronize net_host_device_remove with host_net_remove_completionPaolo Bonzini2015-03-121-3/+3
| | | | | | | | | | | | | Using net_host_check_device is unnecessary. qemu_del_net_client asserts for the non-peer case that it can only process NIC type NetClientStates, and that assertion is valid for the peered case as well, so move it and use the same check in net_host_device_remove. host_net_remove_completion is already checking the type. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Message-id: 1419353600-30519-2-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* vhost: Remove superfluous '\n' around error_report()Gonglei2015-03-101-2/+2
| | | | | | Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell2015-03-091-13/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pci, pc, virtio fixes and cleanups A bunch of fixes all over the place. All of ACPI refactoring has been merged. Legacy pci commands have been dropped. virtio header cleanup initial patches from virtio-1.0 branch Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * remotes/mst/tags/for_upstream: (130 commits) acpi: drop unused code aml-build: comment fix acpi-build: fix typo in comment acpi: update generated files vhost user:support vhost user nic for non msi guests aml-build: fix build for glib < 2.22 acpi: update generated files Makefile.target: binary depends on config-devices acpi-test-data: update after pci rewrite acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb(). pci-hotplug-old: Has been dead for five major releases, bury pci: Give a few helpers internal linkage acpi: make build_*() routines static to aml-build.c pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs pc: acpi-build: drop template patching and create PCI bus tree dynamically tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation pc: acpi-build: simplify PCI bus tree generation tests: add ACPI blobs for qemu with bridge cases tests: bios-tables-test: add support for testing bridges tests: ACPI test blobs update due to PCI0._CRS changes ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: hw/pci/pci-hotplug-old.c
| * vhost user:support vhost user nic for non msi guestsHaifeng Gao2015-03-031-13/+3
| | | | | | | | | | | | | | | | | | | | Currently, vhost user nic doesn't support non msi guests(like pxe stage) by default. Vhost user nic can't fall back to qemu like normal vhost net nic does. So we should enable it for non msi guests. Signed-off-by: Haifeng Gao <gaohaifeng.gao@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | QemuOpts: Drop qemu_opt_set(), rename qemu_opt_set_err(), fix useMarkus Armbruster2015-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qemu_opt_set() is a wrapper around qemu_opt_set() that reports the error with qerror_report_err(). Most of its users assume the function can't fail. Make them use qemu_opt_set_err() with &error_abort, so that should the assumption ever break, it'll break noisily. Just two users remain, in util/qemu-config.c. Switch them to qemu_opt_set_err() as well, then rename qemu_opt_set_err() to qemu_opt_set(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* | QemuOpts: Convert qemu_opts_set() to Error, fix its useMarkus Armbruster2015-02-261-2/+2
|/ | | | | | | | | | | | | | | | Return the Error object instead of reporting it with qerror_report_err(). Change callers that assume the function can't fail to pass &error_abort, so that should the assumption ever break, it'll break noisily. Turns out all callers outside its unit test assume that. We could drop the Error ** argument, but that would make the interface less regular, so don't. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-02-18' ↵Peter Maydell2015-02-263-10/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging Clean up around error_get_pretty(), qerror_report_err() # gpg: Signature made Wed Feb 18 10:10:07 2015 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-error-2015-02-18: qemu-char: Avoid qerror_report_err() outside QMP command handlers qemu-img: Avoid qerror_report_err() outside QMP command handlers vl: Avoid qerror_report_err() outside QMP command handlers tpm: Avoid qerror_report_err() outside QMP command handlers numa: Avoid qerror_report_err() outside QMP command handlers net: Avoid qerror_report_err() outside QMP command handlers monitor: Avoid qerror_report_err() outside QMP command handlers monitor: Clean up around monitor_handle_fd_param() error: Use error_report_err() where appropriate error: New convenience function error_report_err() vhost-scsi: Improve error reporting for invalid vhostfd Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * net: Avoid qerror_report_err() outside QMP command handlersMarkus Armbruster2015-02-181-6/+3
| | | | | | | | | | | | | | | | | | | | | | qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace by error_report_err() in HMP command handler hmp_host_net_add() and initial startup helpers net_init_client(), net_init_netdev(). Keep it in QMP command handler qmp_netdev_add(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * monitor: Clean up around monitor_handle_fd_param()Markus Armbruster2015-02-182-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | monitor_handle_fd_param() is a wrapper around monitor_handle_fd_param2() that feeds errors to qerror_report_err() instead of returning them. qerror_report_err() is inappropriate in many contexts. monitor_handle_fd_param() looks simpler than monitor_handle_fd_param2(), which tempts use. Remove the temptation: drop the wrapper and open-code the (trivial) error handling instead. Replace the open-coded qerror_report_err() by error_report_err() in places that already use error_report(). Turns out that's everywhere. While there, rename monitor_handle_fd_param2() to monitor_fd_param(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* | hmp: Name HMP info handler functions hmp_info_SUBCOMMAND()Markus Armbruster2015-02-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some are called do_info_SUBCOMMAND() (old ones, usually), some hmp_info_SUBCOMMAND(), some SUBCOMMAND_info(), sometimes SUBCOMMAND pointlessly differs in spelling. Normalize to hmp_info_SUBCOMMAND(), where SUBCOMMAND is exactly the subcommand name with '-' replaced by '_'. Exceptions: * sun4m_irq_info(), sun4m_pic_info() renamed to sun4m_hmp_info_irq(), sun4m_hmp_info_pic(). * lm32_irq_info(), lm32_pic_info() renamed to lm32_hmp_info_irq(), lm32_hmp_info_pic(). Signed-off-by: Markus Armbruster <armbru@redhat.com>
* | hmp: Name HMP command handler functions hmp_COMMAND()Markus Armbruster2015-02-182-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | Some are called do_COMMAND() (old ones, usually), some hmp_COMMAND(), and sometimes COMMAND pointlessly differs in spelling. Normalize to hmp_COMMAND(), where COMMAND is exactly the command name with '-' replaced by '_'. Exceptions: * do_device_add() and client_migrate_info() *not* renamed to hmp_device_add(), hmp_client_migrate_info(), because they're also QMP handlers. They still need to be converted to QAPI. * do_memory_dump(), do_physical_memory_dump(), do_ioport_read(), do_ioport_write() renamed do hmp_* instead of hmp_x(), hmp_xp(), hmp_i(), hmp_o(), because those names are too cryptic for my taste. * do_info_help() renamed to hmp_info_help() instead of hmp_info(), because it only covers help. Signed-off-by: Markus Armbruster <armbru@redhat.com>
* net: del hub port when peer is deletedJason Wang2015-02-061-0/+2
| | | | | | | | | We should del hub port when peer is deleted since it will not be reused and will only be freed during exit. Signed-off-by: Jason Wang <jasowang@redhat.com> Message-id: 1422860798-17495-3-git-send-email-jasowang@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: remove the wrong comment in net_init_hubport()Jason Wang2015-02-061-1/+0
| | | | | | | | Not only nic could be the one to peer. Signed-off-by: Jason Wang <jasowang@redhat.com> Message-id: 1422860798-17495-2-git-send-email-jasowang@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* monitor: print hub port name during info networkJason Wang2015-02-061-1/+4
| | | | | | Signed-off-by: Jason Wang <jasowang@redhat.com> Message-id: 1422860798-17495-1-git-send-email-jasowang@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Use g_new() & friends where that makes obvious senseMarkus Armbruster2014-12-193-5/+5
| | | | | | | | | | | | | g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Fuse g_malloc(); memset() into g_new0()Markus Armbruster2014-12-191-2/+1
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: fix vcpu long time io blocking on tapWangkai (Kevin,C)2014-12-191-0/+12
| | | | | | | | [Adjusted doc comment for grammar. --Stefan] Signed-off-by: Wangkai <wangkai86@huawei.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net/socket: fix Uninitialized scalar variableGonglei2014-11-211-5/+6
| | | | | | | | | | | | | If is_connected parameter is false, the saddr variable will no initialize. Coverity report: uninit_use: Using uninitialized value saddr.sin_port. We don't need add saddr information to nc->info_str when is_connected is false. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net/slirp: fix memory leakGonglei2014-11-211-2/+1
| | | | | | | | | | | | commit b412eb61 introduce 'cmd:' target for guestfwd, and fwd don't be used in this scenario, and will leak memory in true branch with 'cmd:'. Let's allocate memory for fwd variable just in else statement. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: The third parameter of getsockname should be initializedzhanghailiang2014-11-181-1/+1
| | | | | | Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* l2tpv3: fix fd leakGonglei2014-11-171-2/+2
| | | | | | | | | In this false branch, fd will leak when it is zero. Change the testing condition. Signed-off-by: Gonglei <arei.gonglei@huawei.com> [Fix net_l2tpv3_cleanup as well. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud