modules/admin-full: adept ifaces model to changed firewall model interface
This commit is contained in:
parent
9fcd1f2f59
commit
c7f225b133
1 changed files with 8 additions and 6 deletions
|
@ -104,22 +104,24 @@ fwzone.rmempty = false
|
||||||
|
|
||||||
function fwzone.cfgvalue(self, section)
|
function fwzone.cfgvalue(self, section)
|
||||||
self.iface = section
|
self.iface = section
|
||||||
local z = fw.get_zones_by_network(section)[1]
|
local z = fw:get_zones_by_network(section)[1]
|
||||||
return z and z:name()
|
return z and z:name()
|
||||||
end
|
end
|
||||||
|
|
||||||
function fwzone.write(self, section, value)
|
function fwzone.write(self, section, value)
|
||||||
local zone = fw.get_zone(value)
|
local zone = fw:get_zone(value)
|
||||||
|
|
||||||
if not zone then
|
if not zone and value == '-' then
|
||||||
value = m:formvalue(self:cbid(section) .. ".newzone")
|
value = m:formvalue(self:cbid(section) .. ".newzone")
|
||||||
if value and #value > 0 and value:match("^[a-zA-Z0-9_]+$") then
|
if value and #value > 0 then
|
||||||
zone = fw.add_zone(value)
|
zone = fw:add_zone(value)
|
||||||
|
else
|
||||||
|
fw:del_network(section)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if zone then
|
if zone then
|
||||||
fw.del_network(section)
|
fw:del_network(section)
|
||||||
zone:add_network(section)
|
zone:add_network(section)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue