2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 require("luci.tools.webadmin")
15 require("luci.model.uci")
19 m = Map("dhcp", "DHCP")
21 s = m:section(TypedSection, "dhcp", "")
25 iface = s:option(ListValue, "interface", translate("interface"))
26 luci.tools.webadmin.cbi_add_networks(iface)
28 luci.model.uci.foreach("network", "interface",
30 if section[".name"] ~= "loopback" then
31 iface.default = iface.default or section[".name"]
32 s:depends("interface", section[".name"])
36 luci.model.uci.foreach("network", "alias",
38 iface:value(section[".name"])
39 s:depends("interface", section[".name"])
42 s:option(Value, "start", translate("start")).rmempty = true
44 s:option(Value, "limit", translate("limit")).rmempty = true
46 s:option(Value, "leasetime").rmempty = true
48 s:option(Flag, "dynamicdhcp").rmempty = true
50 s:option(Value, "name", translate("name")).optional = true
52 ignore = s:option(Flag, "ignore")
53 ignore.optional = true
55 s:option(Value, "netmask", translate("netmask")).optional = true
57 s:option(Flag, "force").optional = true
59 for i, line in pairs(luci.util.execl("dnsmasq --help dhcp")) do
60 k, v = line:match("([^ ]+) +([^ ]+)")
61 s:option(Value, "dhcp"..k, v).optional = true
65 for i, n in ipairs(s.children) do
66 if n ~= iface and n ~= ignore then
67 n:depends("ignore", "")
72 m2 = Map("luci_ethers", translate("luci_ethers"))
74 s = m2:section(TypedSection, "static_lease", "")
77 s.template = "cbi/tblsection"
79 mac = s:option(Value, "macaddr", translate("macaddress"))
80 ip = s:option(Value, "ipaddr", translate("ipaddress"))
81 for i, dataset in ipairs(luci.sys.net.arptable()) do
82 ip:value(dataset["IP address"])
83 mac:value(dataset["HW address"],
84 dataset["HW address"] .. " (" .. dataset["IP address"] .. ")")