2015-01-16 22:38:38 +00:00
|
|
|
-- Copyright 2008 Steven Barth <steven@midlink.org>
|
2015-01-16 22:46:42 +00:00
|
|
|
-- Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
|
2015-01-16 22:38:38 +00:00
|
|
|
-- Licensed to the public under the Apache License 2.0.
|
2008-09-06 18:21:58 +00:00
|
|
|
|
|
|
|
require("luci.sys")
|
|
|
|
require("luci.util")
|
2010-03-08 01:18:22 +00:00
|
|
|
m = Map("dhcp", translate("Hostnames"))
|
2008-09-06 18:21:58 +00:00
|
|
|
|
2010-03-08 01:18:22 +00:00
|
|
|
s = m:section(TypedSection, "domain", translate("Host entries"))
|
2008-09-06 18:21:58 +00:00
|
|
|
s.addremove = true
|
|
|
|
s.anonymous = true
|
|
|
|
s.template = "cbi/tblsection"
|
|
|
|
|
2010-03-08 01:18:22 +00:00
|
|
|
hn = s:option(Value, "name", translate("Hostname"))
|
2011-02-22 09:52:49 +00:00
|
|
|
hn.datatype = "hostname"
|
|
|
|
hn.rmempty = true
|
|
|
|
|
2010-03-08 01:18:22 +00:00
|
|
|
ip = s:option(Value, "ip", translate("IP address"))
|
2011-02-22 09:52:49 +00:00
|
|
|
ip.datatype = "ipaddr"
|
|
|
|
ip.rmempty = true
|
|
|
|
|
2012-11-10 17:38:37 +00:00
|
|
|
local arptable = luci.sys.net.arptable() or {}
|
|
|
|
for i, dataset in ipairs(arptable) do
|
2008-09-06 18:21:58 +00:00
|
|
|
ip:value(
|
|
|
|
dataset["IP address"],
|
|
|
|
"%s (%s)" %{ dataset["IP address"], dataset["HW address"] }
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
return m
|