summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/socket/lib/socket.rb2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 237ffad..1074fea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Feb 28 14:50:47 2009 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (BasicSocket#connect_address): returns ::1
+ if the address is IPv4-mapped IPv6 address for 0.0.0.0 for MacOS X.
+
Sat Feb 28 00:18:40 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/raddrinfo.c: suppress strict-aliasing warning with
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 8a5e180..8d325c9 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -190,6 +190,8 @@ class BasicSocket
raise SocketError, "unbound IPv6 socket" if addr.ip_port == 0
if addr.ip_address == "::"
addr = Addrinfo.new(["AF_INET6", addr.ip_port, nil, "::1"], addr.pfamily, addr.socktype, addr.protocol)
+ elsif addr.ip_address == "0.0.0.0" # MacOS X 10.4 returns "a.b.c.d" for IPv4-mapped IPv6 address.
+ addr = Addrinfo.new(["AF_INET6", addr.ip_port, nil, "::1"], addr.pfamily, addr.socktype, addr.protocol)
end
elsif defined?(Socket::AF_UNIX) && afamily == Socket::AF_UNIX
raise SocketError, "unbound Unix socket" if addr.unix_path == ""