diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:55:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:55:53 +0000 |
commit | 3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch) | |
tree | f87bd4a126b3a843858eb447e8fd5893c3ee3882 /daemon/lua/config.lua | |
parent | Initial commit. (diff) | |
download | knot-resolver-upstream.tar.xz knot-resolver-upstream.zip |
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/lua/config.lua')
-rw-r--r-- | daemon/lua/config.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/daemon/lua/config.lua b/daemon/lua/config.lua new file mode 100644 index 0000000..448d6dd --- /dev/null +++ b/daemon/lua/config.lua @@ -0,0 +1,35 @@ +-- Listen on localhost +if not next(net.list()) and not env.KRESD_NO_LISTEN then + local ok, err = pcall(net.listen, '127.0.0.1') + if not ok then + error('bind to 127.0.0.1@53 '..err) + end + -- IPv6 loopback may fail + ok, err = pcall(net.listen, '::1') + if not ok and verbose() then + print('bind to ::1@53 '..err) + end + -- Exit when kresd isn't listening on any interfaces + if not next(net.list()) then + panic('not listening on any interface, exiting...') + end +end +-- Open cache if not set/disabled +if not cache.current_size then + cache.size = 100 * MB +end + +-- If no addresses for root servers are set, load them from the default file +if require('ffi').C.kr_zonecut_is_empty(kres.context().root_hints) then + _hint_root_file() +end + +if not trust_anchors.keysets['\0'] and trust_anchors.keyfile_default then + if io.open(trust_anchors.keyfile_default, 'r') then + trust_anchors.config(trust_anchors.keyfile_default, true) + else + panic("cannot open default trust anchor file:'%s'", + trust_anchors.keyfile_default + ) + end +end |