ruby-changes:24462
From: naruse <ko1@a...>
Date: Tue, 24 Jul 2012 12:09:43 +0900 (JST)
Subject: [ruby-changes:24462] naruse:r36513 (trunk): Show nd6 options and whether the packet is reached to the server or not.
naruse 2012-07-24 12:09:32 +0900 (Tue, 24 Jul 2012) New Revision: 36513 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36513 Log: Show nd6 options and whether the packet is reached to the server or not. Modified files: trunk/test/socket/test_socket.rb Index: test/socket/test_socket.rb =================================================================== --- test/socket/test_socket.rb (revision 36512) +++ test/socket/test_socket.rb (revision 36513) @@ -309,6 +309,7 @@ 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 @@ 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 @@ 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 @@ 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/