From fa96706886852a40f6b8404ffd0f3cd92a75968d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 18 Aug 2009 13:47:21 +0100 Subject: net.dns: Automatically add nameserver 127.0.0.1 if /etc/resolv.conf missing or empty on a non-Windows system (thanks Louis Mamakos) --- net/dns.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/dns.lua b/net/dns.lua index 48c08218..ccb315de 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -509,9 +509,12 @@ function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)') if address then self:addnameserver (address) end end - else -- FIXME correct for windows, using opendns nameservers for now - self:addnameserver ("208.67.222.222") - self:addnameserver ("208.67.220.220") + elseif os.getenv("WINDIR") then + self:addnameserver ("208.67.222.222") + self:addnameserver ("208.67.220.220") + end + if not self.server or #self.server == 0 then + self:addnameserver("127.0.0.1"); end end -- cgit v1.2.3