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

ruby-changes:32870

From: usa <ko1@a...>
Date: Fri, 14 Feb 2014 15:56:58 +0900 (JST)
Subject: [ruby-changes:32870] usa:r44949 (ruby_1_9_3): merge revision(s) 44880: [Backport #9477]

usa	2014-02-14 15:56:54 +0900 (Fri, 14 Feb 2014)

  New Revision: 44949

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

  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_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/lib/resolv.rb
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 44948)
+++ ruby_1_9_3/ChangeLog	(revision 44949)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Fri Feb 14 15:56:27 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]
+
 Fri Feb 14 15:54:57 2014  Tanaka Akira  <akr@f...>
 
 	* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
Index: ruby_1_9_3/lib/resolv.rb
===================================================================
--- ruby_1_9_3/lib/resolv.rb	(revision 44948)
+++ ruby_1_9_3/lib/resolv.rb	(revision 44949)
@@ -500,8 +500,9 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/resolv.rb#L500
           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
@@ -707,7 +708,11 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/resolv.rb#L708
               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)
@@ -722,11 +727,12 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/resolv.rb#L727
         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
@@ -747,6 +753,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/resolv.rb#L753
           attr_reader :data
 
           def send
+            raise "@sock is nil." if @sock.nil?
             @sock.send(@msg, 0, @host, @port)
           end
         end
@@ -790,6 +797,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/resolv.rb#L797
 
         class Sender < Requester::Sender # :nodoc:
           def send
+            raise "@sock is nil." if @sock.nil?
             @sock.send(@msg, 0)
           end
           attr_reader :data
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44948)
+++ ruby_1_9_3/version.h	(revision 44949)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 529
+#define RUBY_PATCHLEVEL 530
 
 #define RUBY_RELEASE_DATE "2014-02-14"
 #define RUBY_RELEASE_YEAR 2014

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


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

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