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

ruby-changes:23594

From: naruse <ko1@a...>
Date: Mon, 14 May 2012 16:46:11 +0900 (JST)
Subject: [ruby-changes:23594] naruse:r35645 (trunk): Check IFDISABLED on Mac OS X.

naruse	2012-05-14 16:46:02 +0900 (Mon, 14 May 2012)

  New Revision: 35645

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

  Log:
    Check IFDISABLED on Mac OS X.

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

Index: test/socket/test_socket.rb
===================================================================
--- test/socket/test_socket.rb	(revision 35644)
+++ test/socket/test_socket.rb	(revision 35645)
@@ -327,13 +327,27 @@
             # global IPv6 address.
             # Link-local IPv6 addresses on those interfaces don't work.
             ulSIOCGIFINFO_IN6 = 3225971052
-            bIFDISABLED = 4
+            ulND6_IFF_IFDISABLED = 8
             in6_ondireq = ifr_name
             s.ioctl(ulSIOCGIFINFO_IN6, in6_ondireq)
-            next true if in6_ondireq.unpack('A16L6').last[bIFDISABLED-1] == 1
+            next true if in6_ondireq.unpack('A16L6').last & ulND6_IFF_IFDISABLED != 0
           end
         when /darwin/
-          if ai.ipv6?
+          if !ai.ipv6?
+          elsif ifr_name = ai.ip_address[/%(.*)/, 1]
+            # Mac OS X may sets IFDISABLED as FreeBSD does
+            ulSIOCGIFFLAGS = 3223349521
+            ulSIOCGIFINFO_IN6 = 3224398156
+            ulSIOCGIFAFLAG_IN6 = 3240126793
+            ulIFF_POINTOPOINT = 0x10
+            ulND6_IFF_IFDISABLED = 8
+            in6_ondireq = ifr_name
+            s.ioctl(ulSIOCGIFINFO_IN6, in6_ondireq)
+            next true if in6_ondireq.unpack('A16L6').last & ulND6_IFF_IFDISABLED != 0
+            in6_ifreq = [ifr_name,ai.to_sockaddr].pack('a16A*')
+            s.ioctl(ulSIOCGIFFLAGS, in6_ifreq)
+            next true if in6_ifreq.unpack('A16L1').last & ulIFF_POINTOPOINT != 0
+          else
             ifconfig ||= `/sbin/ifconfig`
             next true if ifconfig.scan(/^(\w+):(.*(?:\n\t.*)*)/).find do|ifname, value|
               value.include?(ai.ip_address) && value.include?('POINTOPOINT')

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

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