From f4cb387adc12f3d19e01d251b0417ac5cdfcd78b Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 18 Oct 2022 10:39:36 +1000 Subject: Work around broken DNS by trying again @9.9.9.11. --- apt-panopticon.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index bf9d9a7..93eca85 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -173,7 +173,8 @@ local repoExists = function (r) end local IP = {} -gatherIPs = function (host) +gatherIPs = function (host, again) + if nil == again then again = '' end if nil == IP[host] then local IPs -- Takes about 30 seconds to look up the lot. @@ -188,10 +189,24 @@ gatherIPs = function (host) IP[k][v] = t D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) if t == "CNAME" then - gatherIPs(v) - IP[k][v] = IP[v] + if "" == v then + if '' ~= again then + print("Empty host name! DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) + else + return gatherIPs(host, '@9.9.9.11') + end + else + gatherIPs(v) + IP[k][v] = IP[v] + end elseif v == "SRV" then print("SVR record found, now what do we do?") + elseif "" == v then + if '' ~= again then + print("Empty host name! DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) + else + return gatherIPs(host, '@9.9.9.11') + end end end end @@ -201,6 +216,9 @@ gatherIPs = function (host) if host == APT.options.roundRobin.value then for k, m in pairs(APT.mirrors) do if ("yes" == m.DNSRR) or ("maybe" == m.DNSRR) then + if "" == m.FQDN then + print("Empty FQDN name! " .. host) + end gatherIPs(m.FQDN) IP[host][m.FQDN] = IP[m.FQDN] -- Strip them out so we don't test them twice. @@ -778,6 +796,7 @@ local parsePackages = function(host) local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed', "w+") if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed' .. ' file - ' .. e) else local pp = {} +-- TODO - FIX - check if this file exists first. for l in io.lines('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages') do if "Package: " == l:sub(1, 9) then if 0 ~= #pp then @@ -1090,7 +1109,12 @@ if 0 < #arg then I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) APT.mirrors = loadfile("results/mirrors.lua")() APT.results = APT.padResults(APT.results) - if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end + if APT.origin or APT.redir then + if "" == pu.host then + print("Empty pu.host name! " .. pu.host) + end + APT.results["IPs"] = gatherIPs(pu.host) + end if nil ~= arg[2] then I("   Using IP " .. arg[2]); ip = arg[2] end if nil ~= arg[3] then I("   Using file " .. arg[3]); end -- cgit v1.1