]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
workarounds: add code to deal with #139
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 15 Feb 2017 17:15:11 +0000 (18:15 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 16 Feb 2017 10:19:54 +0000 (11:19 +0100)
daemon/lua/kres-gen.lua
daemon/lua/kres-gen.sh
modules/workarounds/workarounds.lua

index f69a33760273a4c0d52b81e5700fd6f6d3e89df1..6ccab78b4017605c31f3ef3beeea1c68300e479d 100644 (file)
@@ -130,6 +130,13 @@ struct knot_rrset {
     knot_rdataset_t rrs;
     void *additional;
 };
+struct kr_nsrep {
+    unsigned int score;
+    unsigned int reputation;
+    const knot_dname_t *name;
+    struct kr_context *ctx;
+       /* beware: hidden stub */
+};
 struct kr_query {
     struct kr_query *parent;
     knot_dname_t *sname;
@@ -142,6 +149,8 @@ struct kr_query {
     uint16_t reorder;
     struct timeval timestamp;
     struct kr_zonecut zone_cut;
+    struct kr_nsrep ns;
+       /* ^hidden stub^ */
        char _stub[];
 };
 struct kr_context {
index dd803c06febd1d1b4756dc048e95dfda10816091..124853543220a35fbbb6f502b9aec43d8fd02342 100755 (executable)
@@ -52,8 +52,11 @@ genResType "struct knot_rrset" | sed 's/\<owner\>/_owner/'
 
 ## Some definitions would need too many deps, so shorten them.
 
-genResType "struct kr_query" | sed '/struct kr_nsrep/,$ d'
-printf "\tchar _stub[];\n};\n"
+genResType "struct kr_nsrep" | sed '/union/,$ d'
+printf "\t/* beware: hidden stub */\n};\n"
+
+genResType "struct kr_query" | sed '/struct kr_layer_pickle/,$ d'
+printf "\t/* ^hidden stub^ */\n\tchar _stub[];\n};\n"
 
 genResType "struct kr_context" | sed '/struct kr_cache/,$ d'
 printf "\tchar _stub[];\n};\n"
index 255fe7848dbb64b18fd5864d29cbbc7abf85d13b..51cf3c0872eff35ebec8765526e62ce53ee7036b 100644 (file)
@@ -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