diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2017-02-15 18:15:11 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2017-02-16 11:19:54 +0100 |
commit | 2e2e0f8848b59951e81c79824e44b40beb349aa6 (patch) | |
tree | 643856cbd93e767c3a1d6ede2243c0aeb1c732d8 /modules/workarounds | |
parent | workarounds: prototype of a new module (diff) | |
download | knot-resolver-2e2e0f8848b59951e81c79824e44b40beb349aa6.tar.xz knot-resolver-2e2e0f8848b59951e81c79824e44b40beb349aa6.zip |
workarounds: add code to deal with #139
Diffstat (limited to 'modules/workarounds')
-rw-r--r-- | modules/workarounds/workarounds.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/workarounds/workarounds.lua b/modules/workarounds/workarounds.lua index 255fe784..51cf3c08 100644 --- a/modules/workarounds/workarounds.lua +++ b/modules/workarounds/workarounds.lua @@ -16,5 +16,29 @@ function M.config() })) end +-- Issue #139: When asking NSs of certain turktelekom names for PTR, disable 0x20. +-- Just listing the *.in-addr.arpa suffixes would be tedious, as there are many. +M.layer = { + produce = function (state, req) + local req = kres.request_t(req) + local qry = req:current() + if qry.stype ~= kres.type.PTR + or bit.band(state, bit.bor(kres.FAIL, kres.DONE)) ~= 0 + then return state -- quick exit in most cases + end + if qry:hasflag(kres.query.AWAIT_CUT) or qry.ns.name == nil + then return state end + local name = kres.dname2str(qry.ns.name) + -- The problematic nameservers: rdnsN.turktelekom.com.tr. + if name and string.sub(name, 6) == '.turktelekom.com.tr.' then + qry.flags = bit.bor(qry.flags, + bit.bor(kres.query.NO_0X20, kres.query.NO_MINIMIZE)) + -- ^ NO_MINIMIZE isn't required for success, as kresd will retry + -- after getting refused, but it will speed things up. + end + return state + end, +} + return M |