Project

General

Profile

Actions

Backport #11144

closed

Backport 49095 into ruby 2.1

Added by mxposed (Nikolay Markov) almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Assignee:
-
[ruby-core:69151]

Description

Right now resolv cannot resolve IPv6 address to hostname in ruby 2.1

markov@cauth01:~$ ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux-gnu]


markov@cauth01:~$ host 2a02:6b8::11
1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.6.0.2.0.a.2.ip6.arpa domain name pointer yandex.ru.`


markov@cauth01:~$ cat test.rb 
#!/usr/bin/ruby

require 'resolv'
Resolv.getname('2a02:6b8::11')


markov@cauth01:~$ ./test.rb 
/usr/lib/ruby/2.1.0/resolv.rb`128:in `getname': no name for 2a02:6b8::11 (Resolv::ResolvError)
	from /usr/lib/ruby/2.1.0/resolv.rb:64:in `getname'
	from ./test.rb:5:in `<main>'

This is because Resolv::IPv6#to_name (https://bugs.ruby-lang.org/projects/ruby-21/repository/entry/lib/resolv.rb#L2506) creates Resolv::DNS::Name with an array of strings, however other instances are created with an array of Resolv::Label::Str.
This behaviour is fixed in commit https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/49095 where labels of Resolv::DNS::Name are normalized, but this commit is not backported to ruby 2.1

However backporting this https://bugs.ruby-lang.org/projects/ruby-21/repository/revisions/49775 introduced the issue

Actions

Also available in: Atom PDF

Like0
Like0Like0