aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-05-01 18:36:27 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2020-05-01 18:46:53 +0300
commite4b54f5d45fdb9f2044e4535d6e81dd9e915d519 (patch)
tree81731f648077168698615be31e73dc187923421c
parent02eda0dd53e875b9b41259f76fe8581d2159ffb2 (diff)
downloadawall-master.tar.bz2
awall-master.tar.xz
switch to Lua 5.3HEADmaster
fixes #8377
-rw-r--r--Makefile4
-rw-r--r--awall/iptables.lua24
-rw-r--r--awall/model.lua4
3 files changed, 17 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 4c86cc3..88b297b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
# Installer Makefile for Alpine Wall
-# Copyright (C) 2012-2018 Kaarle Ritvanen
+# Copyright (C) 2012-2020 Kaarle Ritvanen
# See LICENSE file for license details
ROOT_DIR := /
-LUA_VERSION := 5.2
+LUA_VERSION := 5.3
resdir := usr/share/awall
confdir := etc/awall
diff --git a/awall/iptables.lua b/awall/iptables.lua
index cb19ff8..3a8a755 100644
--- a/awall/iptables.lua
+++ b/awall/iptables.lua
@@ -106,17 +106,19 @@ function BaseIPTables:flush() M.flush() end
M.IPTables = class(BaseIPTables)
function M.IPTables:init()
- self.config = {}
- setmetatable(
- self.config,
- {
- __index=function(t, k)
- t[k] = {}
- setmetatable(t[k], getmetatable(t))
- return t[k]
- end
- }
- )
+ local function nestedtable(levels)
+ return levels > 0 and setmetatable(
+ {},
+ {
+ __index=function(t, k)
+ t[k] = nestedtable(getmetatable(t).levels - 1)
+ return t[k]
+ end,
+ levels=levels
+ }
+ ) or {}
+ end
+ self.config = nestedtable(3)
end
function M.IPTables:dumpfile(family, iptfile)
diff --git a/awall/model.lua b/awall/model.lua
index b6acd69..5a2b870 100644
--- a/awall/model.lua
+++ b/awall/model.lua
@@ -733,14 +733,14 @@ function M.Maskable:recentmask(name)
for i = 0, 3 do
if len <= i * 8 then octet = 0
elseif len > i * 8 + 7 then octet = 255
- else octet = 256 - 2^(8 - len % 8) end
+ else octet = 256 - math.floor(2^(8 - len % 8)) end
mask = util.join(mask, '.', octet)
end
elseif family == 'inet6' then
while len > 0 do
if #mask % 5 == 4 then mask = mask..':' end
- mask = mask..('%x'):format(16 - 2^math.max(0, 4 - len))
+ mask = mask..('%x'):format(16 - math.floor(2^math.max(0, 4 - len)))
len = len - 4
end
while #mask % 5 < 4 do mask = mask..'0' end