Project

General

Profile

Actions

Bug #12494

closed

win32/resolv.rb may add outdated nameservers

Added by valentyn (Valentijn Sessink) over 8 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:76041]

Description

When using Ruby on Windows, the Resolv class may use outdated nameservers without notice.

This is due to the fact that win32/resolv.rb walks the Registry and adds nameservers from all interfaces, including the ones that have a link down status. Code:

reg.open('Interfaces') do |reg|
reg.each_key do |iface,|
reg.open(iface) do |regif|
begin
[ 'NameServer', 'DhcpNameServer' ].each do |key|
ns = regif.read_s(key)
unless ns.empty?
nameserver.concat(ns.split(/[,\s]\s*/))

When interface 1 has 8.8.8.8 for DhcpNameServer but the interface is down, and interface 2 has 10.something for nameserver, then still 8.8.8.8 will be queried by Resolv.


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #12604: Win32::Resolv.get_resolv_info returns unavailable DNS serversClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0