aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xapt-panopticon.lua32
1 files 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)
173end 173end
174 174
175local IP = {} 175local IP = {}
176gatherIPs = function (host) 176gatherIPs = function (host, again)
177 if nil == again then again = '' end
177 if nil == IP[host] then 178 if nil == IP[host] then
178 local IPs 179 local IPs
179 -- Takes about 30 seconds to look up the lot. 180 -- Takes about 30 seconds to look up the lot.
@@ -188,10 +189,24 @@ gatherIPs = function (host)
188 IP[k][v] = t 189 IP[k][v] = t
189 D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) 190 D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v)
190 if t == "CNAME" then 191 if t == "CNAME" then
191 gatherIPs(v) 192 if "" == v then
192 IP[k][v] = IP[v] 193 if '' ~= again then
194 print("Empty host name! DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v)
195 else
196 return gatherIPs(host, '@9.9.9.11')
197 end
198 else
199 gatherIPs(v)
200 IP[k][v] = IP[v]
201 end
193 elseif v == "SRV" then 202 elseif v == "SRV" then
194 print("SVR record found, now what do we do?") 203 print("SVR record found, now what do we do?")
204 elseif "" == v then
205 if '' ~= again then
206 print("Empty host name! DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v)
207 else
208 return gatherIPs(host, '@9.9.9.11')
209 end
195 end 210 end
196 end 211 end
197 end 212 end
@@ -201,6 +216,9 @@ gatherIPs = function (host)
201 if host == APT.options.roundRobin.value then 216 if host == APT.options.roundRobin.value then
202 for k, m in pairs(APT.mirrors) do 217 for k, m in pairs(APT.mirrors) do
203 if ("yes" == m.DNSRR) or ("maybe" == m.DNSRR) then 218 if ("yes" == m.DNSRR) or ("maybe" == m.DNSRR) then
219 if "" == m.FQDN then
220 print("Empty FQDN name! " .. host)
221 end
204 gatherIPs(m.FQDN) 222 gatherIPs(m.FQDN)
205 IP[host][m.FQDN] = IP[m.FQDN] 223 IP[host][m.FQDN] = IP[m.FQDN]
206 -- Strip them out so we don't test them twice. 224 -- Strip them out so we don't test them twice.
@@ -778,6 +796,7 @@ local parsePackages = function(host)
778 local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed', "w+") 796 local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed', "w+")
779 if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed' .. ' file - ' .. e) else 797 if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages.parsed' .. ' file - ' .. e) else
780 local pp = {} 798 local pp = {}
799-- TODO - FIX - check if this file exists first.
781 for l in io.lines('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages') do 800 for l in io.lines('results/' .. host .. '/merged/dists/'.. n .. dir .. 'Packages') do
782 if "Package: " == l:sub(1, 9) then 801 if "Package: " == l:sub(1, 9) then
783 if 0 ~= #pp then 802 if 0 ~= #pp then
@@ -1090,7 +1109,12 @@ if 0 < #arg then
1090 I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) 1109 I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", "))
1091 APT.mirrors = loadfile("results/mirrors.lua")() 1110 APT.mirrors = loadfile("results/mirrors.lua")()
1092 APT.results = APT.padResults(APT.results) 1111 APT.results = APT.padResults(APT.results)
1093 if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end 1112 if APT.origin or APT.redir then
1113 if "" == pu.host then
1114 print("Empty pu.host name! " .. pu.host)
1115 end
1116 APT.results["IPs"] = gatherIPs(pu.host)
1117 end
1094 if nil ~= arg[2] then I(" &nbsp; Using IP " .. arg[2]); ip = arg[2] end 1118 if nil ~= arg[2] then I(" &nbsp; Using IP " .. arg[2]); ip = arg[2] end
1095 if nil ~= arg[3] then I(" &nbsp; Using file " .. arg[3]); end 1119 if nil ~= arg[3] then I(" &nbsp; Using file " .. arg[3]); end
1096 1120