summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-14 07:46:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-14 07:46:02 +0000
commit3e972bbaba4291ab0b22349a90d63cdcf035b5b3 (patch)
tree5589e4713e71f59d9bd2c35edc62051b33c859a2 /test/socket
parent45f6cdcdd3d11de1bf7691f732bc967880b4caad (diff)
Check IFDISABLED on Mac OS X.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_socket.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb
index 0406e2205b..df482f7f9a 100644
--- a/test/socket/test_socket.rb
+++ b/test/socket/test_socket.rb
@@ -327,13 +327,27 @@ class TestSocket < Test::Unit::TestCase
# 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')