Software /
code /
prosody
Changeset
8901:eae606b9266c
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
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 09 Jun 2018 15:34:00 +0200 |
parents | 8900:fcf42bd7d067 |
children | 8902:ac21f13798ae 8904:faca839ddbbb |
files | net/dns.lua |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Sat Jun 09 15:35:03 2018 +0200 +++ b/net/dns.lua Sat Jun 09 15:34:00 2018 +0200 @@ -86,9 +86,10 @@ 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.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);