Project

General

Profile

Bug #12604

Win32::Resolv.get_resolv_info returns unavailable DNS servers

Added by larsch (Lars Christensen) over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
[ruby-core:76478]

Description

Win32::Resolv.get_resolv_info returns a list of IP address that include DNS server for network devices that are not connected, causing long timeouts when using Resolv::DNS (or Rubygems which uses Resolv::DNS)

Win32::Resolv scans the registry for DNS server addresses. Unfortunatly, if some of your network devices are not currently connected, the old DNS information is still stored in registry. So get_resolv_info still returns it. This can cause very long timeouts when using Resolv::DNS (e.g. rubygems). For example, a simple 'gem install' on my machine would take over a minute, because of several timeouts waiting for DNS.

Example:

irb(main):024:0> Win32::Resolv.get_resolv_info
=> [["mynet", "mycompany.local", "local"], ["192.168.1.1", "172.27.0.1", "8.8.8.8", "8.8.4.4", "192.168.101.10", "192.168.101.11"]]
  • 192.168.1.1 is the DNS server from my home Wifi (not currently connected)
  • 172.27.0.1 is the DNS server from a router I had connected via an USB Ethernet Device a week ago
  • 8.8.8.8 is from the same as above (but incidentally works, since it is available)
  • 192.168.101.10+11 are the actual current DNS server

I think a solution could be to rely on GetAdapterAddresses() in the Win32 API instead to get the IP address of DNS server.

As a workaround for users affected by this is to remove unconnected Interfaces from HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces in the registry.


Related issues

Is duplicate of Ruby master - Bug #12494: win32/resolv.rb may add outdated nameserversClosedActions
#1

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Is duplicate of Bug #12494: win32/resolv.rb may add outdated nameservers added

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)

Maybe, does GetNetworkParams() work?

#4

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset r55781.


win32/resolv: get_dns_server_list

  • ext/win32/resolv/resolv.c (get_dns_server_list): [Win32] get DNS servers only for connected network devices by GetNetworkParams API. [Bug #12604]

Updated by usa (Usaku NAKAMURA) about 4 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r57571 merged revision(s) 55781,55783.

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED

I reverted r57571 at r57626. r57571 broke RubyCI on vc12-x64.
http://13.78.52.201/vc12-x64/ruby-2.3/log/20170207T182419Z.log.html.gz
I cannot have time to see in details to fix it just now, I temporarily reverted it.

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

r57629 is also need to be backported.

Also available in: Atom PDF