aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2010-03-12 18:41:05 +0100
committerTobias Markmann <tm@ayena.de>2010-03-12 18:41:05 +0100
commitb05ccd7b3affed026faf4b492d91af972f5ae8ac (patch)
tree9dd7b38690fed8b235977def984797ba62ac50c7 /net/dns.lua
parent3a972b1742c28b7ef9cb5f76ed3bc69f752b5899 (diff)
parent456cd9c62a173637f18d2c613e3514919369ad90 (diff)
downloadprosody-b05ccd7b3affed026faf4b492d91af972f5ae8ac.tar.gz
prosody-b05ccd7b3affed026faf4b492d91af972f5ae8ac.zip
Merge with tip.
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/dns.lua b/net/dns.lua
index ca5f3c62..8855cc61 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -532,14 +532,19 @@ function resolver:adddefaultnameservers() -- - - - - adddefaultnameservers
if not self.server or #self.server == 0 then
-- TODO log warning about no nameservers, adding opendns servers as fallback
self:addnameserver("208.67.222.222");
- self:addnameserver("208.67.220.220") ;
+ self:addnameserver("208.67.220.220");
end
else -- posix
local resolv_conf = io.open("/etc/resolv.conf");
if resolv_conf then
for line in resolv_conf:lines() do
- local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$');
- if address then self:addnameserver(address) end
+ line = line:gsub("#.*$", "")
+ :match('^%s*nameserver%s+(.*)%s*$');
+ if line then
+ line:gsub("%f[%d.](%d+%.%d+%.%d+%.%d+)%f[^%d.]", function (address)
+ self:addnameserver(address)
+ end);
+ end
end
end
if not self.server or #self.server == 0 then
@@ -796,7 +801,7 @@ function resolver:feed(sock, packet)
set(self.wanted, q.class, q.type, q.name, nil);
end
end
- end
+ end
return response;
end