LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@subsignal.org>
+Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
p.description = translate("You need to install \"comgt\" for UMTS/GPRS, \"ppp-mod-pppoe\" for PPPoE, \"ppp-mod-pppoa\" for PPPoA or \"pptp\" for PPtP support")
end
+auto = s:taboption("physical", Flag, "auto", translate("Bring up on boot"))
+auto.default = (m.uci:get("network", arg[1], "proto") == "none") and auto.disabled or auto.enabled
+
br = s:taboption("physical", Flag, "type", translate("Bridge interfaces"), translate("creates a bridge over specified interface(s)"))
br.enabled = "bridge"
br.rmempty = true
if has_dnsmasq and net:proto() == "static" then
m2 = Map("dhcp", "", "")
+
+ local section_id
function m2.on_parse()
- local has_section = false
-
m2.uci:foreach("dhcp", "dhcp", function(s)
if s.interface == arg[1] then
- has_section = true
+ section_id = s['.name']
return false
end
end)
- if not has_section then
- m2.uci:section("dhcp", "dhcp", nil, { interface = arg[1], ignore = "1" })
- m2.uci:save("dhcp")
+ if not section_id then
+ local c = 1
+ section_id = arg[1]
+ while m2.uci:get("dhcp", section_id) do
+ section_id = arg[1] .. c
+ c = c + 1
+ end
end
end
s:tab("general", translate("General Setup"))
s:tab("advanced", translate("Advanced Settings"))
- function s.filter(self, section)
- return m2.uci:get("dhcp", section, "interface") == arg[1]
+ function s.cfgsections(self)
+ return { section_id }
end
local ignore = s:taboption("general", Flag, "ignore",
"this interface."))
ignore.rmempty = false
+ ignore.default = ignore.enabled
+
+ function ignore.write(self, section, value)
+ if m2.uci:get("dhcp", section) ~= "dhcp" then
+ m2.uci:section("dhcp", "dhcp", section, {
+ interface = arg[1]
+ })
+ end
+ m2.uci:set("dhcp", section, "ignore", (value == "1") and "1" or "0")
+ end
+
local start = s:taboption("general", Value, "start", translate("Start"),
translate("Lowest leased address as offset from the network address."))
translate("Define additional DHCP options, for example \"<code>6,192.168.2.1," ..
"192.168.2.2</code>\" which advertises different DNS servers to clients."))
+
for i, n in ipairs(s.children) do
if n ~= ignore then
n:depends("ignore", "")