Bug #2734: UnconnectedUDP in resolv.rb does not handle IPv6
http://redmine.ruby-lang.org/issues/show/2734

Author: Hans de Graaff
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]

Unlike the ConnectedUDP class, UnconnectedUDP does not have an option or mechanism to create an IPv6 socket. A specific case where this is needed is when a system has only IPv6 name servers in its resolv.conf. This leads to the following backtrace:

/usr/lib64/ruby/1.8/resolv.rb:685:in `send': Address family not supported by protocol - sendto(2) (Errno::EAFNOSUPPORT)
	from /usr/lib64/ruby/1.8/resolv.rb:685:in `send'
	from /usr/lib64/ruby/1.8/resolv.rb:612:in `request'
	from /usr/lib64/ruby/1.8/resolv.rb:489:in `each_resource'
	from /usr/lib64/ruby/1.8/resolv.rb:939:in `resolv'
	from /usr/lib64/ruby/1.8/resolv.rb:937:in `each'
	from /usr/lib64/ruby/1.8/resolv.rb:937:in `resolv'
	from /usr/lib64/ruby/1.8/resolv.rb:936:in `each'
	from /usr/lib64/ruby/1.8/resolv.rb:936:in `resolv'
	from /usr/lib64/ruby/1.8/resolv.rb:934:in `each'
	from /usr/lib64/ruby/1.8/resolv.rb:934:in `resolv'
	from /usr/lib64/ruby/1.8/resolv.rb:481:in `each_resource'
	from /usr/lib64/ruby/1.8/resolv.rb:468:in `getresources'
	from /usr/lib64/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:50:in `connect'
	from /usr/lib64/ruby/1.8/resolv.rb:307:in `open'
	from /usr/lib64/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:46:in `connect'


Changing the UnconnectedUDP code to use an IPv6 socket unconditionally works fine in this case, but obviously that is not a solution in a situation where IPv4 connectivity may also be needed.


----------------------------------------
http://redmine.ruby-lang.org