-
Notifications
You must be signed in to change notification settings - Fork 41
Description
@ioquatix I just ran into this the other day and tried to run Resolv.getaddress on bin/rails c within the dev same environment as @trevorturk.
Loading development environment (Rails 7.0.4.3)
irb(main):001:0> Resolv.getaddress "google.com"
=> "74.125.136.100"
I can also help with repros if needed.
I put a binding.irb in the resolv.rb exception site and got this:
irb(#<Resolv::DNS::Requester::UnconnectedUDP:0x000000010685e970>):004:0> Addrinfo.ip(host).ip_address
/Users/olivierlacan/.rbenv/versions/3.2.2/lib/ruby/3.2.0/resolv.rb:4:in `ip': getaddrinfo: nodename nor servname provided, or not known (SocketError)
from /Users/olivierlacan/.rbenv/versions/3.2.2/lib/ruby/3.2.0/resolv.rb:4:in `sender'
from <internal:prelude>:5:in `irb'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:770:in `sender'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:527:in `block in fetch_resource'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1126:in `block (3 levels) in resolv'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1124:in `each'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1124:in `block (2 levels) in resolv'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1123:in `each'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1123:in `block in resolv'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1121:in `each'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:1121:in `resolv'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:521:in `fetch_resource'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:507:in `each_resource'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:402:in `each_address'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:116:in `block in each_address'
from 3.2.2/lib/ruby/3.2.0/resolv.rb:115:in `each'
... 30 levels...
irb(#<Resolv::DNS::Requester::UnconnectedUDP:0x000000010685e970>):005:0> host
=> "fe80::887:c7ff:fe62:d64%en0"
I have a feeling something about this %en0 (network interface?!) in the ipv6 DNS hostname is not happy. Removing it works fine.
Addrinfo.ip("fe80::887:c7ff:fe62:d64").ip_address
=> "fe80::887:c7ff:fe62:d64"
Edit: I can also confirm that this %en0 seemingly gets added when I'm tethering to an AT&T device from macOS since it is listed as such in resolv.conf:
cat /etc/resolv.conf
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
# scutil --dns
#
# SEE ALSO
# dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver fe80::887:c7ff:fe62:d64%en0
nameserver 172.20.10.1
But this isn't shown in the macOS networking settings if you look at DNS servers:
AFAIK en0 in macOS parlance is an identifier for Wi-Fi network interface as this shows:
$ networksetup -listallhardwareports | grep -C 2 en0
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: f0:2f:5b:01:23:b8
It seems like Resolv is choking on this identifier when it likely should be entirely ignored. Might have to file a Ruby bug report for this.
Originally posted by @olivierlacan in socketry/async-http#107 (comment)
