Commit cb0c7dce authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

support for all NFLOG and ULOG options

fixes #1586
parent ff7c8fc0
...@@ -23,7 +23,7 @@ class = awall.object.class ...@@ -23,7 +23,7 @@ class = awall.object.class
require 'stringy' require 'stringy'
local ConfigObject = class() ConfigObject = class()
function ConfigObject:init(context, location) function ConfigObject:init(context, location)
if context then if context then
......
...@@ -17,14 +17,37 @@ local extend = util.extend ...@@ -17,14 +17,37 @@ local extend = util.extend
local RECENT_MAX_COUNT = 20 local RECENT_MAX_COUNT = 20
local Log = model.class() local Log = model.class(model.ConfigObject)
function Log:optfrag() function Log:optfrag()
local optmap = {
log={level='level', prefix='prefix'},
nflog={
group='group',
prefix='prefix',
range='range',
threshold='threshold'
},
ulog={
group='nlgroup',
prefix='prefix',
range='cprange',
threshold='qthreshold'
}
}
local mode = self.mode or 'log' local mode = self.mode or 'log'
local prefix = self.prefix and ' --'..mode..'-prefix '..self.prefix or '' if not optmap[mode] then self:error('Invalid logging mode: '..mode) end
local target = string.upper(mode)
for s, t in pairs(optmap[mode]) do
if self[s] then target = target..' --'..mode..'-'..t..' '..self[s] end
end
return { return {
opts=self.limit and '-m limit --limit '..self.limit..'/second', opts=self.limit and '-m limit --limit '..self.limit..'/second',
target=string.upper(mode)..prefix target=target
} }
end 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