summaryrefslogtreecommitdiff
path: root/util/qemu-sockets.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06qemu-option: Remove qemu_opts_create_nofailPeter Crosthwaite1-9/+9
This is a boiler-plate _nofail variant of qemu_opts_create. Remove and use error_abort in call sites. null/0 arguments needs to be added for the id and fail_if_exists fields in affected callsites due to argument inconsistency between the normal and no_fail variants. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-10-02util: call socket_set_fast_reuse instead of setting SO_REUSEADDRSebastian Ottlik1-3/+3
SO_REUSEADDR should be avoided on Windows but is desired on other operating systems. So instead of setting it we call socket_set_fast_reuse that will result in the appropriate behaviour on all operating systems. Signed-off-by: Sebastian Ottlik <ottlik@fzi.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
2013-06-28qemu-socket: don't leak opts on errorGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: catch monitor_get_fd failuresGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: drop pointless allocationGerd Hoffmann1-1/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: zero-initialize SocketAddressGerd Hoffmann1-2/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-18qemu-socket: allow hostnames starting with a digitJán Tomko1-9/+4
According to RFC 1123 [1], hostnames can start with a digit too. [1] http://tools.ietf.org/html/rfc1123#page-13 Signed-off-by: Ján Tomko <jtomko@redhat.com> Cc: qemu-stable@nongnu.org [Use strspn, not strcspn. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-24util: move socket_init() to osdep.cMarc-André Lureau1-24/+0
vscclient needs to call socket_init() for portability. Moving to osdep.c since it has no internal dependency. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-02qemu-socket: set passed fd non-blocking in socket_connect()Stefan Hajnoczi1-0/+1
socket_connect() sets non-blocking on TCP or UNIX domain sockets if a callback function is passed. Do the same for file descriptor passing, otherwise we could unexpectedly be using a blocking file descriptor. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-04-02oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi1-2/+2
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-03-22Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori1-15/+15
# By Kevin Wolf (12) and Peter Lieven (2) # Via Kevin Wolf * kwolf/for-anthony: nbd: Check against invalid option combinations nbd: Use default port if only host is specified block: Allow omitting the file name when using driver-specific options block: Make find_image_format safe with NULL filename block: Rename variable to avoid shadowing block: Introduce .bdrv_parse_filename callback nbd: Accept -drive options for the network connection nbd: Remove unused functions nbd: Keep hostname and port separate qemu-socket: Make socket_optslist public block: Pass bdrv_file_open() options to block drivers block: Add options QDict to bdrv_file_open() prototypes block: complete all IOs before resizing a device Revert "block: complete all IOs before .bdrv_truncate"
2013-03-22nbd: Keep hostname and port separateKevin Wolf1-3/+3
The NBD block supports an URL syntax, for which a URL parser returns separate hostname and port fields. It also supports the traditional qemu syntax encoded in a filename. Until now, after parsing the URL to get each piece of information, a new string is built to be fed to socket functions. Instead of building a string in the URL case that is immediately parsed again, parse the string in both cases and use the QemuOpts interface to qemu-sockets.c. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-03-22qemu-socket: Make socket_optslist publicKevin Wolf1-12/+12
Allow other users to create the QemuOpts needed for inet_connect_opts(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-03-22MinGW: Replace setsockopt by qemu_setsocketoptStefan Weil1-5/+5
Instead of adding missing type casts which are needed by MinGW for the 4th argument, the patch uses qemu_setsockopt which was invented for this purpose. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-13chardev: add udp support to qapiGerd Hoffmann1-0/+25
This patch adds 'udp' support to qapi. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-08char-socket: fix error reportingAnthony Liguori1-0/+4
Right now the inet connect code tries all available addresses but until one doesn't fail. It passes local_err each time without clearing it from the previous failure. This can trigger an assert since the inet connect code tries to set an error on an object != NULL. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 16c806d60aa5e9660ed7751bb4e37dcd278f97f0.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-11error: Strip trailing '\n' from error string arguments (again)Markus Armbruster1-3/+3
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming back. Tracked down with this Coccinelle semantic patch: @r@ expression err, eno, cls, fmt; position p; @@ ( error_report(fmt, ...)@p | error_set(err, cls, fmt, ...)@p | error_set_errno(err, eno, cls, fmt, ...)@p | error_setg(err, fmt, ...)@p | error_setg_errno(err, eno, fmt, ...)@p ) @script:python@ fmt << r.fmt; p << r.p; @@ if "\\n" in str(fmt): print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1360354939-10994-4-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-12build: move libqemuutil.a components to util/Paolo Bonzini1-0/+970
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>