Commits

Anonymous committed 8f56663
  • Participants
  • Parent commits 30ef2ff

Comments (0)

Files changed (2)

modules/IO-Socket-INET6/ChangeLog

+	* Applied a modified patch to t/io_multihomed6.t to correct the test
+	on Fedora 10 and others:
+		- https://rt.cpan.org/Public/Bug/Display.html?id=57676
+
+2010-05-20 Shlomi Fish <shlomif@iglu.org.il>
 	* Solved "problems with multihomed and family order"
 		- https://rt.cpan.org/Ticket/Display.html?id=57676
 		- Thanks to Steffen Ullrich

modules/IO-Socket-INET6/t/io_multihomed6.t

     }
 }
 
+# check that localhost resolves to 127.0.0.1 and ::1
+# otherwise the test will not work
+use Socket;
+use Socket6;
+
+{
+    my %resolved_addresses;
+    my @r = getaddrinfo('localhost',1);
+    while (@r) {
+        my @values = splice(@r,0,5);
+        my ($fam,$addr) = @values[0,3];
+        $addr = 
+        (
+              ($fam == AF_INET)
+            ? ( (unpack_sockaddr_in($addr))[1]  )
+            : ( (unpack_sockaddr_in6($addr))[1] )
+        );
+        $resolved_addresses{inet_ntop($fam,$addr)}++;
+    }
+    if (! $resolved_addresses{'127.0.0.1'} || ! $resolved_addresses{'::1'}) {
+        print "1..0 # SKIP localhost does not resolve to both 127.0.0.1 and ::1\n";
+        exit 0;
+    }
+}
+
 use IO::Socket::INET6;
 
 $| = 1;