diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2012-08-24 12:17:03 +0000 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2012-08-24 12:17:03 +0000 |
commit | f22985613d09529d106b4c01b7a36a06a3ebb549 (patch) | |
tree | ddd0e6a2981b561e3ebc3b232d0a2f880ef05e88 | |
parent | 0ae7ea3188afd7b1e03ca5d31fd9b85503a79f21 (diff) | |
download | awall-f22985613d09529d106b4c01b7a36a06a3ebb549.tar.bz2 awall-f22985613d09529d106b4c01b7a36a06a3ebb549.tar.xz |
substitute table.concat for util.join
-rw-r--r-- | awall/ipset.lua | 3 | ||||
-rw-r--r-- | awall/model.lua | 16 | ||||
-rw-r--r-- | awall/util.lua | 9 |
3 files changed, 9 insertions, 19 deletions
diff --git a/awall/ipset.lua b/awall/ipset.lua index 2b78495..ceba5e6 100644 --- a/awall/ipset.lua +++ b/awall/ipset.lua @@ -8,7 +8,6 @@ Licensed under the terms of GPL2 module(..., package.seeall) require 'awall.object' -require 'awall.util' IPSet = awall.object.class(awall.object.Object) @@ -23,7 +22,7 @@ end function IPSet:dumpfile(name, ipsfile) ipsfile:write('# ipset '..name..'\n') - ipsfile:write(awall.util.join(self:options(name), ' ')) + ipsfile:write(table.concat(self:options(name), ' ')) ipsfile:write('\n') end diff --git a/awall/model.lua b/awall/model.lua index 5ed9d68..264a6b3 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -237,7 +237,7 @@ function Rule:servoptfrags() if len == 1 then opts = opts..' --dport '..plist[1] elseif len > 1 then - opts = opts..' -m multiport --dports '..util.join(plist, ',') + opts = opts..' -m multiport --dports '..table.concat(plist, ',') end table.insert(res, {opts=opts}) @@ -311,13 +311,13 @@ function Rule:trules() end local setopts = '-m set --match-set '..ipset.name..' ' - setopts = setopts..util.join(util.map(util.list(ipset.args), - function(a) - if a == 'in' then return 'src' end - if a == 'out' then return 'dst' end - self:error('Invalid set direction argument') - end), - ',') + setopts = setopts..table.concat(util.map(util.list(ipset.args), + function(a) + if a == 'in' then return 'src' end + if a == 'out' then return 'dst' end + self:error('Invalid set direction argument') + end), + ',') table.insert(ipsetofrags, {family=setdef.family, opts=setopts}) end res = combinations(res, ipsetofrags) diff --git a/awall/util.lua b/awall/util.lua index 3479124..dad057e 100644 --- a/awall/util.lua +++ b/awall/util.lua @@ -7,15 +7,6 @@ Licensed under the terms of GPL2 module(..., package.seeall) -function join(var, sep) - local res = '' - for i, s in listpairs(var) do - if i > 1 then res = res..sep end - res = res..s - end - return res -end - function list(var) if not var then return {} end if type(var) ~= 'table' then return {var} end |