From 7eb6e562e51c06e5ef8aad841b5542aebe246f01 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 8 May 2010 01:13:33 +0000 Subject: [PATCH] * ext/socket/lib/socket.rb (BasicSocket#connect_address): MacOS X 10.6 returns "::ffff:a.b.c.d" for IPv4-mapped IPv6 address. [ruby-dev:41215] patch by Tomoyuki Chikanaga. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/socket/lib/socket.rb | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd7376e17e..f59c13fa96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat May 8 10:03:39 2010 Tanaka Akira + + * ext/socket/lib/socket.rb (BasicSocket#connect_address): MacOS X 10.6 + returns "::ffff:a.b.c.d" for IPv4-mapped IPv6 address. + [ruby-dev:41215] patch by Tomoyuki Chikanaga. + Fri May 7 23:51:39 2010 Nobuyoshi Nakada * version.h: bump up to 1.9.3. diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index 0f26c3efc5..a568b6026f 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -192,6 +192,8 @@ class BasicSocket < IO 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) + elsif addr.ip_address == "::ffff:0.0.0.0" # MacOS X 10.6 returns "::ffff: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 == ""