From c7f225b1338762f1bd08aa39f24c7790fa94c754 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 8 Oct 2009 01:24:37 +0000 Subject: modules/admin-full: adept ifaces model to changed firewall model interface --- .../admin-full/luasrc/model/cbi/admin_network/ifaces.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'modules/admin-full/luasrc') diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua index db4d500f5..3a6538c7b 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua @@ -104,22 +104,24 @@ fwzone.rmempty = false function fwzone.cfgvalue(self, 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() end 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") - if value and #value > 0 and value:match("^[a-zA-Z0-9_]+$") then - zone = fw.add_zone(value) + if value and #value > 0 then + zone = fw:add_zone(value) + else + fw:del_network(section) end end if zone then - fw.del_network(section) + fw:del_network(section) zone:add_network(section) end end -- cgit v1.2.3