From eefcc888dc4479aad54bbf710b9e5768666c072a Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 1 Feb 2023 22:38:17 -0800 Subject: [PATCH] Filter out non-routable ARP entries which confuse LQM --- files/usr/local/bin/mgr/lqm.lua | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/files/usr/local/bin/mgr/lqm.lua b/files/usr/local/bin/mgr/lqm.lua index 2735884a..238e8f6b 100755 --- a/files/usr/local/bin/mgr/lqm.lua +++ b/files/usr/local/bin/mgr/lqm.lua @@ -362,18 +362,22 @@ function lqm() for mac, entry in pairs(arps) do if entry.Device:match("%.2$") or entry.Device:match("^br%-dtdlink") then - stations[#stations + 1] = { - type = "DtD", - device = entry.Device, - signal = nil, - ip = entry["IP address"], - mac = mac:upper(), - tx_packets = 0, - tx_fail = 0, - tx_retries = 0, - tx_bitrate = 0, - rx_bitrate = 0 - } + -- Sometimes we find arp entries are not routable. Filter them out early. + local rt = ip.route(entry["IP address"]) + if rt and tostring(rt.gw) == entry["IP address"] then + stations[#stations + 1] = { + type = "DtD", + device = entry.Device, + signal = nil, + ip = entry["IP address"], + mac = mac:upper(), + tx_packets = 0, + tx_fail = 0, + tx_retries = 0, + tx_bitrate = 0, + rx_bitrate = 0 + } + end end end