-if zones and #zones == 0 then
- m:chain("firewall")
-
- fwzone = s:option(Value, "_fwzone",
- translate("network_interface_fwzone"),
- translate("network_interface_fwzone_desc"))
- fwzone.rmempty = true
- fwzone:value("", "- " .. translate("none") .. " -")
- fwzone:value(arg[1])
- luci.model.uci.foreach("firewall", "zone",
- function (section)
- fwzone:value(section.name)
- end
- )
-
- function fwzone.write(self, section, value)
- local zone = luci.tools.webadmin.firewall_find_zone(value)
- local stat
-
- if not zone then
- stat = luci.model.uci.section("firewall", "zone", nil, {
- name = value,
- network = section
- })
- else
- local net = luci.model.uci.get("firewall", zone, "network")
- net = (net or value) .. " " .. section
- stat = luci.model.uci.set("firewall", zone, "network", net)
- end
-
- if stat then
- self.render = function() end
+if zones then
+ if #zones == 0 then
+ m:chain("firewall")
+
+ fwzone = s:option(Value, "_fwzone",
+ translate("network_interface_fwzone"),
+ translate("network_interface_fwzone_desc"))
+ fwzone.rmempty = true
+ fwzone:value("", "- " .. translate("none") .. " -")
+ fwzone:value(arg[1])
+ m.uci:load("firewall")
+ m.uci:foreach("firewall", "zone",
+ function (section)
+ fwzone:value(section.name)
+ end
+ )
+
+ function fwzone.write(self, section, value)
+ local zone = luci.tools.webadmin.firewall_find_zone(value)
+ local stat
+
+ if not zone then
+ stat = m.uci:section("firewall", "zone", nil, {
+ name = value,
+ network = section
+ })
+ else
+ local net = m.uci:get("firewall", zone, "network")
+ net = (net or value) .. " " .. section
+ stat = m.uci:set("firewall", zone, "network", net)
+ end
+
+ if stat then
+ self.render = function() end
+ end