Commit f3f043ad authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

check correctness of 'action' attribute

ref #2193
parent 60539803
......@@ -319,10 +319,8 @@ function Rule:position() return 'append' end
function Rule:target()
if not self.action then self:error('Action not defined') end
if util.contains({'accept', 'drop', 'reject'}, self.action) then
return string.upper(self.action)
end
return self.action
if self.action == 'accept' then return 'ACCEPT' end
self:error('Invalid action: '..self.action)
end
......
......@@ -173,10 +173,18 @@ function Filter:position()
return self:limit() == 'flow-limit' and 'prepend' or 'append'
end
function Filter:actiontarget()
if self.action == 'tarpit' then return 'tarpit' end
if util.contains({'drop', 'reject'}, self.action) then
return string.upper(self.action)
end
return model.Rule.target(self)
end
function Filter:target()
if self:limit() then return self:newchain('limit') end
if self.log then return self:newchain('log'..self.action) end
return model.Rule.target(self)
return self:actiontarget()
end
function Filter:extraoptfrags()
......@@ -234,7 +242,7 @@ function Filter:extraoptfrags()
extend(res, combinations({{chain=chain}}, ofrags))
else logchain(self.log, self.action, model.Rule.target(self)) end
else logchain(self.log, self.action, self:actiontarget()) end
return res
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