Skip to content
Snippets Groups Projects
Commit 2e2e0f88 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

workarounds: add code to deal with #139

parent 40c68f7d
Branches
Tags
2 merge requests!254Knot Resolver 1.2.5,!184workarounds module
......@@ -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 {
......
......@@ -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"
......
......@@ -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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment