]> xenbits.xensource.com Git - people/liuw/qemu.git/commitdiff
io: bind to loopback IP addrs in test suite
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 22 Dec 2015 15:43:42 +0000 (15:43 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 22 Dec 2015 18:19:08 +0000 (18:19 +0000)
The test suite currently binds to 0.0.0.0 or ::, which covers
all interfaces of the machine. It is bad practice for test
suite to open publically accessible ports on a machine, so
switch to use loopback addrs 127.0.0.1 or ::1.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/test-io-channel-socket.c

index 194d04387820fa5857c733a46bec7a2a4b2fcf61..e76d54c3f8e7da9cfc10544a9e96c867c4bf9a2b 100644 (file)
@@ -261,7 +261,7 @@ static void test_io_channel_ipv4(bool async)
 
     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->host = g_strdup("127.0.0.1");
     listen_addr->u.inet->port = NULL; /* Auto-select */
 
     connect_addr->type = SOCKET_ADDRESS_KIND_INET;
@@ -295,7 +295,7 @@ static void test_io_channel_ipv6(bool async)
 
     listen_addr->type = SOCKET_ADDRESS_KIND_INET;
     listen_addr->u.inet = g_new0(InetSocketAddress, 1);
-    listen_addr->u.inet->host = g_strdup("::");
+    listen_addr->u.inet->host = g_strdup("::1");
     listen_addr->u.inet->port = NULL; /* Auto-select */
 
     connect_addr->type = SOCKET_ADDRESS_KIND_INET;