From fe8fc1dee06b74217d5a025707720553dd2a2368 Mon Sep 17 00:00:00 2001
From: onefang
Date: Fri, 17 Dec 2021 14:58:46 +1000
Subject: Don't hard code deb.roundr.devuan.org all over the place, and check
the results.
Coz it got changed to deb.rr.devuan.org.
---
apt-panopticommon.lua | 6 ++++++
apt-panopticon-report-email-web.lua | 35 +++++++++++++++++++----------------
apt-panopticon.lua | 7 ++++---
3 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index f2a7fee..3e2dc08 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -53,6 +53,12 @@ APT.options =
help = "The round robin DNS name.",
value = "deb.devuan.org",
},
+ roundRobinCname =
+ {
+ typ = "string",
+ help = "The round robin DNS name.",
+ value = "deb.rr.devuan.org",
+ },
tests =
{
typ = "table",
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index d6c866d..73e0338 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -18,11 +18,13 @@ APT.debians = loadfile("results/debians.lua")()
local revDNS = function(hosts, dom, IP)
if APT.options.roundRobin.value ~= dom then
if nil ~= hosts[APT.options.roundRobin.value] then
- if nil ~= hosts[APT.options.roundRobin.value].IPs["deb.roundr.devuan.org"][IP] then
- if APT.html then
- return "DNS-RR"
- else
- return "DNS-RR"
+ if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname] then
+ if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname][IP] then
+ if APT.html then
+ return "DNS-RR"
+ else
+ return "DNS-RR"
+ end
end
end
end
@@ -201,15 +203,17 @@ local DNSrrTest = function(hosts, k)
if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) and (nil ~= hosts[k].IPs) then
APT.allpairs(hosts[k].IPs,
function(i, w, k, v)
- if nil ~= hosts[APT.options.roundRobin.value].IPs["deb.roundr.devuan.org"][i] then
- local log = logCount(APT.options.roundRobin.value, i)
- if "" ~= log then
- if "" == dns then dns = " " else dns = dns .. space end
- dns = dns .. logCount(APT.options.roundRobin.value, i)
- else
- if "" == dns then dns = " " else dns = dns .. space end
- if APT.html then i = "" .. i .. "" end
- dns = dns .. i
+ if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname] then
+ if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname][i] then
+ local log = logCount(APT.options.roundRobin.value, i)
+ if "" ~= log then
+ if "" == dns then dns = " " else dns = dns .. space end
+ dns = dns .. logCount(APT.options.roundRobin.value, i)
+ else
+ if "" == dns then dns = " " else dns = dns .. space end
+ if APT.html then i = "" .. i .. "" end
+ dns = dns .. i
+ end
end
end
end
@@ -360,9 +364,8 @@ local makeIPlist = function(hosts)
if nil ~= hosts[k].IPs then
for l, w in pairs(hosts[k].IPs) do
if type(w) == "table" then
--- TODO - don't hard code deb.roundr.devuan.org.
-- Don't output the extra DNS-RR entries that are for admin reasons.
- if ((APT.options.roundRobin.value == k) and ("deb.roundr.devuan.org" == l)) or (APT.options.roundRobin.value ~= k) then
+ if ((APT.options.roundRobin.value == k) and (APT.options.roundRobinCname == l)) or (APT.options.roundRobin.value ~= k) then
n[l] = {}
for i, u in pairs(w) do
if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index a524260..1a00fc7 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -199,11 +199,11 @@ gatherIPs = function (host)
gatherIPs(m.FQDN)
IP[host][m.FQDN] = IP[m.FQDN]
-- Strip them out so we don't test them twice.
- if nil ~= IP[m.FQDN] then
+ if (nil ~= IP[m.FQDN]) and (nil ~= IP[host][APT.options.roundRobinCname]) 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
+ for j, o in pairs(IP[host][APT.options.roundRobinCname]) do
if h == j then IP[host][m.FQDN][l][h] = nil end
end
o = 0
@@ -211,7 +211,7 @@ gatherIPs = function (host)
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
+ for j, o in pairs(IP[host][APT.options.roundRobinCname]) do
if l == j then IP[host][m.FQDN][l] = nil end
end
end
@@ -1009,6 +1009,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to devuan.bio.lmu.de (141.84.43.19) port 80 (#0)
curl: (22) The requested URL returned error: 404 Not Found
]]
+ local trace = {}
local min, max, spd = 999999999999, 0
local num = '[%d%.]+[kM]?'
if APT.checkFile(f) then
--
cgit v1.1