Commit c9d2c65a authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

make port-range work in NAT rules when ip-range not defined

parent 8b0b3709
......@@ -31,12 +31,15 @@ function NATRule:table() return 'nat' end
function NATRule:target()
if self.action then return model.Rule.target(self) end
local range = self['ip-range']
local target
if self['ip-range'] then
target = self.params.target..' --to-'..self.params.subject..' '..self['ip-range']
if range then
target = self.params.target..' --to-'..self.params.subject..' '..range
else target = self.params.deftarget end
if self['port-range'] then target = target..':'..self['port-range'] end
if self['port-range'] then
target = target..(range and ':' or ' --to-ports ')..self['port-range']
end
return target
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