]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/policy.RPZ: log libzonefile errors as well
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 5 Mar 2019 07:55:07 +0000 (08:55 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 5 Mar 2019 08:13:12 +0000 (09:13 +0100)
NEWS
modules/policy/policy.lua

diff --git a/NEWS b/NEWS
index ebeef87b2330483aba550e9dbf578fab83a4f58c..f8c216e437da8d17f4cd3479dd79b0bd6f51f480 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Bugfixes
 - trust_anchors.add(): include these TAs in .summary() (!753)
 - policy module: support '#' for separating port numbers, for consistency
 - fix startup on macOS+BSD when </dev/null and cqueues installed
+- policy.RPZ: log problems from zone-file level of parser as well (#453)
 
 Improvements
 ------------
index fb8929868bd48479a5236140b3aa9e88b9ba8289..8498f4926603b8c8716fac8f9e4f949e94b4b260 100644 (file)
@@ -362,8 +362,17 @@ local function rpz_parse(action, path)
                -- Policy triggers @NYI@
        }
        local parser = require('zonefile').new()
-       if not parser:open(path) then error(string.format('failed to parse "%s"', path)) end
-       while parser:parse() do
+       local ok, errstr = parser:open(path)
+       if not ok then
+               error(string.format('failed to parse "%s": %s', path, errstr or "unknown error"))
+       end
+       while true do
+               ok, errstr = parser:parse()
+               if errstr then
+                       log('[poli] RPZ %s:%d: %s', path, tonumber(parser.line_counter), errstr)
+               end
+               if not ok then break end
+
                local name = ffi.string(parser.r_owner, parser.r_owner_length)
                local name_action = ffi.string(parser.r_data, parser.r_data_length)
                rules[name] = action_map[name_action]