diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-03-31 11:00:49 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-03-31 19:05:16 +0300 |
commit | 2656abb8e17b5537420538309ddaed34aee3e7f1 (patch) | |
tree | 077bf0947cc841142a55d1575e2c04c318ae9414 | |
parent | 0f5c611d351ed27ef83a122e30f45c9d0e028da0 (diff) | |
download | awall-2656abb8e17b5537420538309ddaed34aee3e7f1.tar.bz2 awall-2656abb8e17b5537420538309ddaed34aee3e7f1.tar.xz |
eliminate deprecated varargs style
-rw-r--r-- | awall/model.lua | 4 | ||||
-rw-r--r-- | awall/modules/filter.lua | 2 | ||||
-rw-r--r-- | awall/modules/log.lua | 4 | ||||
-rw-r--r-- | awall/modules/mark.lua | 4 | ||||
-rw-r--r-- | awall/modules/nat.lua | 6 | ||||
-rw-r--r-- | awall/modules/tproxy.lua | 4 | ||||
-rw-r--r-- | awall/object.lua | 6 | ||||
-rw-r--r-- | awall/optfrag.lua | 6 | ||||
-rw-r--r-- | awall/uerror.lua | 3 |
9 files changed, 21 insertions, 18 deletions
diff --git a/awall/model.lua b/awall/model.lua index 0ab60fd..fec6e84 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -103,7 +103,7 @@ fwzone = Zone.new() IPSet = class(ConfigObject) function IPSet:init(...) - ConfigObject.init(self, unpack(arg)) + ConfigObject.init(self, ...) if not self.type then self:error('Type not defined') end @@ -126,7 +126,7 @@ Rule = class(ConfigObject) function Rule:init(...) - ConfigObject.init(self, unpack(arg)) + ConfigObject.init(self, ...) self.newchains = {} diff --git a/awall/modules/filter.lua b/awall/modules/filter.lua index 15bac49..55c6144 100644 --- a/awall/modules/filter.lua +++ b/awall/modules/filter.lua @@ -42,7 +42,7 @@ function RelatedRule:target() return 'ACCEPT' end local Filter = model.class(model.Rule) function Filter:init(...) - model.Rule.init(self, unpack(arg)) + model.Rule.init(self, ...) if not self.action then self.action = 'accept' end diff --git a/awall/modules/log.lua b/awall/modules/log.lua index ff02ca9..728db03 100644 --- a/awall/modules/log.lua +++ b/awall/modules/log.lua @@ -1,6 +1,6 @@ --[[ Packet logging module for Alpine Wall -Copyright (C) 2012-2013 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -83,7 +83,7 @@ end local LogRule = model.class(Rule) function LogRule:init(...) - Rule.init(self, unpack(arg)) + Rule.init(self, ...) self.log = Log.get(self, self.log, true) end diff --git a/awall/modules/mark.lua b/awall/modules/mark.lua index edfaa19..1d0e65d 100644 --- a/awall/modules/mark.lua +++ b/awall/modules/mark.lua @@ -1,6 +1,6 @@ --[[ Packet marking module for Alpine Wall -Copyright (C) 2012-2013 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -17,7 +17,7 @@ local util = require('awall.util') local MarkRule = class(model.Rule) function MarkRule:init(...) - model.Rule.init(self, unpack(arg)) + model.Rule.init(self, ...) if not self.mark then self:error('Mark not specified') end end diff --git a/awall/modules/nat.lua b/awall/modules/nat.lua index 4d2ba42..760a424 100644 --- a/awall/modules/nat.lua +++ b/awall/modules/nat.lua @@ -17,7 +17,7 @@ local NATRule = model.class(model.Rule) -- alpine v2.4 compatibility function NATRule:init(...) - model.Rule.init(self, unpack(arg)) + model.Rule.init(self, ...) local attrs = {['ip-range']='to-addr', ['port-range']='to-port'} for old, new in pairs(attrs) do if not self[new] and self[old] then @@ -61,7 +61,7 @@ end local DNATRule = model.class(NATRule) function DNATRule:init(...) - NATRule.init(self, unpack(arg)) + NATRule.init(self, ...) self.params = {forbidif='out', subject='destination', chains={'INPUT', 'PREROUTING'}, target='DNAT', deftarget='REDIRECT'} @@ -71,7 +71,7 @@ end local SNATRule = model.class(NATRule) function SNATRule:init(...) - NATRule.init(self, unpack(arg)) + NATRule.init(self, ...) self.params = {forbidif='in', subject='source', chains={'OUTPUT', 'POSTROUTING'}, target='SNAT', deftarget='MASQUERADE'} diff --git a/awall/modules/tproxy.lua b/awall/modules/tproxy.lua index 65add4a..8a79131 100644 --- a/awall/modules/tproxy.lua +++ b/awall/modules/tproxy.lua @@ -1,6 +1,6 @@ --[[ Transparent proxy module for Alpine Wall -Copyright (C) 2012-2013 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -21,7 +21,7 @@ local listpairs = util.listpairs local TProxyRule = model.class(Rule) function TProxyRule:init(...) - Rule.init(self, unpack(arg)) + Rule.init(self, ...) if not self['in'] then self:error('Ingress zone must be specified') end if contains(list(self['in']), model.fwzone) then diff --git a/awall/object.lua b/awall/object.lua index bffd384..17062ec 100644 --- a/awall/object.lua +++ b/awall/object.lua @@ -1,6 +1,6 @@ --[[ Class model with inheritance and morphing support for Alpine Wall -Copyright (C) 2012 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -14,11 +14,11 @@ function class(base) if not base and Object then base = Object end if base then setmetatable(cls, {__index = base}) end - function cls.new(...) return cls.morph({}, unpack(arg)) end + function cls.new(...) return cls.morph({}, ...) end function cls:morph(...) setmetatable(self, mt) - self:init(unpack(arg)) + self:init(...) return self end diff --git a/awall/optfrag.lua b/awall/optfrag.lua index 85f0683..56fbd88 100644 --- a/awall/optfrag.lua +++ b/awall/optfrag.lua @@ -1,6 +1,6 @@ --[[ Option fragment module for Alpine Wall -Copyright (C) 2012 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -8,9 +8,11 @@ See LICENSE file for license details module(..., package.seeall) function combinations(of1, ...) + local arg = {...} + if #arg == 0 then return of1 end - if not of1 then return combinations(unpack(arg)) end + if not of1 then return combinations(...) end local of2 = arg[1] table.remove(arg, 1) diff --git a/awall/uerror.lua b/awall/uerror.lua index aed52e5..263025f 100644 --- a/awall/uerror.lua +++ b/awall/uerror.lua @@ -1,6 +1,6 @@ --[[ User error handling for Alpine Wall -Copyright (C) 2012-2013 Kaarle Ritvanen +Copyright (C) 2012-2014 Kaarle Ritvanen See LICENSE file for license details ]]-- @@ -11,6 +11,7 @@ local prefix = 'awall user error: ' function raise(msg) error(prefix..msg) end function call(f, ...) + local arg = {...} return xpcall( function() f(unpack(arg)) end, function(msg) |