From: sean@... Date: 2019-12-07T02:35:25+00:00 Subject: [ruby-core:96138] [Ruby master Feature#14922] Resolv getaddresses ignores AAAA records for IPv6 Issue #14922 has been updated by sean@duke.edu (Sean Dilda). I was recently bit by this as well. The documentation at https://ruby-doc.org/stdlib-2.6.5/libdoc/resolv/rdoc/Resolv/DNS.html 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. The current behavior makes sense for something like TCPSocket.new, but not when the devloper is actively querying DNS outside of opening a socket. While I consider it a bug, I would welcome the proposed patch as a fix along with updated documentation. ---------------------------------------- Feature #14922: Resolv getaddresses ignores AAAA records for IPv6 https://bugs.ruby-lang.org/issues/14922#change-83007 * Author: dlampa (Donovan Lampa) * Status: Assigned * Priority: Normal * Assignee: akr (Akira Tanaka) * Target version: ---------------------------------------- I'd like some feedback here as I'm not totally convinced this is a bug quite yet. I may have done something silly with my DNS configuration. I have a local DNS server set up with the following /etc/resolv.conf ~~~ [root@ip-10-20-0-181 ~]# cat /etc/resolv.conf # Generated by NetworkManager search us-east-2.compute.internal nameserver ::1 ~~~ And the following zone configured in bind ~~~ [root@ip-10-20-0-181 ~]# cat /var/named/test.net.zone $TTL 86400 @ IN SOA test.net root.test.net ( 2016050204 3600 900 604800 86400 ) @ IN NS testbox testbox IN AAAA 2600:1f16:a82:9b01:5a89:f06f:dde4:7b5e malware IN AAAA 2600:1f16:a82:9b01:cab2:a7c0:e2cb:1162 goodware IN A 10.20.0.181 ~~~ It appears that Resolv needs me to explicitly request the AAAA resource for malware.test.net in order to get the IPv6 address in this situation. It doesn't seem to need that for IPv4. ~~~ irb(main):001:0> require 'resolv' => true irb(main):002:0> resolver = Resolv.new => #, @initialized=nil>, #, @config=#, @config_info=nil, @initialized=nil, @timeouts=nil>, @initialized=nil>]> irb(main):003:0> resolver.getaddresses("malware.test.net") => [] irb(main):004:0> resolver.getaddresses("goodware.test.net") => ["10.20.0.181"] irb(main):005:0> dns_resolver = Resolv::DNS.new => #, @config=#, @config_info=nil, @initialized=nil, @timeouts=nil>, @initialized=nil> irb(main):006:0> dns_resolver.getresource("malware.test.net", Resolv::DNS::Resource::IN::AAAA) => #, @ttl=86400> ~~~ Based on Resolv's documentation I would expect to get back the IPv6 address for malware.test.net ---Files-------------------------------- resolv-use_ipv6-14922.patch (2.08 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: