From 5739b4817ac801c1a1375e125fd59950efdd9457 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 19 May 2023 12:22:51 +1000 Subject: [PATCH] In rctx_answer return DNS_R_DELEGATION on NOFOLLOW When DNS_FETCHOPT_NOFOLLOW is set DNS_R_DELEGATION needs to be returned to restart the resolution process rather than converting it to ISC_R_SUCCESS. (cherry picked from commit ea116503761bf46b1de809681fbd6924fc6cfa86) --- lib/dns/resolver.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index a1cf3c7fbf..25e402408e 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -8005,7 +8005,8 @@ resquery_response(isc_result_t eresult, isc_region_t *region, void *arg) { break; case DNS_R_DELEGATION: /* - * With NOFOLLOW we want to pass the result code. + * With NOFOLLOW we want to pass return + * DNS_R_DELEGATION to resume_qmin. */ if ((fctx->options & DNS_FETCHOPT_NOFOLLOW) == 0) { result = ISC_R_SUCCESS; @@ -8549,6 +8550,14 @@ rctx_answer(respctx_t *rctx) { } if (result == DNS_R_DELEGATION) { + /* + * With NOFOLLOW we want to return DNS_R_DELEGATION to + * resume_qmin. + */ + if ((rctx->fctx->options & DNS_FETCHOPT_NOFOLLOW) != 0) + { + return (result); + } result = ISC_R_SUCCESS; } else { /* @@ -8590,7 +8599,7 @@ rctx_answer_positive(respctx_t *rctx) { isc_result_t result; fetchctx_t *fctx = rctx->fctx; - FCTXTRACE("rctx_answer"); + FCTXTRACE("rctx_answer_positive"); rctx_answer_init(rctx); rctx_answer_scan(rctx);