X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fhosts.lua;h=46945af58b3e695391e70fd6268d72bd663b6375;hp=fafacf35c571d9b52cbec88218357d4944b5ee4f;hb=28e3b328545529c19429ce88c7d1769e64e2de0f;hpb=dfba318140e1a84359e221b7a9154337595dbded diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua index fafacf35c..46945af58 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/hosts.lua @@ -3,6 +3,7 @@ -- Licensed to the public under the Apache License 2.0. local ipc = require "luci.ip" +local sys = require "luci.sys" m = Map("dhcp", translate("Hostnames")) @@ -19,9 +20,11 @@ ip = s:option(Value, "ip", translate("IP address")) ip.datatype = "ipaddr" ip.rmempty = true -ipc.neighbors({ }, function(n) - if n.mac and n.dest and not n.dest:is6linklocal() then - ip:value(n.dest:string(), "%s (%s)" %{ n.dest:string(), n.mac }) +sys.net.host_hints(function(mac, v4, v6, name) + v6 = v6 and ipc.IPv6(v6) + + if v4 or (v6 and not v6:is6linklocal()) then + ip:value(tostring(v4 or v6), "%s (%s)" %{ tostring(v4 or v6), name or mac }) end end)