diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2019-12-24 13:15:42 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2020-01-17 18:26:04 +0200 |
commit | 6acc1668fef01d2dd27661e580c735f61d31a47a (patch) | |
tree | 5fb025027b775c26606383941e957d73e9f6de78 | |
parent | 1dbb083b2c6d84f7ef10761955705b44db6b0551 (diff) | |
download | awall-6acc1668fef01d2dd27661e580c735f61d31a47a.tar.bz2 awall-6acc1668fef01d2dd27661e580c735f61d31a47a.tar.xz |
BaseIPTables: restorecmd method
-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() |