mirror of https://github.com/aredn/aredn.git
Normalize the case of the macs and node names (#700)
This commit is contained in:
parent
8f4e05030e
commit
062ffb3521
|
@ -108,8 +108,7 @@ function run_snrlog()
|
||||||
local trigger_auto_distance = false
|
local trigger_auto_distance = false
|
||||||
local snrdatcache = {}
|
local snrdatcache = {}
|
||||||
for mstation in pairs(stations) do
|
for mstation in pairs(stations) do
|
||||||
local mac = mstation:lower()
|
local mac = mstation:upper()
|
||||||
local umac = mstation:upper()
|
|
||||||
|
|
||||||
snrdatcache[mac] = now
|
snrdatcache[mac] = now
|
||||||
|
|
||||||
|
@ -122,12 +121,12 @@ function run_snrlog()
|
||||||
|
|
||||||
-- improve existing filename if we can
|
-- improve existing filename if we can
|
||||||
local datafile = tmpdir.."/"..mac.."-"
|
local datafile = tmpdir.."/"..mac.."-"
|
||||||
local arp = arpcache[umac]
|
local arp = arpcache[mac]
|
||||||
if arp then
|
if arp then
|
||||||
local ip = arp["IP address"]
|
local ip = arp["IP address"]
|
||||||
local hostname = nslookup(ip)
|
local hostname = nslookup(ip)
|
||||||
if hostname then
|
if hostname then
|
||||||
datafile = datafile..hostname
|
datafile = datafile..hostname:lower()
|
||||||
elseif ip then
|
elseif ip then
|
||||||
datafile = datafile..ip
|
datafile = datafile..ip
|
||||||
end
|
end
|
||||||
|
@ -143,9 +142,9 @@ function run_snrlog()
|
||||||
trigger_auto_distance = true
|
trigger_auto_distance = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local signal = stations[umac].signal or ""
|
local signal = stations[mac].signal or ""
|
||||||
local update = true;
|
local update = true;
|
||||||
if lasttime[mac] and stations[umac].inactive >= INACTIVETIMEOUT then
|
if lasttime[mac] and stations[mac].inactive >= INACTIVETIMEOUT then
|
||||||
-- beacons expired
|
-- beacons expired
|
||||||
if nulledout[mac] == "true" then
|
if nulledout[mac] == "true" then
|
||||||
-- No need to double log inactive null's
|
-- No need to double log inactive null's
|
||||||
|
@ -170,11 +169,11 @@ function run_snrlog()
|
||||||
file_trim(datafile, MAXLINES)
|
file_trim(datafile, MAXLINES)
|
||||||
local f, err = assert(io.open(datafile, "a"),"Cannot open file ("..datafile..") for appending!")
|
local f, err = assert(io.open(datafile, "a"),"Cannot open file ("..datafile..") for appending!")
|
||||||
if f then
|
if f then
|
||||||
local noise = stations[umac].noise or ""
|
local noise = stations[mac].noise or ""
|
||||||
local tx_mcs = stations[umac].tx_mcs or -1
|
local tx_mcs = stations[mac].tx_mcs or -1
|
||||||
local tx_rate = adjust_rate((stations[umac].tx_rate) / 1000, bandwidth)
|
local tx_rate = adjust_rate((stations[mac].tx_rate) / 1000, bandwidth)
|
||||||
local rx_mcs = stations[umac].rx_mcs or -1
|
local rx_mcs = stations[mac].rx_mcs or -1
|
||||||
local rx_rate = adjust_rate((stations[umac].rx_rate) / 1000, bandwidth)
|
local rx_rate = adjust_rate((stations[mac].rx_rate) / 1000, bandwidth)
|
||||||
f:write(string.format("%s,%s,%s,%s,%s,%s,%s\n", os.date("%m/%d/%Y %H:%M:%S",os.time()), signal, noise, tx_mcs, tx_rate, rx_mcs, rx_rate))
|
f:write(string.format("%s,%s,%s,%s,%s,%s,%s\n", os.date("%m/%d/%Y %H:%M:%S",os.time()), signal, noise, tx_mcs, tx_rate, rx_mcs, rx_rate))
|
||||||
f:close()
|
f:close()
|
||||||
else
|
else
|
||||||
|
|
|
@ -275,7 +275,7 @@ end
|
||||||
local first_sel = true
|
local first_sel = true
|
||||||
for _, logfile in ipairs(snrfiles)
|
for _, logfile in ipairs(snrfiles)
|
||||||
do
|
do
|
||||||
local dmac, dname = logfile:match("^([%da-f:]+)-(.*)$")
|
local dmac, dname = logfile:match("^([%dA-F:]+)-(.*)$")
|
||||||
if dname == "" then
|
if dname == "" then
|
||||||
dname = dmac
|
dname = dmac
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue