Project

General

Profile

Actions

Bug #12112

closed

Resolv.getname with IPv6 noop

Added by helge000 (Daniel Helgenberger) about 8 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.3 - 2.2.1
[ruby-core:73994]

Description

Currently reverse resolving IPv6 addresses using stdlib Resolv does not work.

How reproducible

always

Steps:

  1. Require 'resolv'
  2. Use #getname or #getnames with a valid, reverse resolvable IPv6 address

Result:

resolv error with #getname, empty result using #getnames

Expected result:

Resolved to hostname as with IPv4

Example, system:

dig @8.8.8.8 +short -x 2a00:1450:4001:803::1018                                                                           
fra07s30-in-x18.1e100.net.

ruby:

[1] pry(main)> require 'resolv'
=> false
[2] pry(main)> resolver = Resolv::DNS.new(:nameserver => '8.8.8.8')
#[...]
[3] pry(main)> resolver.getname('2a00:1450:4001:803::1018')
Resolv::ResolvError: no name for 2a00:1450:4001:803::1018
from ~/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/resolv.rb:128:in `getname'
[4] pry(main)> resolver.getnames('2a00:1450:4001:803::1018')
=> []

Files

12112_fixes_ipv6_ptr_resolver.patch (846 Bytes) 12112_fixes_ipv6_ptr_resolver.patch wb (Dmitri Dolguikh), 02/26/2016 02:09 PM

Updated by wb (Dmitri Dolguikh) about 8 years ago

I'm seeing this issue on 2.0.0, 2.2.1, 2.2.2, but not 1.9.3 and 2.2.3 (I suspect all versions between 2.0.0 and 2.2.3 are broken).

This is due to how Resolv::IPv6#to_name and Resolv::Name.initialize work. In 2.2.3 Resolv::Name constructor was changed to convert labels to Resolv::Label::Str. Before that any comparison beween instances of Resolv::Name constructed from a string via Resolv::Name.create and Resolv::Name.new would fail. 1.9.3 is a bit different, as it's implementation of Resolv::Name.== converts labels to a string for the comparison.

Patch for ruby_2_0_0 branch attached.

Updated by shyouhei (Shyouhei Urabe) about 8 years ago

  • Status changed from Open to Assigned
  • Assignee set to akr (Akira Tanaka)
Actions #3

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0