History | View | Annotate | Download (26 kB)
use qemu_opts_create_nofail
We will use qemu_opts_create_nofail function, it can make codemore readable.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-sockets: Fix parsing of the inet option 'to'.
Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>...
build: replace weak symbols with a static library
Weak symbols were a nice idea, but they turned out not to be a good one.Toolchain support is just too sparse, in particular llvm-gcc is totallybroken.
This patch uses a surprisingly low-tech approach: a static library....
compiler: support Darwin weak references
Weakrefs only tell you if the symbol was defined elsewhere, so youneed a further check at runtime to pick the default definitionwhen needed.
This could be automated by the compiler, but it does not do it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
iohandler: add weak alias in qemu-sockets.c, for qemu-ga
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
sockets: use weak aliases instead of qemu-tool.c
qemu-tool.c has its own (largeish) set of dependencies. Weak aliasescan be placed directly where people use them, and do not contributeto increasing the dependencies of generic utility files.
qemu-sockets: add socket_listen, socket_connect, socket_parse
These are QAPI-friendly versions of the qemu-sockets functions. Theysupport IP sockets, Unix sockets, and named file descriptors, using aQAPI union to dispatch to the correct function.
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>...
qemu-sockets: return InetSocketAddress from inet_parse
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-sockets: include strerror or gai_strerror output in error messages
Among others, before:
$ qemu-system-x86_64 -chardev socket,port=12345,id=char inet_connect: host and/or port not specified chardev: opening backend "socket" failed
After:...
qemu-sockets: add error propagation to inet_connect_addr
perror and fprintf can be removed because all clients can now consumeErrors properly. However, we'll need to change the non-blocking connecthandlers to take an Error, in order to improve error handling for...
qemu-sockets: add error propagation to inet_dgram_opts
Before:
$ qemu-system-x86_64 -monitor udp:localhost:631@localhost:631 inet_dgram_opts: bind(ipv4,127.0.0.1,631): OK inet_dgram_opts failed chardev: opening backend "udp" failed
qemu-sockets: add error propagation to inet_parse
qemu-sockets: add error propagation to Unix socket functions
$ qemu-system-x86_64 -monitor unix:/vvv,server=off connect(unix:/vvv): No such file or directory chardev: opening backend "socket" failed
After:
$ x86_64-softmmu/qemu-system-x86_64 -monitor unix:/vvv,server=off...
qemu-sockets: add Error ** to all functions
This lets me adjust the clients to do proper error propagation first,thus avoiding temporary regressions in the quality of the error messages.
qemu-sockets: unix_listen and unix_connect are portable
They are just wrappers and do not need a Win32-specific version.
qemu-sockets: add nonblocking connect for Unix sockets
This patch mostly mimics what was done to TCP sockets, but simplerbecause there is only one address to try. It also includes a free EINTRbug fix.
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
qemu-sockets: Fix compiler warning (regression for MinGW)
setsockopt needs a type cast for MinGW. That type cast is missing ina recent commit which results in a compiler warning.
Like for other socket related functions which have the same problem,we add a 'qemu_setsockopt' macro which provides that type cast where...
Fix address handling in inet_nonblocking_connect
getaddrinfo can give us a list of addresses, but we only try toconnect to the first one. If that fails we never proceed tothe next one. This is common on desktop setups that often have ipv6configured but not actually working....
Refactor inet_connect_opts function
refactor address resolution code to fix nonblocking connectremove getnameinfo call
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Orit Wasserman <owasserm@redhat.com>...
Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connect
No need to add non blocking parameters to the blocking inet_connectadd block parameter for inet_connect_opts instead of using QemuOpt "block".
Signed-off-by: Orit Wasserman <owasserm@redhat.com>...
qemu-sockets: Fix potential memory leak
The old code leaks variable 'peer'.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
migration: don't rely on any QERR_SOCKET_*
Use the in_progress argument for QERR_SOCKET_CONNECT_IN_PROGRESS. Theother errors are handled the same by checking if the error is set andthen calling migrate_fd_error() if it's.
It's also necessary to change inet_connect_opts() not to set...
net: inet_connect(), inet_connect_opts(): add in_progress argument
It's used to indicate the special case where a valid file-descriptoris returned (ie. success) but the connection can't be completedw/o blocking.
This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not...
socket: clean up redundant assignment
Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
place qemu-sockets.c contributions since 2012-01-13 under GPLv2+
Past contributions since 2012-01-13 were only made by Red Hat people,so they are already available under GPLv2+.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Stefan Weil <sw@weilnetz.de>...
qemu-option: qemu_opts_create(): use error_set()
This commit converts qemu_opts_create() from qerror_report() toerror_set().
Currently, most calls to qemu_opts_create() can't fail, so mostcallers don't need any changes.
The two cases where code checks for qemu_opts_create() erros are:...
sockets: change inet_connect() to support nonblock socket
Add a bool argument to inet_connect() to assign if set socketto block/nonblock, and delete original argument 'socktype'that is unused.Add a new argument to inet_connect()/inet_connect_opts(),to pass back connect error by error class....
sockets: use error class to pass listen error
Add a new argument in inet_listen()/inet_listen_opts()to pass back listen error.
Change nbd, qemu-char, vnc to use new interface.
Signed-off-by: Amos Kong <akong@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
sockets: Drop sockets_debug debug code
I'm trying to improve this code's error reporting, and the debug codeis getting in my way: it clutters the code, it clobbers errno ininconvenient places, and it uses the same fprintf() both for errorreporting and debug output in a few places....
sockets: Clean up inet_listen_opts()'s convoluted bind() loop
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-sockets: Plug fd leak on unix_connect_opts() error path
Spotted by Coverity.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Set errno=ENOTSUP for attempts to use UNIX sockets on Windows platforms
Signed-off-by: Nick Thomas <nick@bytemark.co.uk>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-sockets: avoid strlen of NULL pointer
If the user wants to create a chardev of type socket but forgets to give ahost= option, qemu_opt_get returns NULL. This NULL pointer is then fed intostrlen a few lines below without a check which results in a segfault....
move socket_init to qemu-sockets.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
fix inet_parse typo
qemu_opt_set wants on/off, not yes/no.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: Make inet_strfamily() public
So that it can be used by other subsystems.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: inet_strfamily(): Better unknown family report
Returning "????" is a bit meaningless, let's call it "unknown".
Don't leak file descriptors
We're leaking file descriptors to child processes. Set FD_CLOEXEC on filedescriptors that don't need to be passed to children to stop this misbehaviour.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add 'static'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
convert udp chardev to QemuOpts.
While being at it: create a new inet_dgram_opts() function for udp setup,so udp can handle IPv6 now.
new cmd line syntax: -chardev udp,id=name,host=remotehost,port=remoteport,\ localaddr=bindaddr,localport=bindport...
sockets: add unix_connect_opts
Add unix_connect_opts(). Does the same as unix_connect(), but usesQemuOpts. unix_connect() is a compatibility wrapper forunix_connect_opts() now and should go away some day.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
sockets: add unix_listen_opts
Add unix_listen_opts(). Does the same as unix_listen(), but usesQemuOpts. unix_listen() is a compatibility wrapper forunix_listen_opts() now and should go away some day.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sockets: add unix_*_opts for windows.
Add unix_*_opts function dummys for windows.
sockets: add inet_connect_opts
Add inet_connect_opts(). Does the same as inet_connect(), but usesQemuOpts. inet_connect() is a compatibility wrapper forinet_connect_opts() now and should go away some day.
sockets: add inet_listen_opts
Add inet_listen_opts(). Does the same as inet_listen(), but usesQemuOpts. inet_listen() is a compatibility wrapper forinet_listen_opts() now and should go away some day.
Fix in file qemu-sockets.c
1) Changed usage of malloc,free,strdup to qemu_malloc,qemu_free,qemu_strdup 2) Some coding style fixes (based on CODING_STYLE document) 3) Free struct addrinfo *res after failure of listen
Signed-off-by: vibi <vibi_sreenivasan@cms.com>...
Fix some more warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6300 c046a42c-6fe2-441c-8c8c-71466251a162
Use qemu_isfoobar and qemu_towombat versions, based on patch by Christoph Egger
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5774 c046a42c-6fe2-441c-8c8c-71466251a162
copyright & license for qemu_sockets.c (Gerd Hoffman)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5714 c046a42c-6fe2-441c-8c8c-71466251a162
sockets: helper functions for qemu (Gerd Hoffman)
This patch creates a new source file qemu-sockets.c with a bunch ofhelper functions to create listening and connected sockets.
New features of this code are (a) support for searching for a freeport in a given range and (b) support for IPv6....