Changeset

1713:252afc358000

net.dns: Automatically add nameserver 127.0.0.1 if /etc/resolv.conf missing or empty on a non-Windows system (thanks Louis Mamakos)
author Matthew Wild <mwild1@gmail.com>
date Tue, 18 Aug 2009 13:47:21 +0100
parents 1712:45a81d6d8777
children 1714:f05a29356269 1716:3f7fd1445d02
files net/dns.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Tue Aug 18 13:03:35 2009 +0100
+++ b/net/dns.lua	Tue Aug 18 13:47:21 2009 +0100
@@ -509,9 +509,12 @@
 		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