aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2021-09-21 15:24:59 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2021-09-21 15:29:48 +0300
commit19d30f5115058d19aa924a684fd18ec50b2d801d (patch)
treeae59b13554432acee9aaa1ab1eb5cabb8f3e7119
parentdc9c17bfb9bc5af43340d1fb22049acb504cbe5e (diff)
downloadawall-19d30f5115058d19aa924a684fd18ec50b2d801d.tar.gz
awall-19d30f5115058d19aa924a684fd18ec50b2d801d.tar.bz2
awall-19d30f5115058d19aa924a684fd18ec50b2d801d.tar.xz
family.identify: accept DNS name starting with digitv1.10.1
fixes #9648
-rw-r--r--awall/family.lua14
-rw-r--r--awall/host.lua4
2 files changed, 8 insertions, 10 deletions
diff --git a/awall/family.lua b/awall/family.lua
index 9762b71..eee5f30 100644
--- a/awall/family.lua
+++ b/awall/family.lua
@@ -1,14 +1,10 @@
--[[
Address family module for Alpine Wall
-Copyright (C) 2012-2020 Kaarle Ritvanen
+Copyright (C) 2012-2021 Kaarle Ritvanen
See LICENSE file for license details
]]--
-local M = {
- ACTIVE={},
- ALL={},
- PATTERNS={domain='[%a-][%.%w-]*', inet='%d[%.%d/-]+', inet6='[:%x/-]+'}
-}
+local M = {ACTIVE={}, ALL={}, DOMAIN_PATTERN='[%.%w-]+'}
local stat = require('posix').stat
@@ -18,8 +14,10 @@ for family, procfile in pairs{inet='raw', inet6='raw6'} do
end
function M.identify(addr, context)
- for k, v in pairs(M.PATTERNS) do
- if addr:match('^'..v..'$') then return k end
+ for _, pattern in ipairs{
+ {'inet', '[%.%d/-]+'}, {'domain', M.DOMAIN_PATTERN}, {'inet6', '[:%x/-]+'}
+ } do
+ if addr:match('^'..pattern[2]..'$') then return pattern[1] end
end
context:error('Malformed host specification: '..addr)
end
diff --git a/awall/host.lua b/awall/host.lua
index 55254d4..129cbeb 100644
--- a/awall/host.lua
+++ b/awall/host.lua
@@ -1,6 +1,6 @@
--[[
Host address resolver for Alpine Wall
-Copyright (C) 2012-2020 Kaarle Ritvanen
+Copyright (C) 2012-2021 Kaarle Ritvanen
See LICENSE file for license details
]]--
@@ -33,7 +33,7 @@ function M.resolve(list, context, allow)
if answer then
if rec == '' then break end
local addr = rec:match(
- '^'..family.PATTERNS.domain..'%s+%d+%s+IN%s+'..rtype..
+ '^'..family.DOMAIN_PATTERN..'%s+%d+%s+IN%s+'..rtype..
'%s+(.+)'
)
if addr then