treewide: unify mac address handling
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_network / dhcp.lua
index 2acda0b..66d9942 100644 (file)
@@ -2,6 +2,7 @@
 -- Licensed to the public under the Apache License 2.0.
 
 local ipc = require "luci.ip"
+local sys = require "luci.sys"
 local o
 require "luci.util"
 
@@ -311,10 +312,10 @@ end
 
 hostid = s:option(Value, "hostid", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Suffix (hex)"))
 
-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.net.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)