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

ruby-changes:23560

From: naruse <ko1@a...>
Date: Thu, 10 May 2012 17:31:02 +0900 (JST)
Subject: [ruby-changes:23560] naruse:r35611 (trunk): skip addresses whose interface is set as POINTOPOINT.

naruse	2012-05-10 17:29:33 +0900 (Thu, 10 May 2012)

  New Revision: 35611

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

  Log:
    skip addresses whose interface is set as POINTOPOINT.

  Modified files:
    trunk/test/socket/test_socket.rb

Index: test/socket/test_socket.rb
===================================================================
--- test/socket/test_socket.rb	(revision 35610)
+++ test/socket/test_socket.rb	(revision 35611)
@@ -305,6 +305,7 @@
       skip "Socket.ip_address_list not implemented"
     end
 
+    ifconfig = nil
     Socket.udp_server_sockets(0) {|sockets|
       famlies = {}
       sockets.each {|s| famlies[s.local_address.afamily] = s }
@@ -327,10 +328,17 @@
             # 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
+            in6_ondireq = ifr_name
+            s.ioctl(ulSIOCGIFINFO_IN6, in6_ondireq)
+            next true if in6_ondireq.unpack('A16L6').last[bIFDISABLED-1] == 1
           end
+        when /darwin/
+          if ai.ipv6?
+            ifconfig ||= `ifconfig`
+            next true if ifconfig.scan(/^(\w+):(.*(?:\n\t.*)*)/).find do|ifname, value|
+              value.include?(ai.ip_address) && value.include?('POINTOPOINT')
+            end
+          end
         end
       }
       skipped = false

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

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