* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.232 2000/10/13 13:45:43 marka Exp $ */
+/* $Id: zone.c,v 1.233 2000/10/16 04:05:43 marka Exp $ */
#include <config.h>
ISC_LINK(dns_notify_t) link;
};
-#ifndef NOMINUM_PUBLIC
#define DNS_NOTIFY_NOSOA 0x0001U
-#endif /* NOMINUM_PUBLIC */
/*
* dns_stub holds state while performing a 'stub' transfer.
static void notify_cancel(dns_zone_t *zone);
static void notify_find_address(dns_notify_t *notify);
static void notify_send(dns_notify_t *notify);
-#ifdef NOMINUM_PUBLIC
-static isc_result_t notify_createmessage(dns_zone_t *zone,
- dns_message_t **messagep);
-#else /* NOMINUM_PUBLIC */
static isc_result_t notify_createmessage(dns_zone_t *zone,
unsigned int flags,
dns_message_t **messagep);
+#ifndef NOMINUM_PUBLIC
static void zone_notifyforward(dns_zone_t *zone);
#endif /* NOMINUM_PUBLIC */
static void notify_done(isc_task_t *task, isc_event_t *event);
}
static isc_result_t
-notify_create(isc_mem_t *mctx, dns_notify_t **notifyp) {
+notify_create(isc_mem_t *mctx, unsigned int flags, dns_notify_t **notifyp) {
dns_notify_t *notify;
REQUIRE(notifyp != NULL && *notifyp == NULL);
notify->mctx = NULL;
isc_mem_attach(mctx, ¬ify->mctx);
-#ifndef NOMINUM_PUBLIC
- notify->flags = 0;
-#endif /* NOMINUM_PUBLIC */
+ notify->flags = flags;
notify->zone = NULL;
notify->find = NULL;
notify->request = NULL;
goto cleanup;
}
-#ifdef NOMINUM_PUBLIC
- result = notify_createmessage(notify->zone, &message);
-#else /* NOMINUM_PUBLIC */
result = notify_createmessage(notify->zone, notify->flags, &message);
-#endif /* NOMINUM_PUBLIC */
if (result != ISC_R_SUCCESS)
goto cleanup;
if (notify_isqueued(notify->zone, NULL, &dst))
continue;
new = NULL;
- result = notify_create(notify->mctx, &new);
+ result = notify_create(notify->mctx,
+ (notify->flags & DNS_NOTIFY_NOSOA),
+ &new);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_zone_iattach(notify->zone, &new->zone);
dst = zone->masters[i];
if (notify_isqueued(zone, NULL, &dst))
continue;
- result = notify_create(zone->mctx, ¬ify);
+ result = notify_create(zone->mctx, DNS_NOTIFY_NOSOA, ¬ify);
if (result != ISC_R_SUCCESS) {
return;
}
dns_zone_iattach(zone, ¬ify->zone);
notify->dst = dst;
- notify->flags |= DNS_NOTIFY_NOSOA;
ISC_LIST_APPEND(zone->notifies, notify, link);
result = notify_send_queue(notify);
if (result != ISC_R_SUCCESS) {
isc_sockaddr_t dst;
isc_boolean_t isqueued;
dns_notifytype_t notifytype;
+ unsigned int flags = 0;
REQUIRE(DNS_ZONE_VALID(zone));
origin = &zone->origin;
+ /*
+ * If the zone is dialup we are done as we don't want to send
+ * the current soa so as to force a refresh query.
+ */
+ if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_DIALUP))
+ flags |= DNS_NOTIFY_NOSOA;
+
/*
* Enqueue notify requests for 'also-notify' servers.
*/
dst = zone->notify[i];
if (notify_isqueued(zone, NULL, &dst))
continue;
- result = notify_create(zone->mctx, ¬ify);
+ result = notify_create(zone->mctx, flags, ¬ify);
if (result != ISC_R_SUCCESS) {
UNLOCK(&zone->lock);
return;
result = dns_rdataset_next(&nsrdset);
continue;
}
- result = notify_create(zone->mctx, ¬ify);
+ result = notify_create(zone->mctx, flags, ¬ify);
if (result != ISC_R_SUCCESS)
continue;
dns_zone_iattach(zone, ¬ify->zone);
}
static isc_result_t
-#ifdef NOMINUM_PUBLIC
-notify_createmessage(dns_zone_t *zone, dns_message_t **messagep)
-#else /* NOMINUM_PUBLIC */
notify_createmessage(dns_zone_t *zone, unsigned int flags,
dns_message_t **messagep)
-#endif /* NOMINUM_PUBLIC */
{
dns_dbnode_t *node = NULL;
dns_dbversion_t *version = NULL;
tempname = NULL;
temprdataset = NULL;
-#ifndef NOMINUM_PUBLIC
if ((flags & DNS_NOTIFY_NOSOA) != 0)
goto done;
-#endif /* NOMINUM_PUBLIC */
- /*
- * If the zone is dialup we are done as we don't want to send
- * the current soa so as to force a refresh query.
- */
- if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_DIALUP))
- goto done;
result = dns_message_gettempname(message, &tempname);
if (result != ISC_R_SUCCESS)
notify_log(notify->zone, ISC_LOG_INFO,
"NOTIFY to %s failed: %s", addrbuf,
dns_result_totext(result));
- if (message != NULL)
- dns_message_destroy(&message);
+ /*
+ * Old bind's return formerr if they see a soa record. Retry w/o
+ * the soa if we see a formerr and had sent a SOA.
+ */
isc_event_free(&event);
- if (result == ISC_R_TIMEDOUT && notify->attempt < 3) {
+ if ((result == ISC_R_TIMEDOUT ||
+ (message != NULL && message->rcode == dns_rcode_formerr &&
+ (notify->flags & DNS_NOTIFY_NOSOA) == 0)) &&
+ notify->attempt < 3) {
+ notify->flags |= DNS_NOTIFY_NOSOA;
notify->attempt++;
dns_request_destroy(¬ify->request);
notify_send_queue(notify);
"NOTIFY to %s: retries exceeded", addrbuf);
notify_destroy(notify, ISC_FALSE);
}
+ if (message != NULL)
+ dns_message_destroy(&message);
}
isc_result_t