summaryrefslogtreecommitdiffstats
path: root/awall
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2012-07-20 12:32:42 +0000
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2012-07-20 12:32:42 +0000
commit6504e9c5dc3ff5162f58600eb7a90809b650cafe (patch)
tree1573295820e8b6a2768c5e999515801308c0057d /awall
parent4d27a0800688efc6e94dc16b306da555699f3ce5 (diff)
downloadawall-6504e9c5dc3ff5162f58600eb7a90809b650cafe.tar.bz2
awall-6504e9c5dc3ff5162f58600eb7a90809b650cafe.tar.xz
preserve nil values for in and out zone attributes
Diffstat (limited to 'awall')
-rw-r--r--awall/model.lua12
1 files 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