Commit 60b8b3dd authored by Grigorii Demidov's avatar Grigorii Demidov Committed by Vladimír Čunát

lib/resolve: special processing for cname'ed DS answers in forward mode (*.vutbr.cz DS)

parent 0b3fc0f9
......@@ -1288,9 +1288,14 @@ int kr_resolve_produce(struct kr_request *request, struct sockaddr **dst, int *t
struct kr_query *qry = array_tail(rplan->pending);
if (qry->deferred != NULL) {
/* @todo: Refactoring validator, check trust chain before resuming. */
int state = (qry->flags & QUERY_FORWARD) ?
forward_trust_chain_check(request, qry, true) :
trust_chain_check(request, qry);
int state = 0;
if (((qry->flags & QUERY_FORWARD) == 0) ||
((qry->stype == KNOT_RRTYPE_DS) && (qry->flags & QUERY_CNAME))) {
state = trust_chain_check(request, qry);
} else {
state = forward_trust_chain_check(request, qry, true);
}
switch(state) {
case KR_STATE_FAIL: return KR_STATE_FAIL;
case KR_STATE_DONE: return KR_STATE_PRODUCE;
......
......@@ -759,13 +759,22 @@ void kr_dname_print(const knot_dname_t *name, const char *prefix, const char *po
{
char str[KNOT_DNAME_MAXLEN] = {0};
knot_dname_to_str(str, name, KNOT_DNAME_MAXLEN);
kr_log_verbose ("%s%s%s", prefix, str, postfix);
kr_log_verbose("%s%s%s", prefix, str, postfix);
}
void kr_rrtype_print(const uint16_t rrtype, const char *prefix, const char *postfix)
{
char str[32] = {0};
knot_rrtype_to_string(rrtype, str, 32);
kr_log_verbose ("%s%s%s", prefix, str, postfix);
kr_log_verbose("%s%s%s", prefix, str, postfix);
}
void kr_qry_print(const struct kr_query *qry, const char *prefix, const char *postfix)
{
char str[6] = {0};
knot_rrclass_to_string(qry->sclass, str, sizeof(str));
kr_dname_print(qry->sname, prefix, " ");
kr_log_verbose("%s",str);
kr_rrtype_print(qry->stype, " ", postfix);
}
......@@ -30,6 +30,8 @@
#include "lib/generic/array.h"
#include "lib/defines.h"
struct kr_query;
/*
* Logging and debugging.
*/
......@@ -255,6 +257,7 @@ int kr_ranked_rrarray_set_wire(ranked_rr_array_t *array, bool to_wire,
uint32_t qry_uid, bool check_dups);
void kr_rrset_print(const knot_rrset_t *rr, const char *prefix);
void kr_qry_print(const struct kr_query *qry, const char *prefix, const char *postfix);
void kr_pkt_print(knot_pkt_t *pkt);
void kr_dname_print(const knot_dname_t *name, const char *prefix, const char *postfix);
void kr_rrtype_print(const uint16_t rrtype, const char *prefix, const char *postfix);
......
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