net.unbound: Show canonical name in textual format (e.g. in shell)
authorKim Alvefur <zash@zash.se>
Sun, 14 Apr 2024 14:06:57 +0200
changeset 13483 d1b7edf4e2de
parent 13482 fe7557cf31a6
child 13484 3027c2634a44
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
--- a/net/unbound.lua	Mon Apr 08 16:44:11 2024 +0200
+++ b/net/unbound.lua	Sun Apr 14 14:06:57 2024 +0200
@@ -80,8 +80,12 @@
 			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;