From 0197902953556d46f4c67f7d0ad1a31bb2ea116a Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 21 Nov 2021 03:38:14 +1000 Subject: Don't crash if a DNS-RR mirror fails to resolve. --- apt-panopticon.lua | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 06a051e..a524260 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -199,24 +199,26 @@ gatherIPs = function (host) gatherIPs(m.FQDN) IP[host][m.FQDN] = IP[m.FQDN] -- Strip them out so we don't test them twice. - for l, n in pairs(IP[m.FQDN]) do - if type(n) == 'table' then - for h, p in pairs(n) do + if nil ~= IP[m.FQDN] then + for l, n in pairs(IP[m.FQDN]) do + if type(n) == 'table' then + for h, p in pairs(n) do + for j, o in pairs(IP[host]['deb.roundr.devuan.org']) do + if h == j then IP[host][m.FQDN][l][h] = nil end + end + o = 0 + for j in pairs(IP[host][m.FQDN][l]) do o = o + 1 end + if 0 == o then IP[host][m.FQDN][l] = nil end + end + else for j, o in pairs(IP[host]['deb.roundr.devuan.org']) do - if h == j then IP[host][m.FQDN][l][h] = nil end + if l == j then IP[host][m.FQDN][l] = nil end end - o = 0 - for j in pairs(IP[host][m.FQDN][l]) do o = o + 1 end - if 0 == o then IP[host][m.FQDN][l] = nil end - end - else - for j, o in pairs(IP[host]['deb.roundr.devuan.org']) do - if l == j then IP[host][m.FQDN][l] = nil end end + o = 0 + for j in pairs(IP[host][m.FQDN]) do o = o + 1 end + if 0 == o then IP[host][m.FQDN] = nil end end - o = 0 - for j in pairs(IP[host][m.FQDN]) do o = o + 1 end - if 0 == o then IP[host][m.FQDN] = nil end end end end -- cgit v1.1