Commit 6504e9c5 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

preserve nil values for in and out zone attributes

parent 4d27a080
...@@ -105,7 +105,7 @@ function Rule:init(...) ...@@ -105,7 +105,7 @@ function Rule:init(...)
return z == '_fw' and fwzone or return z == '_fw' and fwzone or[z] or[z] or
self:error('Invalid zone: '..z) self:error('Invalid zone: '..z)
end) or self:defaultzones() end)
end end
if self.service then if self.service then
...@@ -160,10 +160,12 @@ function Rule:zoneoptfrags() ...@@ -160,10 +160,12 @@ function Rule:zoneoptfrags()
end end
local res = {} 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 i = 1,math.max(1, table.maxn(izones)) do
for j = 1,math.max(1, table.maxn(self.out)) do for j = 1,math.max(1, table.maxn(ozones)) do
util.extend(res, zonepair(self['in'][i], self.out[j])) util.extend(res, zonepair(izones[i], ozones[j]))
end end
end end
...@@ -408,7 +410,7 @@ ForwardOnlyRule = class(Rule) ...@@ -408,7 +410,7 @@ ForwardOnlyRule = class(Rule)
function ForwardOnlyRule:init(...) function ForwardOnlyRule:init(...)
Rule.init(self, unpack(arg)) Rule.init(self, unpack(arg))
for i, dir in ipairs({'in', 'out'}) do 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') self:error('Not applicable to the firewall zone')
end end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment