Commit e04e525a authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

rename 'newchain' to 'uniqueid'

parent 46ca4b38
......@@ -131,7 +131,7 @@ M.Rule = M.class(M.ConfigObject)
function M.Rule:init(...)
M.Rule.super(self):init(...)
self.newchains = {}
self.uniqueids = {}
for i, prop in ipairs({'in', 'out'}) do
self[prop] = self[prop] and maplist(
......@@ -463,9 +463,7 @@ function M.Rule:trules()
if combined then
target = self:target()
res = combined
else
target = self:newchain('address')
end
else target = self:uniqueid('address') end
tag(res, 'position', self:position())
......@@ -535,8 +533,8 @@ end
function M.Rule:extraoptfrags() return {} end
function M.Rule:newchain(key)
if self.newchains[key] then return self.newchains[key] end
function M.Rule:uniqueid(key)
if self.uniqueids[key] then return self.uniqueids[key] end
if not self.context.lastid then self.context.lastid = {} end
local lastid = self.context.lastid
......@@ -547,7 +545,7 @@ function M.Rule:newchain(key)
lastid[res] = lastid[res] + 1
res = res..'-'..lastid[res]
self.newchains[key] = res
self.uniqueids[key] = res
return res
end
......
......@@ -51,13 +51,13 @@ end
function LoggingRule:actiontarget() return 'ACCEPT' end
function LoggingRule:target()
if self.log then return self:newchain('log'..self.action) end
if self.log then return self:uniqueid('log'..self.action) end
return self:actiontarget()
end
function LoggingRule:logchain(log, action, target)
if not log then return {}, target end
local chain = self:newchain('log'..action)
local chain = self:uniqueid('log'..action)
return combinations({{chain=chain}}, {log:optfrag(), {target=target}}), chain
end
......@@ -236,7 +236,7 @@ function Filter:actiontarget()
end
function Filter:target()
if self:limit() then return self:newchain('limit') end
if self:limit() then return self:uniqueid('limit') end
return Filter.super(self).target()
end
......@@ -247,7 +247,7 @@ function Filter:extraoptfrags()
self:error('Cannot specify limit for '..self.action..' filter')
end
local limitchain = self:newchain('limit')
local limitchain = self:uniqueid('limit')
local limitlog = self[limit].log
local count = self[limit].count
local interval = self[limit].interval or 1
......
......@@ -26,7 +26,7 @@ function MarkRule:target() return 'MARK --set-mark '..self.mark end
local RouteTrackRule = class(MarkRule)
function RouteTrackRule:target() return self:newchain('mark') end
function RouteTrackRule:target() return self:uniqueid('mark') end
function RouteTrackRule:servoptfrags()
return combinations(
......
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