Commit 8e84eb17 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

handle properly multiple explicit related rules

parent 96d74c77
...@@ -115,13 +115,13 @@ end ...@@ -115,13 +115,13 @@ end
function Filter:trules() function Filter:trules()
local res = {} local res = {}
local function extrarules(key, cls, options) local function extrarules(label, cls, options)
options = options or {}
local key = label..(options.index or '')
local obj = self.extrarules[key] local obj = self.extrarules[key]
if not obj then if not obj then
options = options or {} local params = {label=(self.label and self.label..'-' or '')..label}
local params = {label=(self.label and self.label..'-' or '')..key}
for i, attr in ipairs( for i, attr in ipairs(
{'in', 'out', 'src', 'dest', 'dnat', 'ipset', 'ipsec', 'service'} {'in', 'out', 'src', 'dest', 'dnat', 'ipset', 'ipsec', 'service'}
) do ) do
...@@ -185,7 +185,9 @@ function Filter:trules() ...@@ -185,7 +185,9 @@ function Filter:trules()
if self.related then if self.related then
for i, rule in listpairs(self.related) do for i, rule in listpairs(self.related) do
extrarules( extrarules(
'related', RelatedRule, {src=rule, update={service=self.service}} 'related',
RelatedRule,
{index=i, src=rule, update={service=self.service}}
) )
end end
else else
......
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