Commit b82c8837 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

Filter.extraoptfrags: reorder function

parent 1db4c27f
......@@ -349,47 +349,44 @@ end
function Filter:extraoptfrags()
local limit = self:limit()
if limit then
if self.action ~= 'accept' then
self:error('Cannot specify limit for '..self.action..' filter')
end
if not limit then return Filter.super(self):extraoptfrags() end
local limitchain = self:uniqueid('limit')
local limitlog = self[limit].log
local limitobj = self:create(FilterLimit, self[limit], 'limit')
if self.action ~= 'accept' then
self:error('Cannot specify limit for '..self.action..' filter')
end
local ofs = {}
local logch, limitofs
local accept = self:position() == 'append'
local limitchain = self:uniqueid('limit')
local limitlog = self[limit].log
local limitobj = self:create(FilterLimit, self[limit], 'limit')
local uofs, sofs = limitobj:recentofrags(limitchain)
local ofs = {}
local logch, limitofs
local accept = self:position() == 'append'
if uofs then
ofs, logch = self:logchain(limitlog, 'drop', 'DROP')
local uofs, sofs = limitobj:recentofrags(limitchain)
limitofs = combinations(uofs, {{target=logch}})
if accept and self.log then extend(limitofs, self.log:optfrags()) end
extend(
limitofs, combinations(sofs, {{target=accept and 'ACCEPT' or nil}})
)
if uofs then
ofs, logch = self:logchain(limitlog, 'drop', 'DROP')
else
if accept then
ofs, logch = self:logchain(self.log, 'accept', 'ACCEPT')
else logch = 'RETURN' end
limitofs = combinations(uofs, {{target=logch}})
if accept and self.log then extend(limitofs, self.log:optfrags()) end
extend(
limitofs, combinations(sofs, {{target=accept and 'ACCEPT' or nil}})
)
limitofs = combinations(
limitobj:limitofrags(limitchain), {{target=logch}}
)
if limitlog then extend(limitofs, limitlog:optfrags()) end
table.insert(limitofs, {target='DROP'})
end
else
if accept then ofs, logch = self:logchain(self.log, 'accept', 'ACCEPT')
else logch = 'RETURN' end
extend(ofs, combinations({{chain=limitchain}}, limitofs))
return ofs
limitofs = combinations(
limitobj:limitofrags(limitchain), {{target=logch}}
)
if limitlog then extend(limitofs, limitlog:optfrags()) end
table.insert(limitofs, {target='DROP'})
end
return Filter.super(self):extraoptfrags()
extend(ofs, combinations({{chain=limitchain}}, limitofs))
return ofs
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