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
ifname_single.widget = "radio"
ifname_single.nobridges = true
ifname_single.network = arg[1]
-ifname_single.rmempty = true
ifname_single:depends({ type = "", proto = "static" })
ifname_single:depends({ type = "", proto = "dhcp" })
ifname_single:depends({ type = "", proto = "pppoe" })
ifname_single:depends({ type = "", proto = "none" })
function ifname_single.cfgvalue(self, s)
- return self.map.uci:get("network", s, "ifname")
+ -- let the template figure out the related ifaces through the network model
+ return nil
end
function ifname_single.write(self, s, val)
end
end
+function ifname_single.remove(self, s)
+ self:write(s, "")
+end
+
+
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
ifname_multi.template = "cbi/network_ifacelist"
ifname_multi.nobridges = true
ifname_multi:depends("type", "bridge")
ifname_multi.cfgvalue = ifname_single.cfgvalue
ifname_multi.write = ifname_single.write
+ifname_multi.remove = ifname_single.remove
if has_firewall then
if has_dnsmasq and net:proto() == "static" then
m2 = Map("dhcp", "", "")
- local section_id = "-"
-
+ local section_id
function m2.on_parse()
m2.uci:foreach("dhcp", "dhcp", function(s)
if s.interface == arg[1] then
return false
end
end)
+
+ 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 = m2:section(TypedSection, "dhcp", translate("DHCP Server"))
"this interface."))
ignore.rmempty = false
-
- function ignore.cfgvalue(self, section)
- return (section == "-") and self.enabled or Flag.cfgvalue(self, section)
- end
+ ignore.default = ignore.enabled
function ignore.write(self, section, value)
- section_id = m2.uci:section("dhcp", "dhcp", nil, {
- ignore = value,
- interface = arg[1]
- })
- end
+ 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"),
"192.168.2.2</code>\" which advertises different DNS servers to clients."))
- local function write_opt(self, section, value)
- return getmetatable(self).__index.write(self, section_id, value)
- end
-
- local function remove_opt(self, section, value)
- return getmetatable(self).__index.remove(self, section_id, value)
- end
-
for i, n in ipairs(s.children) do
if n ~= ignore then
n:depends("ignore", "")
- n.write = write_opt
- n.remove = remove_opt
end
end
end