https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112018-07-24T19:22:40ZRuby Issue Tracking SystemRuby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=731052018-07-24T19:22:40Zeviljoel (evil joel)
<ul></ul><p>Greetings. I work behind Donovan (this bug's reporter) and am also dealing with this same issue. I tracked down the source of this behavior by looking through the Ruby resolv.rb source code. Apparently the DefaultResolver only resolves IPv6 addresses if the interpreter's machine has been assigned a public IPv6 address. Machines configured with loopback or link-local IPv6 addresses will default to not resolving IPv6 addresses. To see the code in question, search for use_ipv6 in <a href="https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb" class="external">https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb</a> .</p>
<p>This behavior is causing us problems testing on an IPv6 test network using link-local addresses. Our test network also has a test DNS server which resolves hostnames to link-local IPv6 addresses. While this is only a test network, a similar network configuration could potentially show up at one of our client sites and we would like to be able to resolve IPv6 addresses without writing IPv6 specific resolution code. Also, other Ruby users might setup similar IPv6 test networks and encounter this inconsistent behavior.</p>
<p>I understand why this IPv6 resolution behavior is desirable for the vast majority of Ruby users. However, there should be a way to override this behavior for those who desire full IPv6 functionality equivalent to IPv4 functionality. I recommend that the default resolution behavior be overridden in two ways:</p>
<ol>
<li>Add a RUBYOPT option named --assume-ipv6 to force full IPv6 support.</li>
<li>Add a config_info parameter to the Resolv constructor. Have it take a boolean option named :assumeipv6.</li>
</ol>
<p>Also, please add documentation to <a href="https://ruby-doc.org/stdlib-2.5.1/libdoc/resolv/rdoc/Resolv.html" class="external">https://ruby-doc.org/stdlib-2.5.1/libdoc/resolv/rdoc/Resolv.html</a> explaining when IPv6 addresses are resolved by default. I could not find this behavior described anywhere!</p>
<p>Thank you.</p> Ruby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=731222018-07-25T07:44:44Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>akr (Akira Tanaka)</i></li></ul><p>Mmm, I think this is a real bug.</p>
<p>RUBYOPT does not work well in this case because resolve.rb is a library while RUBYOPT is for the process. Adding parameter to the constructor is an option though.</p> Ruby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=810722019-08-27T03:38:52Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>File</strong> <a href="/attachments/8022">resolv-use_ipv6-14922.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/8022/resolv-use_ipv6-14922.patch">resolv-use_ipv6-14922.patch</a> added</li><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Feature</i></li><li><strong>ruby -v</strong> deleted (<del><i>2.5.1</i></del>)</li><li><strong>Backport</strong> deleted (<del><i>2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN</i></del>)</li></ul><p>I think this is not a bug, but a feature request for IPv6 resolution when no public IPv6 address is present. I think you can only consider this a bug if you think the default behavior should be to return IPv6 addresses in such cases.</p>
<p>I think this is a worthwhile feature to add. Attached is a patch that implements it using a keyword argument to <code>Resolv#initialize</code>:</p>
<pre><code>$ ruby -rresolv -e 'p Resolv.new.getaddresses("google.com")'
["216.58.195.78"]
$ ruby -rresolv -e 'p Resolv.new(:use_ipv6=>true).getaddresses("google.com")'
["216.58.195.78", "2607:f8b0:4005:807::200e"]
</code></pre> Ruby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=830072019-12-07T02:35:25Zsean@duke.edu (Sean Dilda)
<ul></ul><p>I was recently bit by this as well. The documentation at <a href="https://ruby-doc.org/stdlib-2.6.5/libdoc/resolv/rdoc/Resolv/DNS.html" class="external">https://ruby-doc.org/stdlib-2.6.5/libdoc/resolv/rdoc/Resolv/DNS.html</a> clearly states that getaddresses will return IPv6 addresses, but doesn't list any conditions. Based on this I'd say the code is not following the documented behavior.</p>
<p>The current behavior makes sense for something like TCPSocket.new, but not when the devloper is actively querying DNS outside of opening a socket.</p>
<p>While I consider it a bug, I would welcome the proposed patch as a fix along with updated documentation.</p> Ruby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=884652020-11-13T04:01:18Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>I've submitted my patch as a pull request: <a href="https://github.com/ruby/resolv/pull/1" class="external">https://github.com/ruby/resolv/pull/1</a></p> Ruby master - Feature #14922: Resolv getaddresses ignores AAAA records for IPv6https://bugs.ruby-lang.org/issues/14922?journal_id=1054072023-11-24T22:13:21Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul>