Commit 5b293e22 authored by Marek Vavrusa's avatar Marek Vavrusa

lib/resolve: fixed 0x20 with retransmit

bcf3f4b5 made query_finalize() to be called on
each outbound query before sending, so each
retransmitted query got different 0x20 case
and the only responses from the latest contacted
NS matched.

reverted back the old behaviour where query case
is randomised when an outbound query is generated,
not before sending
parent aecffe74
......@@ -397,11 +397,6 @@ static int answer_finalize(struct kr_request *request, int state)
static int query_finalize(struct kr_request *request, struct kr_query *qry, knot_pkt_t *pkt)
{
/* Randomize query case (if not in safemode) */
qry->secret = (qry->flags & QUERY_SAFEMODE) ? 0 : kr_rand_uint(UINT32_MAX);
knot_dname_t *qname_raw = (knot_dname_t *)knot_pkt_qname(pkt);
randomized_qname_case(qname_raw, qry->secret);
int ret = 0;
knot_pkt_begin(pkt, KNOT_ADDITIONAL);
if (!(qry->flags & QUERY_SAFEMODE)) {
......@@ -831,6 +826,11 @@ ns_election:
return KNOT_STATE_PRODUCE;
}
/* Randomize query case (if not in safemode) */
qry->secret = (qry->flags & QUERY_SAFEMODE) ? 0 : kr_rand_uint(UINT32_MAX);
knot_dname_t *qname_raw = (knot_dname_t *)knot_pkt_qname(packet);
randomized_qname_case(qname_raw, qry->secret);
/*
* Additional query is going to be finalised when calling
* kr_resolve_checkout().
......
Markdown is supported
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