merge revision(s) 35610:

Skip IPv6 addresses whose interface is set as IFDISABLED.

	FreeBSD 9.0 with default setting (ipv6_activate_all_interfaces
	is not YES) sets IFDISABLED to interfaces which don't have
	global IPv6 address.
	Link-local IPv6 addresses on those interfaces don't work.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-05-11 21:39:31 +00:00
parent 67166228c6
commit 209354c036
2 changed files with 29 additions and 11 deletions

View file

@ -275,8 +275,32 @@ class TestSocket < Test::Unit::TestCase
Socket.udp_server_sockets(0) {|sockets| Socket.udp_server_sockets(0) {|sockets|
famlies = {} famlies = {}
sockets.each {|s| famlies[s.local_address.afamily] = true } sockets.each {|s| famlies[s.local_address.afamily] = s }
ip_addrs.reject! {|ai| !famlies[ai.afamily] } ip_addrs.reject! {|ai|
s = famlies[ai.afamily]
next true unless s
case RUBY_PLATFORM
when /linux/
if ai.ip_address.include?('%') and
(`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
# Cent OS 5.6 (2.6.18-238.19.1.el5xen) doesn't correctly work
# sendmsg with pktinfo for link-local ipv6 addresses
next true
end
when /freebsd/
if ifr_name = ai.ip_address[/%(.*)/, 1]
# FreeBSD 9.0 with default setting (ipv6_activate_all_interfaces
# is not YES) sets IFDISABLED to interfaces which don't have
# global IPv6 address.
# Link-local IPv6 addresses on those interfaces don't work.
ulSIOCGIFINFO_IN6 = 3225971052
bIFDISABLED = 4
in6_ifreq = ifr_name
s.ioctl(ulSIOCGIFINFO_IN6, in6_ifreq)
next true if in6_ifreq.unpack('A16L6').last[bIFDISABLED-1] == 1
end
end
}
skipped = false skipped = false
begin begin
port = sockets.first.local_address.ip_port port = sockets.first.local_address.ip_port
@ -290,12 +314,6 @@ class TestSocket < Test::Unit::TestCase
} }
ip_addrs.each {|ai| ip_addrs.each {|ai|
if /linux/ =~ RUBY_PLATFORM && ai.ip_address.include?('%') &&
(`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
# Cent OS 5.6 (2.6.18-238.19.1.el5xen) doesn't correctly work
# sendmsg with pktinfo for link-local ipv6 addresses
next
end
Addrinfo.udp(ai.ip_address, port).connect {|s| Addrinfo.udp(ai.ip_address, port).connect {|s|
msg1 = "<<<#{ai.inspect}>>>" msg1 = "<<<#{ai.inspect}>>>"
s.sendmsg msg1 s.sendmsg msg1

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "1.9.3" #define RUBY_VERSION "1.9.3"
#define RUBY_PATCHLEVEL 209 #define RUBY_PATCHLEVEL 210
#define RUBY_RELEASE_DATE "2012-05-11" #define RUBY_RELEASE_DATE "2012-05-12"
#define RUBY_RELEASE_YEAR 2012 #define RUBY_RELEASE_YEAR 2012
#define RUBY_RELEASE_MONTH 5 #define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 11 #define RUBY_RELEASE_DAY 12
#include "ruby/version.h" #include "ruby/version.h"