[前][次][番号順一覧][スレッド一覧]

ruby-changes:32898

From: nagachika <ko1@a...>
Date: Sun, 16 Feb 2014 00:01:45 +0900 (JST)
Subject: [ruby-changes:32898] nagachika:r44977 (ruby_2_0_0): merge revision(s) r44880: [Backport #9477]

nagachika	2014-02-16 00:01:40 +0900 (Sun, 16 Feb 2014)

  New Revision: 44977

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44977

  Log:
    merge revision(s) r44880: [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_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/resolv.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 44976)
+++ ruby_2_0_0/ChangeLog	(revision 44977)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sun Feb 16 00:01:16 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 15 23:58:31 2014  Tanaka Akira  <akr@f...>
 
 	* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
Index: ruby_2_0_0/lib/resolv.rb
===================================================================
--- ruby_2_0_0/lib/resolv.rb	(revision 44976)
+++ ruby_2_0_0/lib/resolv.rb	(revision 44977)
@@ -515,8 +515,9 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L515
           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
@@ -725,7 +726,11 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L726
               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)
@@ -740,11 +745,12 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L745
         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
@@ -765,6 +771,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L771
           attr_reader :data
 
           def send
+            raise "@sock is nil." if @sock.nil?
             @sock.send(@msg, 0, @host, @port)
           end
         end
@@ -808,6 +815,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L815
 
         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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 44976)
+++ ruby_2_0_0/version.h	(revision 44977)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2014-02-15"
-#define RUBY_PATCHLEVEL 411
+#define RUBY_RELEASE_DATE "2014-02-16"
+#define RUBY_PATCHLEVEL 412
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
 
 #include "ruby/version.h"
 

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44880


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]