From 701b2afa3c290c85563b66fced29e967f8450a42 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sun, 22 Jan 2023 18:15:42 -0800 Subject: [PATCH] Refresh LQM's hostname periodically --- files/usr/local/bin/mgr/lqm.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/files/usr/local/bin/mgr/lqm.lua b/files/usr/local/bin/mgr/lqm.lua index 40fdee39..64147f51 100755 --- a/files/usr/local/bin/mgr/lqm.lua +++ b/files/usr/local/bin/mgr/lqm.lua @@ -501,6 +501,12 @@ function lqm() dtdlinks[track.mac] = {} track.exposed = false + -- Refresh the hostname periodically as it can change + local hostname = nixio.getnameinfo(track.ip) + if hostname then + track.hostname = canonical_hostname(hostname) + end + local raw = io.popen("/usr/bin/curl --retry 0 --connect-timeout " .. connect_timeout .. " --speed-time " .. speed_time .. " --speed-limit " .. speed_limit .. " -s \"http://" .. track.ip .. ":8080/cgi-bin/sysinfo.json?link_info=1&lqm=1\" -o - 2> /dev/null") local info = luci.jsonc.parse(raw:read("*a")) raw:close()