aboutsummaryrefslogtreecommitdiffstats
path: root/awall/modules/nat.lua
diff options
context:
space:
mode:
Diffstat (limited to 'awall/modules/nat.lua')
-rw-r--r--awall/modules/nat.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/awall/modules/nat.lua b/awall/modules/nat.lua
index 05209c5..abe2630 100644
--- a/awall/modules/nat.lua
+++ b/awall/modules/nat.lua
@@ -15,11 +15,11 @@ local model = awall.model
local NATRule = model.class(model.Rule)
-function NATRule:init(context)
- model.Rule.init(self, context)
+function NATRule:init(...)
+ model.Rule.init(self, unpack(arg))
for i, dir in ipairs({'in', 'out'}) do
if awall.util.contains(self[dir], model.fwzone) then
- error('NAT rules not allowed for firewall zone')
+ self:error('NAT rules not allowed for firewall zone')
end
end
end
@@ -28,7 +28,7 @@ function NATRule:defaultzones() return {nil} end
function NATRule:checkzoneoptfrag(ofrag)
if ofrag[self.params.forbidif] then
- error('Cannot specify '..self.params.forbidif..'bound interface for '..self.params.target..' rule')
+ self:error('Cannot specify '..self.params.forbidif..'bound interface for '..self.params.target..' rule')
end
end
@@ -46,7 +46,7 @@ function NATRule:chain() return self.params.chain end
function NATRule:target()
if self.action then return model.Rule.target(self) end
- if not self['ip-range'] then error('IP range not defined for NAT rule') end
+ if not self['ip-range'] then self:error('IP range not defined for NAT rule') end
local target = self.params.target..' --to-'..self.params.subject..' '..self['ip-range']
if self['port-range'] then target = target..':'..self['port-range'] end
return target
@@ -55,8 +55,8 @@ end
local DNATRule = model.class(NATRule)
-function DNATRule:init(context)
- NATRule.init(self, context)
+function DNATRule:init(...)
+ NATRule.init(self, unpack(arg))
self.params = {forbidif='out', subject='destination',
chain='PREROUTING', target='DNAT'}
end
@@ -64,8 +64,8 @@ end
local SNATRule = model.class(NATRule)
-function SNATRule:init(context)
- NATRule.init(self, context)
+function SNATRule:init(...)
+ NATRule.init(self, unpack(arg))
self.params = {forbidif='in', subject='source',
chain='POSTROUTING', target='SNAT'}
end