mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
minor refactoring of resume_qmin() for clarity
make the code flow clearer by enumerating the result codes that are treated as success conditions for an intermediate minimized query (ISC_R_SUCCESS, DNS_R_DELEGATION, DNS_R_NXRRSET, etc), rather than just folding them all into the 'default' branch of a switch statement.
This commit is contained in:
@@ -4051,9 +4051,9 @@ fctx_try(fetchctx_t *fctx, bool retrying, bool badcache) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn on NOFOLLOW in relaxed mode so that QNAME minimisation
|
* Turn on NOFOLLOW in relaxed mode so that QNAME minimization
|
||||||
* doesn't cause additional queries to resolve the target of the
|
* doesn't cause additional queries to resolve the target of the
|
||||||
* QNAME minimisation request when a referral is returned. This
|
* QNAME minimization request when a referral is returned. This
|
||||||
* will also reduce the impact of mis-matched NS RRsets where
|
* will also reduce the impact of mis-matched NS RRsets where
|
||||||
* the child's NS RRset is garbage. If a delegation is
|
* the child's NS RRset is garbage. If a delegation is
|
||||||
* discovered DNS_R_DELEGATION will be returned to resume_qmin.
|
* discovered DNS_R_DELEGATION will be returned to resume_qmin.
|
||||||
@@ -4150,32 +4150,51 @@ resume_qmin(void *arg) {
|
|||||||
case ISC_R_SHUTTINGDOWN:
|
case ISC_R_SHUTTINGDOWN:
|
||||||
case ISC_R_CANCELED:
|
case ISC_R_CANCELED:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
case DNS_R_NXDOMAIN:
|
case DNS_R_NXDOMAIN:
|
||||||
case DNS_R_NCACHENXDOMAIN:
|
case DNS_R_NCACHENXDOMAIN:
|
||||||
case DNS_R_FORMERR:
|
case DNS_R_FORMERR:
|
||||||
case DNS_R_REMOTEFORMERR:
|
case DNS_R_REMOTEFORMERR:
|
||||||
case ISC_R_FAILURE:
|
case ISC_R_FAILURE:
|
||||||
if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) == 0) {
|
if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) != 0) {
|
||||||
/* Disable minimization in relaxed mode */
|
/* These results cause a hard fail in strict mode */
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ...or disable minimization in relaxed mode */
|
||||||
fctx->qmin_labels = DNS_NAME_MAXLABELS;
|
fctx->qmin_labels = DNS_NAME_MAXLABELS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We store the result. If we succeed in the end
|
* We store the result. If we succeed in the end
|
||||||
* we'll issue a warning that the server is
|
* we'll issue a warning that the server is
|
||||||
* broken.
|
* broken.
|
||||||
*/
|
*/
|
||||||
fctx->qmin_warning = result;
|
fctx->qmin_warning = result;
|
||||||
} else {
|
|
||||||
/* fail in strict mode */
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
case ISC_R_SUCCESS:
|
||||||
|
case DNS_R_DELEGATION:
|
||||||
|
case DNS_R_NXRRSET:
|
||||||
|
case DNS_R_NCACHENXRRSET:
|
||||||
|
case DNS_R_CNAME:
|
||||||
|
case DNS_R_DNAME:
|
||||||
/*
|
/*
|
||||||
* When DNS_FETCHOPT_NOFOLLOW is set and a delegation
|
* Any other result will *not* cause a failure in strict
|
||||||
* was discovered, DNS_R_DELEGATION is returned and is
|
* mode, or cause minimization to be disabled in relaxed
|
||||||
* processed here.
|
* mode.
|
||||||
|
*
|
||||||
|
* If DNS_R_DELEGATION is set here, it implies that
|
||||||
|
* DNS_FETCHOPT_NOFOLLOW was set, and a delegation was
|
||||||
|
* discovered but not followed; we will do so now.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
|
||||||
|
DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(5),
|
||||||
|
"QNAME minimization: unexpected result %s",
|
||||||
|
isc_result_totext(result));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dns_rdataset_isassociated(&fctx->nameservers)) {
|
if (dns_rdataset_isassociated(&fctx->nameservers)) {
|
||||||
|
Reference in New Issue
Block a user