diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-11 10:51:22 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-11 10:51:22 +0000 |
commit | ae17f7ab7d2d4bf0c3f5b58e58a08b9be15cc792 (patch) | |
tree | 2f78da831c383b0b1b9a39f67dbf3fb99435c325 /test/rinda | |
parent | 2977c53b219b3513e2ba795aa25eadb92f5293ce (diff) |
Simplify test with Socket.getifaddrs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rinda')
-rw-r--r-- | test/rinda/test_rinda.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb index 263dbfb50d..f5881f6b16 100644 --- a/test/rinda/test_rinda.rb +++ b/test/rinda/test_rinda.rb @@ -532,14 +532,11 @@ end module RingIPv6 def prepare_ipv6(r) - Socket.ip_address_list.any? do |addrinfo| - if /%(?<ifname>\w+)\z/ =~ addrinfo.ip_address - next if /\Alo/ =~ ifname - _family, _port, _flowinfo, _addr, scope_id = - addrinfo.to_sockaddr.unpack("s!S!La16L") - r.multicast_interface = scope_id - return - end + Socket.getifaddrs.each do |ifaddr| + next unless ifaddr.addr.ipv6_linklocal? + next if ifaddr.name[0, 2] == "lo" + r.multicast_interface = ifaddr.ifindex + return end skip 'IPv6 not available' end |