[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL v1 4/9] io: add QIOChannelSocket class
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PULL v1 4/9] io: add QIOChannelSocket class |
Date: |
Tue, 22 Dec 2015 14:44:00 +0000 |
On 17 December 2015 at 13:45, Daniel P. Berrange <address@hidden> 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...
(I noticed this because the firewall on my OSX box popped
up a helpful dialog asking if I really wanted to give
test-io-channel-socket full network access.)
thanks
-- PMM
- [Qemu-devel] [PULL v1 0/9] Introduce I/O channels framework, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 2/9] io: add helper module for creating watches on FDs, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 5/9] io: add QIOChannelFile class, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 1/9] io: add abstract QIOChannel classes, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 4/9] io: add QIOChannelSocket class, Daniel P. Berrange, 2015/12/17
- Re: [Qemu-devel] [PULL v1 4/9] io: add QIOChannelSocket class,
Peter Maydell <=
- [Qemu-devel] [PULL v1 3/9] io: add QIOTask class for async operations, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 7/9] io: add QIOChannelWebsock class, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 6/9] io: add QIOChannelTLS class, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 8/9] io: add QIOChannelCommand class, Daniel P. Berrange, 2015/12/17
- [Qemu-devel] [PULL v1 9/9] io: add QIOChannelBuffer class, Daniel P. Berrange, 2015/12/17
- Re: [Qemu-devel] [PULL v1 0/9] Introduce I/O channels framework, Peter Maydell, 2015/12/17