From 6504e9c5dc3ff5162f58600eb7a90809b650cafe Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Fri, 20 Jul 2012 12:32:42 +0000 Subject: [PATCH] preserve nil values for in and out zone attributes --- awall/model.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/awall/model.lua b/awall/model.lua index c86a2fa..9a011d1 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -105,7 +105,7 @@ function Rule:init(...) return z == '_fw' and fwzone or self.root.zone[z] or self:error('Invalid zone: '..z) - end) or self:defaultzones() + end) end if self.service then @@ -160,10 +160,12 @@ function Rule:zoneoptfrags() end local res = {} + local izones = self['in'] or self:defaultzones() + local ozones = self.out or self:defaultzones() - for i = 1,math.max(1, table.maxn(self['in'])) do - for j = 1,math.max(1, table.maxn(self.out)) do - util.extend(res, zonepair(self['in'][i], self.out[j])) + for i = 1,math.max(1, table.maxn(izones)) do + for j = 1,math.max(1, table.maxn(ozones)) do + util.extend(res, zonepair(izones[i], ozones[j])) end end @@ -408,7 +410,7 @@ ForwardOnlyRule = class(Rule) function ForwardOnlyRule:init(...) Rule.init(self, unpack(arg)) for i, dir in ipairs({'in', 'out'}) do - if util.contains(self[dir], fwzone) then + if self[dir] and util.contains(self[dir], fwzone) then self:error('Not applicable to the firewall zone') end end -- GitLab