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

ruby-changes:23576

From: naruse <ko1@a...>
Date: Sat, 12 May 2012 06:39:54 +0900 (JST)
Subject: [ruby-changes:23576] naruse:r35627 (ruby_1_9_3): merge revision(s) 35610:

naruse	2012-05-12 06:39:31 +0900 (Sat, 12 May 2012)

  New Revision: 35627

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

  Log:
    merge revision(s) 35610:
    
    Skip IPv6 addresses whose interface is set as IFDISABLED.
    
    FreeBSD 9.0 with default setting (ipv6_activate_all_interfaces
    is not YES) sets IFDISABLED to interfaces which don't have
    global IPv6 address.
    Link-local IPv6 addresses on those interfaces don't work.

  Modified files:
    branches/ruby_1_9_3/test/socket/test_socket.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 35626)
+++ ruby_1_9_3/version.h	(revision 35627)
@@ -1,10 +1,10 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 209
+#define RUBY_PATCHLEVEL 210
 
-#define RUBY_RELEASE_DATE "2012-05-11"
+#define RUBY_RELEASE_DATE "2012-05-12"
 #define RUBY_RELEASE_YEAR 2012
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 11
+#define RUBY_RELEASE_DAY 12
 
 #include "ruby/version.h"
 
Index: ruby_1_9_3/test/socket/test_socket.rb
===================================================================
--- ruby_1_9_3/test/socket/test_socket.rb	(revision 35626)
+++ ruby_1_9_3/test/socket/test_socket.rb	(revision 35627)
@@ -275,8 +275,32 @@
 
     Socket.udp_server_sockets(0) {|sockets|
       famlies = {}
-      sockets.each {|s| famlies[s.local_address.afamily] = true }
-      ip_addrs.reject! {|ai| !famlies[ai.afamily] }
+      sockets.each {|s| famlies[s.local_address.afamily] = s }
+      ip_addrs.reject! {|ai|
+        s = famlies[ai.afamily]
+        next true unless s
+        case RUBY_PLATFORM
+        when /linux/
+          if ai.ip_address.include?('%') and
+            (`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
+            # Cent OS 5.6 (2.6.18-238.19.1.el5xen) doesn't correctly work
+            # sendmsg with pktinfo for link-local ipv6 addresses
+            next true
+          end
+        when /freebsd/
+          if ifr_name = ai.ip_address[/%(.*)/, 1]
+            # FreeBSD 9.0 with default setting (ipv6_activate_all_interfaces
+            # is not YES) sets IFDISABLED to interfaces which don't have
+            # global IPv6 address.
+            # Link-local IPv6 addresses on those interfaces don't work.
+            ulSIOCGIFINFO_IN6 = 3225971052
+            bIFDISABLED = 4
+            in6_ifreq = ifr_name
+            s.ioctl(ulSIOCGIFINFO_IN6, in6_ifreq)
+            next true if in6_ifreq.unpack('A16L6').last[bIFDISABLED-1] == 1
+          end
+        end
+      }
       skipped = false
       begin
         port = sockets.first.local_address.ip_port
@@ -290,12 +314,6 @@
         }
 
         ip_addrs.each {|ai|
-          if /linux/ =~ RUBY_PLATFORM && ai.ip_address.include?('%') &&
-            (`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
-            # Cent OS 5.6 (2.6.18-238.19.1.el5xen) doesn't correctly work
-            # sendmsg with pktinfo for link-local ipv6 addresses
-            next
-          end
           Addrinfo.udp(ai.ip_address, port).connect {|s|
             msg1 = "<<<#{ai.inspect}>>>"
             s.sendmsg msg1

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

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