aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-09 15:47:59 +0200
committerKim Alvefur <zash@zash.se>2018-06-09 15:47:59 +0200
commit5795398aa09a9b1233b8322ec5350d5a7b439576 (patch)
tree2012e72c749814da4062b2a5dd0ff6b7725f5aa9
parent40a8bf5766ce4ebca9edaf38c53cadff0451f559 (diff)
parent28aad3d6909fb864af2b2ea1bd2fcb541aeff17a (diff)
downloadprosody-5795398aa09a9b1233b8322ec5350d5a7b439576.tar.gz
prosody-5795398aa09a9b1233b8322ec5350d5a7b439576.zip
Merge 0.10->trunk
-rw-r--r--net/dns.lua17
-rw-r--r--plugins/mod_s2s/s2sout.lib.lua2
2 files changed, 12 insertions, 7 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 08f5b121..83d7ad1e 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -88,9 +88,10 @@ local function highbyte(i) -- - - - - - - - - - - - - - - - - - - highbyte
end
-local function augment (t) -- - - - - - - - - - - - - - - - - - - - augment
+local function augment (t, prefix) -- - - - - - - - - - - - - - - - - augment
local a = {};
- for i,s in pairs(t) do
+ for i = 1, 0xffff do
+ local s = t[i] or ("%s%d"):format(prefix, i);
a[i] = s;
a[s] = s;
a[string.lower(s)] = s;
@@ -121,8 +122,8 @@ dns.types = {
dns.classes = { 'IN', 'CS', 'CH', 'HS', [255] = '*' };
-dns.type = augment (dns.types);
-dns.class = augment (dns.classes);
+dns.type = augment (dns.types, "TYPE");
+dns.class = augment (dns.classes, "CLASS");
dns.typecode = encode (dns.types);
dns.classcode = encode (dns.classes);
@@ -686,7 +687,7 @@ function resolver:remember(rr, type) -- - - - - - - - - - - - - - remember
self.cache = self.cache or setmetatable({}, cache_metatable);
local rrs = get(self.cache, qclass, type, qname) or
set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable));
- if not rrs[rr[qtype:lower()]] then
+ if rr[qtype:lower()] and not rrs[rr[qtype:lower()]] then
rrs[rr[qtype:lower()]] = true;
append(rrs, rr);
end
@@ -903,7 +904,11 @@ function resolver:feed(sock, packet, force)
--self.print(response);
for _, rr in pairs(response.answer) do
- self:remember(rr, response.question[1].type);
+ self:remember(rr, rr.type);
+ end
+
+ for _, rr in pairs(response.additional) do
+ self:remember(rr, rr.type);
end
-- retire the query
diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua
index a13eb8c9..038d84a5 100644
--- a/plugins/mod_s2s/s2sout.lib.lua
+++ b/plugins/mod_s2s/s2sout.lib.lua
@@ -30,7 +30,6 @@ local sources = {};
local has_ipv4, has_ipv6;
local dns_timeout = module:get_option_number("dns_timeout", 15);
-dns.settimeout(dns_timeout);
local resolvers = module:get_option_set("s2s_dns_resolvers")
local s2sout = {};
@@ -51,6 +50,7 @@ function s2sout.initiate_connection(host_session)
host_session.version = 1;
host_session.resolver = adns.resolver();
+ host_session.resolver._resolver:settimeout(dns_timeout);
if resolvers then
for resolver in resolvers do
host_session.resolver._resolver:addnameserver(resolver);