From 040207ea01a0219d22b294e8c77faec5e235cb4a Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 24 Jul 2012 03:09:32 +0000 Subject: Show nd6 options and whether the packet is reached to the server or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_socket.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'test/socket') diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 98d9531a60..659ebabba3 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -309,6 +309,7 @@ class TestSocket < Test::Unit::TestCase Socket.udp_server_sockets(0) {|sockets| famlies = {} sockets.each {|s| famlies[s.local_address.afamily] = s } + nd6 = {} ip_addrs.reject! {|ai| s = famlies[ai.afamily] next true unless s @@ -330,7 +331,9 @@ class TestSocket < Test::Unit::TestCase 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 + flag = in6_ondireq.unpack('A16L6').last + next true if flag & ulND6_IFF_IFDISABLED != 0 + nd6[ai] = flag end when /darwin/ if !ai.ipv6? @@ -345,7 +348,9 @@ class TestSocket < Test::Unit::TestCase 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 + flag = in6_ondireq.unpack('A16L6').last + next true if (flag & ulND6_IFF_IFDISABLED) != 0 + nd6[ai] = flag 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 @@ -356,25 +361,30 @@ class TestSocket < Test::Unit::TestCase end end end + false } skipped = false begin port = sockets.first.local_address.ip_port + ping_p = false th = Thread.new { Socket.udp_server_loop_on(sockets) {|msg, msg_src| break if msg == "exit" rmsg = Marshal.dump([msg, msg_src.remote_address, msg_src.local_address]) + ping_p = true msg_src.reply rmsg } } ip_addrs.each {|ai| Addrinfo.udp(ai.ip_address, port).connect {|s| + ping_p = false msg1 = "<<<#{ai.inspect}>>>" s.sendmsg msg1 unless IO.select([s], nil, nil, 10) - raise "no response from #{ai.inspect}" + nd6options = nd6.key?(ai) ? "nd6=%x " % nd6[ai] : '' + raise "no response from #{ai.inspect} #{nd6options}ping=#{ping_p}" end msg2, addr = s.recvmsg msg2, remote_address, local_address = Marshal.load(msg2) -- cgit v1.2.3