Commit d66e814f authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

simplify limit definitions

interval becomes optional (default: 1)
simple limits can be specified as integers (use default interval and log settings)
parent 57aa0ad0
......@@ -49,8 +49,14 @@ function Filter:init(...)
end
self.log = log(self.log, self.action ~= 'accept')
local limit = self:limit()
if limit then self[limit].log = log(self[limit].log, true) end
if limit then
if type(self[limit]) ~= 'table' then
self[limit] = {count=self[limit]}
end
self[limit].log = log(self[limit].log, true)
end
end
function Filter:destoptfrags()
......@@ -166,7 +172,7 @@ function Filter:extraoptfrags()
local limitlog = self[limit].log
local count = self[limit].count
local interval = self[limit].interval
local interval = self[limit].interval or 1
local chain = self:newchain('limit')
local atgt = self.log and self:newchain('logaccept') or 'ACCEPT'
......
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