Commit 5c1f829e authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

LoggingRule: allow overriding default log

parent c6b208dc
Filter module for Alpine Wall
Copyright (C) 2012-2016 Kaarle Ritvanen
Copyright (C) 2012-2017 Kaarle Ritvanen
See LICENSE file for license details
......@@ -146,7 +146,7 @@ function LoggingRule:init(...)
local custom = self:customtarget()
if type(self.log) ~= 'table' then
self.log = loadclass('log').get(
self, self.log, not custom and self.action ~= 'accept'
self, self.log, not custom and self:logdefault()
if custom and self.log then
......@@ -154,6 +154,8 @@ function LoggingRule:init(...)
function LoggingRule:logdefault() return false end
function LoggingRule:actiontarget() return 'ACCEPT' end
function LoggingRule:target()
......@@ -328,12 +330,15 @@ function Filter:position()
and 'prepend' or 'append'
function Filter:logdefault()
return contains({'drop', 'reject', 'tarpit'}, self.action)
function Filter:actiontarget()
if self.action == 'tarpit' then return 'tarpit' end
if contains({'accept', 'drop', 'reject'}, self.action) then
return self.action:upper()
if self.action ~= 'accept' and not self:logdefault() then
self:error('Invalid filter action: '..self.action)
self:error('Invalid filter action: '..self.action)
return self.action == 'tarpit' and 'tarpit' or self.action:upper()
function Filter:target()
Supports Markdown
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