diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h index 818ae6c2ad..682e8de616 100644 --- a/lib/dns/include/dns/result.h +++ b/lib/dns/include/dns/result.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.h,v 1.80 2001/03/07 20:53:31 bwelling Exp $ */ +/* $Id: result.h,v 1.81 2001/05/10 17:51:49 gson Exp $ */ #ifndef DNS_RESULT_H #define DNS_RESULT_H 1 @@ -113,8 +113,9 @@ #define DNS_R_NOMASTERFILE (ISC_RESULTCLASS_DNS + 74) #define DNS_R_UNKNOWNPROTO (ISC_RESULTCLASS_DNS + 75) #define DNS_R_CLOCKSKEW (ISC_RESULTCLASS_DNS + 76) +#define DNS_R_BADIXFR (ISC_RESULTCLASS_DNS + 77) -#define DNS_R_NRESULTS 77 /* Number of results */ +#define DNS_R_NRESULTS 78 /* Number of results */ /* * DNS wire format rcodes. diff --git a/lib/dns/result.c b/lib/dns/result.c index 2dceeb6058..02c0360479 100644 --- a/lib/dns/result.c +++ b/lib/dns/result.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.88 2001/03/07 20:53:27 bwelling Exp $ */ +/* $Id: result.c,v 1.89 2001/05/10 17:51:48 gson Exp $ */ #include @@ -117,7 +117,8 @@ static const char *text[DNS_R_NRESULTS] = { "no master file configured", /* 74 DNS_R_NOMASTERFILE */ "unknown protocol", /* 75 DNS_R_UNKNOWNPROTO */ - "clocks are unsynchronized" /* 76 DNS_R_CLOCKSKEW */ + "clocks are unsynchronized", /* 76 DNS_R_CLOCKSKEW */ + "IXFR failed" /* 77 DNS_R_BADIXFR */ }; static const char *rcode_text[DNS_R_NRCODERESULTS] = { diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index f73d13942d..ea5ddec128 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrin.c,v 1.117 2001/05/10 16:27:14 gson Exp $ */ +/* $Id: xfrin.c,v 1.118 2001/05/10 17:51:44 gson Exp $ */ #include @@ -653,6 +653,9 @@ xfrin_fail(dns_xfrin_ctx_t *xfr, isc_result_t result, const char *msg) { if (result != DNS_R_UPTODATE) { xfrin_log(xfr, ISC_LOG_ERROR, "%s: %s", msg, isc_result_totext(result)); + if (xfr->is_ixfr) + /* Pass special result code to force AXFR retry */ + result = DNS_R_BADIXFR; } xfrin_cancelio(xfr); if (xfr->done != NULL) { @@ -731,8 +734,7 @@ xfrin_create(isc_mem_t *mctx, xfr->lasttsig = NULL; xfr->tsigctx = NULL; xfr->sincetsig = 0; - - /* is_ixfr */ + xfr->is_ixfr = ISC_FALSE; /* ixfr.request_serial */ /* ixfr.end_serial */ diff --git a/lib/dns/zone.c b/lib/dns/zone.c index b4a38c312d..cd9af0b91d 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.322 2001/05/09 05:20:28 marka Exp $ */ +/* $Id: zone.c,v 1.323 2001/05/10 17:51:46 gson Exp $ */ #include @@ -251,6 +251,7 @@ struct dns_zone { #define DNS_ZONEFLG_DIALNOTIFY 0x00020000U #define DNS_ZONEFLG_DIALREFRESH 0x00040000U #define DNS_ZONEFLG_SHUTDOWN 0x00080000U +#define DNS_ZONEFLAG_NOIXFR 0x00100000U /* IXFR failed, force AXFR */ #define DNS_ZONE_OPTION(z,o) (((z)->options & (o)) != 0) @@ -4719,6 +4720,11 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { break; + case DNS_R_BADIXFR: + /* Force retry with AXFR. */ + DNS_ZONE_SETFLAG(zone, DNS_ZONEFLAG_NOIXFR); + goto same_master; + default: zone->curmaster++; same_master: @@ -4900,6 +4906,14 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { "forced reload, requesting AXFR of " "initial version from %s", mastertext); xfrtype = dns_rdatatype_axfr; + } else if (DNS_ZONE_FLAG(zone, DNS_ZONEFLAG_NOIXFR)) { + dns_zone_log(zone, ISC_LOG_DEBUG(3), + "retrying with AXFR from %s due to " + "previous IXFR failure", mastertext); + xfrtype = dns_rdatatype_axfr; + LOCK_ZONE(zone); + DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLAG_NOIXFR); + UNLOCK_ZONE(zone); } else { isc_boolean_t use_ixfr = ISC_TRUE; if (peer != NULL && @@ -4967,7 +4981,6 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { dns_zone_detach(&zone); /* XXXAG */ return; - } /*