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")
18 m = Map("dhcp", "DHCP")
20 s = m:section(TypedSection, "dhcp", "")
24 iface = s:option(ListValue, "interface", translate("interface"))
25 luci.tools.webadmin.cbi_add_networks(iface)
27 luci.model.uci.foreach("network", "interface",
29 if section[".name"] ~= "loopback" then
30 iface.default = iface.default or section[".name"]
31 s:depends("interface", section[".name"])
35 luci.model.uci.foreach("network", "alias",
37 iface:value(section[".name"])
38 s:depends("interface", section[".name"])
41 s:option(Value, "start", translate("start")).rmempty = true
43 s:option(Value, "limit", translate("limit")).rmempty = true
45 s:option(Value, "leasetime").rmempty = true
47 s:option(Flag, "dynamicdhcp").rmempty = true
49 s:option(Value, "name", translate("name")).optional = true
51 ignore = s:option(Flag, "ignore")
52 ignore.optional = true
54 s:option(Value, "netmask", translate("netmask")).optional = true
56 s:option(Flag, "force").optional = true
58 for i, line in pairs(luci.util.execl("dnsmasq --help dhcp")) do
59 k, v = line:match("([^ ]+) +([^ ]+)")
60 s:option(Value, "dhcp"..k, v).optional = true
64 for i, n in ipairs(s.children) do
65 if n ~= iface and n ~= ignore then
66 n:depends("ignore", "")