summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-01-20 17:27:51 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-01-20 17:27:51 +0100
commitdf7ab69ebaef870ecb82effd27f0b9958f1c203d (patch)
tree0f202b2fb38e903d55f11a5f46b563d59a64ccc7 /modules/luci-base/luasrc
parent258836441babd7939b7e13a4abd19502b922928d (diff)
luci-base: luci.sys.net: use luci.ip.neighbors() instead of /proc/net/arp
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/sys.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index 5d203aa8f8..a1b5b8f645 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -168,14 +168,13 @@ local function _nethints(what, callback)
end
end
- if fs.access("/proc/net/arp") then
- for e in io.lines("/proc/net/arp") do
- ip, mac = e:match("^([%d%.]+)%s+%S+%s+%S+%s+([a-fA-F0-9:]+)%s+")
- if ip and mac then
- _add(what, mac:upper(), ip, nil, nil)
- end
+ luci.ip.neighbors(nil, function(neigh)
+ if neigh.mac and neigh.family == 4 then
+ _add(what, neigh.mac:upper(), neigh.dest:string(), nil, nil)
+ elseif neigh.mac and neigh.family == 6 then
+ _add(what, neigh.mac:upper(), nil, neigh.dest:string(), nil)
end
- end
+ end)
if fs.access("/etc/ethers") then
for e in io.lines("/etc/ethers") do