aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-09 15:34:00 +0200
committerKim Alvefur <zash@zash.se>2018-06-09 15:34:00 +0200
commit5ae35f54cc69163c9d0c0f3e9bb40b07542af9c0 (patch)
tree79008f7714ac6ce48c09ea79ed0de668d61f61fb /net
parentfb63de9331f4fb1c50e11b2f1bcbaab53209f45f (diff)
downloadprosody-5ae35f54cc69163c9d0c0f3e9bb40b07542af9c0.tar.gz
prosody-5ae35f54cc69163c9d0c0f3e9bb40b07542af9c0.zip
net.dns: Syntesize type names for the full range
Otherwise unknown records are identified as A records. This also fixes various tracebacks unearthed by previous commits and mis-identified records. Related to #1056 #976 #819
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 8a7d4e7a..0d2cce01 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -86,9 +86,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;
@@ -119,8 +120,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);