aboutsummaryrefslogtreecommitdiffstats
path: root/qemu-sockets.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-24sockets: Clean up inet_listen_opts()'s convoluted bind() loopMarkus Armbruster1-8/+6
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24sockets: Drop sockets_debug debug codeMarkus Armbruster1-41/+2
I'm trying to improve this code's error reporting, and the debug code is getting in my way: it clutters the code, it clobbers errno in inconvenient places, and it uses the same fprintf() both for error reporting and debug output in a few places. Get rid of it. Once decent error reporting is in place, adding back whatever debug code we need shouldn't be hard. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11qemu-sockets: Plug fd leak on unix_connect_opts() error pathMarkus Armbruster1-0/+1
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-2/+2
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-04-07Set errno=ENOTSUP for attempts to use UNIX sockets on Windows platformsNick Thomas1-0/+4
Signed-off-by: Nick Thomas <nick@bytemark.co.uk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-18qemu-sockets: avoid strlen of NULL pointerJens Osterkamp1-1/+2
If the user wants to create a chardev of type socket but forgets to give a host= option, qemu_opt_get returns NULL. This NULL pointer is then fed into strlen a few lines below without a check which results in a segfault. This fixes it. Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-09move socket_init to qemu-sockets.cPaolo Bonzini1-0/+24
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-02-10fix inet_parse typoMarcelo Tosatti1-4/+4
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>
2010-01-20net: inet_strfamily(): Better unknown family reportLuiz Capitulino1-1/+1
Returning "????" is a bit meaningless, let's call it "unknown". Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-20net: Make inet_strfamily() publicLuiz Capitulino1-1/+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-5/+5
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-12Add 'static'Blue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-12Fix sys-queue.h conflict for goodBlue Swirl1-1/+1
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, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-11convert udp chardev to QemuOpts.Gerd Hoffmann1-0/+114
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-55/+48
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-33/+96
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_*_opts for windows.Gerd Hoffmann1-0/+12
Add unix_*_opts function dummys for windows. 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-14/+33
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-1/+33
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-05-08Fix in file qemu-sockets.cvibi1-30/+32
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-01-14Fix some more warningsblueswir11-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6300 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-22Use qemu_isfoobar and qemu_towombat versions, based on patch by Christoph Eggerblueswir11-2/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5774 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-13copyright & license for qemu_sockets.c (Gerd Hoffman)aliguori1-0/+14
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@5714 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-11sockets: helper functions for qemu (Gerd Hoffman)aliguori1-0/+400
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