summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awall/modules/filter.lua4
-rw-r--r--awall/optfrag.lua16
2 files changed, 11 insertions, 9 deletions
diff --git a/awall/modules/filter.lua b/awall/modules/filter.lua
index be391f7..a37e497 100644
--- a/awall/modules/filter.lua
+++ b/awall/modules/filter.lua
@@ -192,8 +192,8 @@ for i, chain in ipairs({'INPUT', 'OUTPUT'}) do
{chain=chain,
opts='-'..string.lower(string.sub(chain, 1, 1))..' lo'})
end
-defrules.pre = combinations(combinations(dar,
- {{table='filter', target='ACCEPT'}}),
+defrules.pre = combinations(dar,
+ {{table='filter', target='ACCEPT'}},
{{family='inet'}, {family='inet6'}})
defrules['post-filter'] = combinations({{family='inet6',
diff --git a/awall/optfrag.lua b/awall/optfrag.lua
index 97d8cc8..abd2b89 100644
--- a/awall/optfrag.lua
+++ b/awall/optfrag.lua
@@ -7,12 +7,14 @@ Licensed under the terms of GPL2
module(..., package.seeall)
-function combinations(of1, of2)
- if not of1 then
- if not of2 then return nil end
- return of2
- end
- if not of2 then return of1 end
+function combinations(of1, ...)
+ if #arg == 0 then return of1 end
+
+ if not of1 then return combinations(unpack(arg)) end
+
+ local of2 = arg[1]
+ table.remove(arg, 1)
+ if not of2 then return combinations(of1, unpack(arg)) end
local res = {}
for i, x in ipairs(of1) do
@@ -44,7 +46,7 @@ function combinations(of1, of2)
end
end
- return res
+ return combinations(res, unpack(arg))
end
function location(of) return of.family..'/'..of.table..'/'..of.chain end