summaryrefslogtreecommitdiff
path: root/qemu_socket.h
AgeCommit message (Collapse)AuthorFilesLines
2012-09-25Fix address handling in inet_nonblocking_connectOrit Wasserman1-5/+11
getaddrinfo can give us a list of addresses, but we only try to connect to the first one. If that fails we never proceed to the next one. This is common on desktop setups that often have ipv6 configured but not actually working. To fix this make inet_connect_nonblocking retry connection with a different address. callers on inet_nonblocking_connect register a callback function that will be called when connect opertion completes, in case of failure the fd will have a negative value Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-25Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connectOrit Wasserman1-2/+5
No need to add non blocking parameters to the blocking inet_connect add block parameter for inet_connect_opts instead of using QemuOpt "block". Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-08-13net: inet_connect(), inet_connect_opts(): add in_progress argumentLuiz Capitulino1-2/+2
It's used to indicate the special case where a valid file-descriptor is returned (ie. success) but the connection can't be completed w/o blocking. This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not treated like an error and a future commit will drop it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-05-10sockets: use error class to pass listen errorAmos Kong1-2/+2
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> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-10sockets: change inet_connect() to support nonblock socketAmos Kong1-2/+4
Add a bool argument to inet_connect() to assign if set socket to 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. Retry to connect when -EINTR is got. Connect's successful for nonblock socket when following errors are got, user should wait for connecting by select(): -EINPROGRESS -EWOULDBLOCK (win32) -WSAEALREADY (win32) Change nbd, vnc to use new interface. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-15w32: Move defines for socket specific errors to qemu-os-win32.hStefan Weil1-6/+0
As those defines are only used for w32, they should be in the header file for w32. All files which include slirp.h or qemu_socket.h also include qemu-os-win32.h. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-03w32: Undefine error constants before their redefinitionJan Kiszka1-0/+2
Avoids lots of warnings. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-22move corking functions to osdep.cPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21add socket_set_blockPaolo Bonzini1-0/+1
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-03-06net: remove parse_host_src_port() functionJuan Quintela1-3/+0
It was deprecated, and it has no users. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-09-22Fix OpenBSD buildBlue Swirl1-0/+1
Add #include <sys/types.h>, needed by #include <sys/socket.h>. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-09move socket_init to qemu-sockets.cPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-01-20net: Make inet_strfamily() publicLuiz Capitulino1-0/+1
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>
2009-12-03Don't leak file descriptorsKevin Wolf1-0/+2
We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors 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>
2009-09-11convert udp chardev to QemuOpts.Gerd Hoffmann1-0/+1
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 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11sockets: add inet_listen_optsGerd Hoffmann1-0/+1
Add inet_listen_opts(). Does the same as inet_listen(), but uses QemuOpts. inet_listen() is a compatibility wrapper for inet_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>
2009-09-11sockets: add inet_connect_optsGerd Hoffmann1-0/+1
Add inet_connect_opts(). Does the same as inet_connect(), but uses QemuOpts. inet_connect() is a compatibility wrapper for inet_connect_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>
2009-09-11sockets: add unix_listen_optsGerd Hoffmann1-0/+1
Add unix_listen_opts(). Does the same as unix_listen(), but uses QemuOpts. unix_listen() is a compatibility wrapper for unix_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>
2009-09-11sockets: add unix_connect_optsGerd Hoffmann1-0/+3
Add unix_connect_opts(). Does the same as unix_connect(), but uses QemuOpts. unix_connect() is a compatibility wrapper for unix_connect_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>
2009-03-08Fix windows build and clean up use of <windows.h>aliguori1-2/+0
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so let's do it in OS_CFLAGS. Then, we can pepper in windows.h includes where using #includes that require it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6783 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-11sockets: helper functions for qemu (Gerd Hoffman)aliguori1-3/+13
This patch creates a new source file qemu-sockets.c with a bunch of helper functions to create listening and connected sockets. New features of this code are (a) support for searching for a free port in a given range and (b) support for IPv6. The following patches put that code into use. Compile fixes for Windows added by Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5695 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31Move some declarations around in the QEMU CharDriver codealiguori1-0/+6
The goal of this series is to move the CharDriverState code out of vl.c and into its own file, qemu-char.c. This patch moves around some declarations so the next patch can be pure code motion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5579 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-13Introduce UI for live migrationaliguori1-0/+1
This patch introduces a command line parameter and monitor command for starting a live migration. The next patch will provide an example of how to use these parameters. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5476 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-15Use common objects for qemu-img and qemu-nbdaliguori1-0/+4
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the code. It's ugly and causes us to have to build multiple object files for linking against qemu and the tools. This patch introduces a new file, qemu-tool.c which contains enough for qemu-img, qemu-nbd, and QEMU to all share the same objects. This also required getting qemu-nbd to be a bit more Windows friendly. I also changed the Windows block-raw to use normal IO instead of overlapping IO since we don't actually do AIO yet on Windows. I changed the various #if 0's to #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows. After this patch, there are no longer any #ifdef's related to qemu-img and qemu-nbd. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-17Use WIN32_LEAN_AND_MEAN, by Stefan Weil.ths1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3832 c046a42c-6fe2-441c-8c8c-71466251a162
2006-12-21Run monitor over unix domain sockets, by Anthony Liguori.ths1-0/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2259 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-30win32 socket fixesbellard1-0/+30
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1876 c046a42c-6fe2-441c-8c8c-71466251a162