When a fetch result gets a delegation, `rctx_referral()` sets the
`rctx->get_nameserver = true`, which tells the resolver to retry another
server, not because of an error with the current server, but simply to
follow the delegation.
Update the comment of `rctx_nextserver()` which is quite confusing here
(as it's not immediately obvious from the code how we recurse when
getting a delegation back from a query).
Also add a log line, which helps figuring out this is happening.
* rctx_nextserver():
* We found something wrong with the remote server, but it may be
* useful to try another one.
+ * Or nothing is wrong, but the server returned a referral
+ * (rctx->get_nameservers has been set by rctx_referral()) so we need to try
+ * again with a new zonecut.
*/
static void
rctx_nextserver(respctx_t *rctx, dns_message_t *message,
if (rctx->next_server) {
UNLOCK(&fctx->lock);
+ FCTXTRACE("nextserver");
rctx_nextserver(rctx, message, addrinfo, result);
} else if (rctx->resend) {
UNLOCK(&fctx->lock);