+ if v.proto == '4' then
+ uci:foreach("network", "interface",function(vif)
+ if vif.ipaddr and vif.ipaddr == v.localIP then
+ interface = vif['.name'] or vif.interface
+ lmac = string.lower(vif.macaddr or "")
+ return
+ end
+ end)
+ for _, arpt in ipairs(arptable) do
+ ip = arpt['IP address']
+ if ip == v.remoteIP then
+ rmac = string.lower(arpt['HW address'] or "")
+ end
+ end
+ for _, val in ipairs(assoclist) do
+ if val.network == interface and val.list then
+ for assocmac, assot in pairs(val.list) do
+ assocmac = string.lower(assocmac or "")
+ if rmac == assocmac then
+ signal = tonumber(assot.signal)
+ noise = tonumber(assot.noise)
+ snr = signal/noise
+ end
+ end
+ end
+ end
+ elseif v.proto == '6' then
+ uci:foreach("network", "interface",function(vif)
+ if vif.ip6addr and string.gsub(vif.ip6addr, "/64", "") == v.localIP then
+ interface = vif['.name'] or vif.interface
+ return
+ end
+ end)
+ end
+ if interface then
+ v.interface = interface
+ end
+ v.snr = snr
+ v.signal = signal
+ v.noise = noise
+ if rmac then
+ v.remoteMAC = rmac
+ end
+ if lmac then
+ v.localMAC = lmac
+ end
+