summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-01-30 10:27:18 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-01-30 10:27:18 +0200
commitd66e814f65eda1f2a5f88e974a6423169ed2d53c (patch)
tree2f124b679414f92f8aad1455c03adff6b16dc748
parent57aa0ad0ef6de92b9cb60e88d153dc2f0f78642f (diff)
downloadawall-d66e814f65eda1f2a5f88e974a6423169ed2d53c.tar.bz2
awall-d66e814f65eda1f2a5f88e974a6423169ed2d53c.tar.xz
simplify limit definitions
interval becomes optional (default: 1) simple limits can be specified as integers (use default interval and log settings)
-rw-r--r--awall/modules/filter.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/awall/modules/filter.lua b/awall/modules/filter.lua
index 47d360b..faf7c91 100644
--- a/awall/modules/filter.lua
+++ b/awall/modules/filter.lua
@@ -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'