-local function arplist(opt)
- local _, e, mac, ip, name
- local arp = { }
-
- for _, e in ipairs(luci.sys.net.arptable()) do
- arp[e["HW address"]:upper()] = { e["IP address"] }
- end
-
- if fs.access("/etc/ethers") then
- for e in io.lines("/etc/ethers") do
- mac, ip = e:match("^([a-f0-9]%S+) (%S+)")
- if mac and ip then arp[mac:upper()] = { ip } end
- end
- end
-
- if fs.access("/var/dhcp.leases") then
- for e in io.lines("/var/dhcp.leases") do
- mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)")
- if mac and ip then arp[mac:upper()] = { ip, name ~= "*" and name } end
- end
- end
-
- for mac, e in luci.util.kspairs(arp) do
- opt:value(mac, "%s (%s)" %{ mac, e[2] or e[1] })
- end
-end
-