Skip to content
Snippets Groups Projects
Commit f95e8e10 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

lib/resolve: fixed aborted rec when all IPv6 NS were bad

the query flags were cleared too early, and the rec never
retried if the NS had ipv6 addresses, but all were bad
parent b6c5f41d
No related branches found
No related tags found
No related merge requests found
......@@ -88,13 +88,15 @@ static int ns_resolve_addr(struct kr_query *qry, struct kr_request *param)
next_type = KNOT_RRTYPE_A;
qry->flags |= QUERY_AWAIT_IPV4;
/* Hmm, no useable IPv6 then. */
kr_nsrep_update_rep(&qry->ns, qry->ns.reputation | KR_NS_NOIP6, ctx->cache_rep);
qry->ns.reputation |= KR_NS_NOIP6;
kr_nsrep_update_rep(&qry->ns, qry->ns.reputation, ctx->cache_rep);
}
/* Bail out if the query is already pending or dependency loop. */
if (!next_type || kr_rplan_satisfies(qry->parent, qry->ns.name, KNOT_CLASS_IN, next_type)) {
/* No IPv4 nor IPv6, flag server as unuseable. */
DEBUG_MSG("=> unresolvable NS address, bailing out\n");
kr_nsrep_update_rep(&qry->ns, qry->ns.reputation | KR_NS_NOIP4, ctx->cache_rep);
qry->ns.reputation |= KR_NS_NOIP4 | KR_NS_NOIP6;
kr_nsrep_update_rep(&qry->ns, qry->ns.reputation, ctx->cache_rep);
invalidate_ns(rplan, qry);
return kr_error(EHOSTUNREACH);
}
......@@ -389,6 +391,8 @@ int kr_resolve_consume(struct kr_request *request, knot_pkt_t *packet)
struct timeval now;
gettimeofday(&now, NULL);
kr_nsrep_update_rtt(&qry->ns, time_diff(&qry->timestamp, &now), ctx->cache_rtt);
/* Sucessful answer, lift any address resolution requests. */
qry->flags &= ~(QUERY_AWAIT_IPV6|QUERY_AWAIT_IPV4);
}
/* Pop query if resolved. */
......@@ -482,9 +486,6 @@ ns_election:
}
knot_overlay_reset(&request->overlay);
return KNOT_STATE_PRODUCE;
} else {
/* Address resolved, clear the flag */
qry->flags &= ~(QUERY_AWAIT_IPV6|QUERY_AWAIT_IPV4);
}
#ifndef NDEBUG
......
......@@ -72,7 +72,7 @@ RANGE_END
RANGE_BEGIN 0 100
ADDRESS 1.1.1.1
EANGE_END
RANGE_END
; a.gtld-servers.net.
RANGE_BEGIN 0 100
......
......@@ -32,8 +32,6 @@ SECTION QUESTION
com. IN A
SECTION AUTHORITY
com. IN NS a.gtld-servers.net.
SECTION ADDITIONAL
a.gtld-servers.net. IN A 192.5.6.30
ENTRY_END
ENTRY_BEGIN
......@@ -49,14 +47,20 @@ ENTRY_END
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id copy_query
REPLY QR NOERROR
REPLY QR AA NOERROR
SECTION QUESTION
a.gtld-servers.net. IN AAAA
SECTION AUTHORITY
. SOA bla bla 1 2 3 4 5
SECTION ANSWER
; Intentional bad address
a.gtld-servers.net. IN AAAA 1:2:3::4
ENTRY_END
RANGE_END
; a.gtld-servers.net.
RANGE_BEGIN 0 100
ADDRESS 1:2:3::4
RANGE_END
; a.gtld-servers.net.
RANGE_BEGIN 0 100
ADDRESS 192.5.6.30
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment