summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-mini/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-03-12 16:12:18 +0100
committerJo-Philipp Wich <jo@mein.io>2018-03-12 16:12:18 +0100
commit28e3b328545529c19429ce88c7d1769e64e2de0f (patch)
tree3d7d85d7d4d1202199bad98df125f2af88b73c86 /modules/luci-mod-admin-mini/luasrc
parentdfba318140e1a84359e221b7a9154337595dbded (diff)
treewide: unify mac address handling
Use the new luci.ip MAC address facilities to parse and verify MAC addresses in a common way, instead of relying on various ad-hoc solutions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-mini/luasrc')
-rw-r--r--modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua
index 9a1c1fea45..bcc26cd442 100644
--- a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua
+++ b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/dhcp.lua
@@ -3,7 +3,7 @@
-- Licensed to the public under the Apache License 2.0.
local uci = require "luci.model.uci".cursor()
-local ipc = require "luci.ip"
+local sys = require "luci.sys"
local wa = require "luci.tools.webadmin"
local fs = require "nixio.fs"
@@ -87,12 +87,11 @@ name = s2:option(Value, "name", translate("Hostname"))
mac = s2:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
ip = s2:option(Value, "ip", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
-ipc.neighbors({ family = 4 }, function(n)
- if n.mac and n.dest then
- ip:value(n.dest:string())
- mac:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
+sys.host_hints(function(m, v4, v6, name)
+ if m and v4 then
+ ip:value(v4)
+ mac:value(m, "%s (%s)" %{ m, name or v4 })
end
end)
return m
-