diff options
-rw-r--r-- | awall/iptables.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/awall/iptables.lua b/awall/iptables.lua index ffe2977..2e1bb6b 100644 --- a/awall/iptables.lua +++ b/awall/iptables.lua @@ -74,11 +74,15 @@ function BaseIPTables:dump(dir) end end +function BaseIPTables:restorecmd(family, test) + local cmd = {families[family].cmd..'-restore'} + if test then table.insert(cmd, '-t') end + return table.unpack(cmd) +end + function BaseIPTables:restore(test) for _, family in ipairs(actfamilies()) do - local pid, stdin, stdout = lpc.run( - families[family].cmd..'-restore', table.unpack{test and '-t' or nil} - ) + local pid, stdin, stdout = lpc.run(self:restorecmd(family, test)) stdout:close() self:dumpfile(family, stdin) stdin:close() |