Project

General

Profile

Actions

Backport #11144

closed

Backport 49095 into ruby 2.1

Added by mxposed (Nikolay Markov) over 9 years ago. Updated over 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

Updated by usa (Usaku NAKAMURA) over 9 years ago

Thank you very much for your in-depth explanation, Nikolay!

memo: ruby_2_2 is also needed to fix this.

Actions #2

Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Status changed from Open to Closed

Applied in changeset r50482.


merge revision(s) 49095: [Backport #11144]

* lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
  (Resolv::DNS::Name#initialize): Normalize labels as
  Resolv::DNS::Label::Str objects.
Actions

Also available in: Atom PDF

Like0
Like0Like0