Commit ad7909da authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

model: trules: rename variable

parent 103f89f5
...@@ -464,7 +464,7 @@ function M.Rule:trules() ...@@ -464,7 +464,7 @@ function M.Rule:trules()
) )
end end
local res = self:zoneoptfrags() local ofrags = self:zoneoptfrags()
if self.ipset then if self.ipset then
local ipsetofrags = {} local ipsetofrags = {}
...@@ -489,28 +489,28 @@ function M.Rule:trules() ...@@ -489,28 +489,28 @@ function M.Rule:trules()
',') ',')
table.insert(ipsetofrags, {family=setdef.family, opts=setopts}) table.insert(ipsetofrags, {family=setdef.family, opts=setopts})
end end
res = combinations(res, ipsetofrags) ofrags = combinations(ofrags, ipsetofrags)
end end
if self.match then res = combinations(res, {{opts=self.match}}) end if self.match then ofrags = combinations(ofrags, {{opts=self.match}}) end
res = combinations(res, self:servoptfrags()) ofrags = combinations(ofrags, self:servoptfrags())
setfamilies(res) setfamilies(ofrags)
local addrofrags = combinations( local addrofrags = combinations(
self:create(M.Zone, {addr=self.src}):optfrags(self:direction('in')), self:create(M.Zone, {addr=self.src}):optfrags(self:direction('in')),
self:destoptfrags() self:destoptfrags()
) )
local combined = res local combined = ofrags
if addrofrags then if addrofrags then
addrofrags = ffilter(addrofrags) addrofrags = ffilter(addrofrags)
setfamilies(addrofrags) setfamilies(addrofrags)
res = ffilter(res) ofrags = ffilter(ofrags)
combined = {} combined = {}
for i, ofrag in ipairs(res) do for i, ofrag in ipairs(ofrags) do
local aofs = combinations(addrofrags, {{family=ofrag.family}}) local aofs = combinations(addrofrags, {{family=ofrag.family}})
local cc = combinations({ofrag}, aofs) local cc = combinations({ofrag}, aofs)
if #cc < #aofs then if #cc < #aofs then
...@@ -524,21 +524,21 @@ function M.Rule:trules() ...@@ -524,21 +524,21 @@ function M.Rule:trules()
local target local target
if combined then if combined then
target = self:target() target = self:target()
res = combined ofrags = combined
else target = self:uniqueid('address') end else target = self:uniqueid('address') end
tag(res, 'position', self:position()) tag(ofrags, 'position', self:position())
res = combinations(res, {{target=target}}) ofrags = combinations(ofrags, {{target=target}})
if not combined then if not combined then
extend( extend(
res, ofrags,
combinations(addrofrags, {{chain=target, target=self:target()}}) combinations(addrofrags, {{chain=target, target=self:target()}})
) )
end end
extend(res, self:extraoptfrags()) extend(ofrags, self:extraoptfrags())
local tbl = self:table() local tbl = self:table()
...@@ -576,8 +576,8 @@ function M.Rule:trules() ...@@ -576,8 +576,8 @@ function M.Rule:trules()
return res return res
end end
res = convertchains(ffilter(res)) ofrags = convertchains(ffilter(ofrags))
tag(res, 'table', tbl, false) tag(ofrags, 'table', tbl, false)
local function checkzof(ofrag, dir, chains) local function checkzof(ofrag, dir, chains)
if ofrag[dir] and contains(chains, ofrag.chain) then if ofrag[dir] and contains(chains, ofrag.chain) then
...@@ -585,12 +585,12 @@ function M.Rule:trules() ...@@ -585,12 +585,12 @@ function M.Rule:trules()
end end
end end
for i, ofrag in ipairs(res) do for i, ofrag in ipairs(ofrags) do
checkzof(ofrag, 'in', {'OUTPUT', 'POSTROUTING'}) checkzof(ofrag, 'in', {'OUTPUT', 'POSTROUTING'})
checkzof(ofrag, 'out', {'INPUT', 'PREROUTING'}) checkzof(ofrag, 'out', {'INPUT', 'PREROUTING'})
end end
return combinations(res, ffilter({{family='inet'}, {family='inet6'}})) return combinations(ofrags, ffilter({{family='inet'}, {family='inet6'}}))
end end
function M.Rule:extraoptfrags() return {} end function M.Rule:extraoptfrags() return {} 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