From: Aram Sargsyan Date: Wed, 21 May 2025 14:44:50 +0000 (+0000) Subject: Fix a zone refresh bug in zone.c:refresh_callback() X-Git-Tag: v9.21.9~33^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=228e441328af8f3a54c1ae3f0cd7b871dab83609;p=thirdparty%2Fbind9.git Fix a zone refresh bug in zone.c:refresh_callback() When the zone.c:refresh_callback() callback function is called during a SOA request before a zone transfer, it can receive a ISC_R_SHUTTINGDOWN result for the sent request when named is shutting down, and in that case it just destroys the request and finishes the ongoing transfer, without clearing the DNS_ZONEFLG_REFRESH flag of the zone. This is alright when named is going to shutdown, but currently the callback can get a ISC_R_SHUTTINGDOWN result also when named is reconfigured during the ongoibg SOA request. In that case, leaving the DNS_ZONEFLG_REFRESH flag set results in the zone never being able to refresh again, because any new attempts will be caneled while the flag is set. Clear the DNS_ZONEFLG_REFRESH flag on the 'exiting' error path of the callback function. --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 79738fe595c..bffd7f4673c 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -14283,6 +14283,17 @@ next_primary: goto detach; exiting: + /* + * We can get here not only during shutdown, but also when the refresh + * is canceled during reconfiguration. In that case, make sure to clear + * the DNS_ZONEFLG_REFRESH flag so that future zone refreshes don't get + * stuck, and make sure a new refresh attempt is made again soon after + * the reconfiguration is complete. + */ + DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH); + zone->refreshtime = now; + zone_settimer(zone, &now); + dns_request_destroy(&zone->request); goto detach;