1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2010-2015 Jo-Philipp Wich <jow@openwrt.org>
3 -- Licensed to the public under the Apache License 2.0.
5 local ipc = require "luci.ip"
6 local sys = require "luci.sys"
8 m = Map("dhcp", translate("Hostnames"))
10 s = m:section(TypedSection, "domain", translate("Host entries"))
13 s.template = "cbi/tblsection"
15 hn = s:option(Value, "name", translate("Hostname"))
16 hn.datatype = "hostname"
19 ip = s:option(Value, "ip", translate("IP address"))
20 ip.datatype = "ipaddr"
23 sys.net.host_hints(function(mac, v4, v6, name)
24 v6 = v6 and ipc.IPv6(v6)
26 if v4 or (v6 and not v6:is6linklocal()) then
27 ip:value(tostring(v4 or v6), "%s (%s)" %{ tostring(v4 or v6), name or mac })