From f29bc1c119de49b053e8bbbc0070f7f9a95bdfe0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 Apr 2024 14:06:57 +0200 Subject: net.unbound: Show canonical name in textual format (e.g. in shell) libunbound does not tell us the whole chain of CNAMEs, only the final canonical name. This is to aid in debugging since it will only be shown in the shell. --- net/unbound.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/unbound.lua b/net/unbound.lua index c3ccb9ea..176a6156 100644 --- a/net/unbound.lua +++ b/net/unbound.lua @@ -80,8 +80,12 @@ local answer_mt = { h = h .. s_format(", Bogus: %s", self.bogus); end local t = { h }; + local qname = self.canonname or self.qname; + if self.canonname then + table.insert(t, self.qname .. "\t" .. classes[self.qclass] .. "\tCNAME\t" .. self.canonname); + end for i = 1, #self do - t[i+1]=self.qname.."\t"..classes[self.qclass].."\t"..types[self.qtype].."\t"..tostring(self[i]); + table.insert(t, qname .. "\t" .. classes[self.qclass] .. "\t" .. types[self.qtype] .. "\t" .. tostring(self[i])); end local _string = t_concat(t, "\n"); self._string = _string; -- cgit v1.2.3