ruby-changes:33031
From: naruse <ko1@a...>
Date: Sat, 22 Feb 2014 14:20:49 +0900 (JST)
Subject: [ruby-changes:33031] naruse:r45110 (ruby_2_1): merge revision(s) 44880: [Backport #9477]
naruse 2014-02-22 14:20:38 +0900 (Sat, 22 Feb 2014) New Revision: 45110 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45110 Log: merge revision(s) 44880: [Backport #9477] * lib/resolv.rb: Ignore name servers which cause EAFNOSUPPORT on socket creation. Reported by Bjoern Rennhak. [ruby-core:60442] [Bug #9477] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/lib/resolv.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 45109) +++ ruby_2_1/ChangeLog (revision 45110) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Sat Feb 22 14:18:35 2014 Tanaka Akira <akr@f...> + + * lib/resolv.rb: Ignore name servers which cause EAFNOSUPPORT on + socket creation. + Reported by Bjoern Rennhak. [ruby-core:60442] [Bug #9477] + Sat Feb 22 14:07:04 2014 Tanaka Akira <akr@f...> * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise Index: ruby_2_1/lib/resolv.rb =================================================================== --- ruby_2_1/lib/resolv.rb (revision 45109) +++ ruby_2_1/lib/resolv.rb (revision 45110) @@ -522,8 +522,9 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/resolv.rb#L522 msg.rd = 1 msg.add_question(candidate, typeclass) unless sender = senders[[candidate, nameserver, port]] - sender = senders[[candidate, nameserver, port]] = - requester.sender(msg, candidate, nameserver, port) + sender = requester.sender(msg, candidate, nameserver, port) + next if !sender + senders[[candidate, nameserver, port]] = sender end reply, reply_name = requester.request(sender, tout) case reply.rcode @@ -741,7 +742,11 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/resolv.rb#L742 af = Socket::AF_INET end next if @socks_hash[bind_host] - sock = UDPSocket.new(af) + begin + sock = UDPSocket.new(af) + rescue Errno::EAFNOSUPPORT + next # The kernel doesn't support the address family. + end sock.do_not_reverse_lookup = true sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::F_SETFD DNS.bind_random_port(sock, bind_host) @@ -756,11 +761,12 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/resolv.rb#L761 end def sender(msg, data, host, port=Port) + sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"] + return nil if !sock service = [host, port] id = DNS.allocate_request_id(host, port) request = msg.encode request[0,2] = [id].pack('n') - sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"] return @senders[[service, id]] = Sender.new(request, data, sock, host, port) end @@ -781,6 +787,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/resolv.rb#L787 attr_reader :data def send + raise "@sock is nil." if @sock.nil? @sock.send(@msg, 0, @host, @port) end end @@ -824,6 +831,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/resolv.rb#L831 class Sender < Requester::Sender # :nodoc: def send + raise "@sock is nil." if @sock.nil? @sock.send(@msg, 0) end attr_reader :data Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 45109) +++ ruby_2_1/version.h (revision 45110) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.1" #define RUBY_RELEASE_DATE "2014-02-22" -#define RUBY_PATCHLEVEL 54 +#define RUBY_PATCHLEVEL 55 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r44880 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/