From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBOHM-0003Vd-1V for qemu-devel@nongnu.org; Tue, 22 Dec 2015 09:51:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBOHI-0000oc-9X for qemu-devel@nongnu.org; Tue, 22 Dec 2015 09:51:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBOHI-0000oW-4T for qemu-devel@nongnu.org; Tue, 22 Dec 2015 09:51:04 -0500 Date: Tue, 22 Dec 2015 14:51:00 +0000 From: "Daniel P. Berrange" Message-ID: <20151222145059.GD10082@redhat.com> References: <1450359915-14889-1-git-send-email-berrange@redhat.com> <1450359915-14889-5-git-send-email-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PULL v1 4/9] io: add QIOChannelSocket class Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers On Tue, Dec 22, 2015 at 02:44:00PM +0000, Peter Maydell wrote: > On 17 December 2015 at 13:45, Daniel P. Berrange wrote: > > Implement a QIOChannel subclass that supports sockets I/O. > > The implementation is able to manage a single socket file > > descriptor, whether a TCP/UNIX listener, TCP/UNIX connection, > > or a UDP datagram. It provides APIs which can listen and > > connect either asynchronously or synchronously. Since there > > is no asynchronous DNS lookup API available, it uses the > > QIOTask helper for spawning a background thread to ensure > > non-blocking operation. > > (There's GNU adns for async DNS lookups, but I guess we don't > really want the extra dependency.) > > > +static void test_io_channel_ipv4(bool async) > > +{ > > + SocketAddress *listen_addr = g_new0(SocketAddress, 1); > > + SocketAddress *connect_addr = g_new0(SocketAddress, 1); > > + > > + listen_addr->type = SOCKET_ADDRESS_KIND_INET; > > + listen_addr->u.inet = g_new0(InetSocketAddress, 1); > > + listen_addr->u.inet->host = g_strdup("0.0.0.0"); > > + listen_addr->u.inet->port = NULL; /* Auto-select */ > > + > > + connect_addr->type = SOCKET_ADDRESS_KIND_INET; > > + connect_addr->u.inet = g_new0(InetSocketAddress, 1); > > + connect_addr->u.inet->host = g_strdup("127.0.0.1"); > > + connect_addr->u.inet->port = NULL; /* Filled in later */ > > Does this test program really need to create a listening > socket on the host's external interface? Anybody could > connect to it, which means half this test code is suddenly > a security boundary... Pretty sure we can switch that 0.0.0.0 to also be 127.0.0.1. I'll double check and send a patch if it works. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|