From: v@... Date: 2016-06-15T18:18:33+00:00 Subject: [ruby-core:76041] [Ruby trunk Bug#12494] win32/resolv.rb may add outdated nameservers Issue #12494 has been reported by Valentijn Sessink. ---------------------------------------- Bug #12494: win32/resolv.rb may add outdated nameservers https://bugs.ruby-lang.org/issues/12494 * Author: Valentijn Sessink * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- 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. -- https://bugs.ruby-lang.org/ Unsubscribe: