[glib] ipv6_v4mapped: force pass even if we don't speak IPv4



commit cb1876b4a7e2d1c91fcf461515d5a7933c62c6ff
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Wed Jan 9 16:29:29 2013 +0100

    ipv6_v4mapped: force pass even if we don't speak IPv4
    
    Some OS (e.g. OpenBSD) do not implement IP v4-mapped addresses. When
    this is the case, then we get a "Connection refused", so force the test
    to pass to that further tests can run.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686058

 gio/tests/socket.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/socket.c b/gio/tests/socket.c
index 9c212c8..70bed07 100644
--- a/gio/tests/socket.c
+++ b/gio/tests/socket.c
@@ -105,6 +105,12 @@ create_server (GSocketFamily family,
       fd = g_socket_get_fd (server);
       v6_only = 0;
       setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &v6_only, sizeof (v6_only));
+      if (! g_socket_speaks_ipv4 (data->server))
+        {
+          g_object_unref (data->server);
+          g_slice_free (IPTestData, data);
+          return NULL;
+        }
     }
 #endif
 
@@ -548,6 +554,12 @@ test_ipv6_v4mapped (void)
 
   data = create_server (G_SOCKET_FAMILY_IPV6, v4mapped_server_thread, TRUE);
 
+  if (data == NULL)
+    {
+      g_test_message ("Test not run: not supported by the OS");
+      return;
+    }
+
   client = g_socket_new (G_SOCKET_FAMILY_IPV4,
 			 G_SOCKET_TYPE_STREAM,
 			 G_SOCKET_PROTOCOL_DEFAULT,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]