zone.c revision 694d98c14307ef425727507eaed3e2bf9eba56eb
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Copyright (C) 1999, 2000 Internet Software Consortium.
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Permission to use, copy, modify, and distribute this software for any
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * purpose with or without fee is hereby granted, provided that the above
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * copyright notice and this permission notice appear in all copies.
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer/* $Id: zone.c,v 1.209 2000/09/12 01:22:12 marka Exp $ */
1893b56ef9f5f2bc2a0fbe80d3c6b69df1bdc7c2Michael Sawyer#define FORWARD_MAGIC ISC_MAGIC('F','o','r','w')
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define RANGE(a, b, c) (((a) < (b)) ? (b) : ((a) < (c) ? (a) : (c)))
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Default values.
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer /* Unlocked */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer unsigned int magic;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer ISC_LINK(dns_zone_t) link; /* Used by zmgr. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int erefs;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int irefs;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int flags;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer /* Access Control Lists */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Zones in certain states such as "waiting for zone transfer"
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * or "zone transfer in progress" are kept on per-state linked lists
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * in the zone manager using the 'statelink' field. The 'statelist'
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * field points at the list the zone is currently on. It the zone
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * is not on any such list, statelist is NULL.
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_ZONE_FLAG(z,f) (((z)->flags & (f)) != 0)
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer /* XXX MPA these may need to go back into zone.h */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_REFRESH 0x00000001U /* refresh check in progress */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_NEEDDUMP 0x00000002U /* zone need consolidation */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_ZONEFLG_USEVC 0x00000004U /* use tcp for refresh query */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer/* #define DNS_ZONEFLG_UNUSED 0x00000008U */ /* unused */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer/* #define DNS_ZONEFLG_UNUSED 0x00000010U */ /* unused */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_LOADED 0x00000020U /* database has loaded */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_EXITING 0x00000040U /* zone is being destroyed */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_ZONEFLG_EXPIRED 0x00000080U /* zone has expired */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_NEEDREFRESH 0x00000100U /* refresh check needed */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_ZONEFLG_UPTODATE 0x00000200U /* zone contents are
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * uptodate */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_NEEDNOTIFY 0x00000400U /* need to send out notify
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * messages */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_DIFFONRELOAD 0x00000800U /* generate a journal diff on
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_NOMASTERS 0x00001000U /* an attempt to refresh a
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * zone with no masters
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#define DNS_ZONEFLG_LOADING 0x00002000U /* load from disk in progress */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#define DNS_ZONE_OPTION(z,o) (((z)->options & (o)) != 0)
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int magic;
d821f1cd7e97552401296e880e7518c98c9ebea1Michael Sawyer /* Locked by rwlock. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer /* Locked by conflock. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Hold notify state.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int flags;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * dns_stub holds state while performing a 'stub' transfer.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * 'db' is the zone's 'db' or a new one if this is the initial
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Hold load state.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Hold forward state.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic isc_result_t zone_settimer(dns_zone_t *, isc_stdtime_t);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_log(dns_zone_t *zone, const char *, int, const char *msg,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void notify_log(dns_zone_t *zone, int level, const char *fmt, ...);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_deletefile(dns_zone_t *zone);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic isc_result_t zone_replacedb(dns_zone_t *zone, dns_db_t *db,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic isc_result_t default_journal(dns_zone_t *zone);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_xfrdone(dns_zone_t *zone, isc_result_t result);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic isc_result_t zone_postload(dns_zone_t *zone, dns_db_t *db,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_shutdown(isc_task_t *, isc_event_t *);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_loaddone(void *arg, isc_result_t result);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic isc_result_t zone_startload(dns_db_t *db, dns_zone_t *zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer/* ondestroy example */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void dns_zonemgr_dbdestroyed(isc_task_t *task, isc_event_t *event);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void refresh_callback(isc_task_t *, isc_event_t *);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void stub_callback(isc_task_t *, isc_event_t *);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void queue_soa_query(dns_zone_t *zone);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void soa_query(isc_task_t *, isc_event_t *);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic int message_count(dns_message_t *msg, dns_section_t section,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerstatic void notify_find_address(dns_notify_t *notify);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void notify_send(dns_notify_t *notify);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerstatic isc_result_t notify_createmessage(dns_zone_t *zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#else /* NOMINUM_PUBLIC */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerstatic isc_result_t notify_createmessage(dns_zone_t *zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int flags,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerstatic void zone_notifyforward(dns_zone_t *zone);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer#endif /* NOMINUM_PUBLIC */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerstatic void notify_done(isc_task_t *task, isc_event_t *event);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerstatic void notify_send_toaddr(isc_task_t *task, isc_event_t *event);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic void got_transfer_quota(isc_task_t *task, isc_event_t *event);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr,
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic void zmgr_resume_xfrs(dns_zonemgr_t *zmgr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic void zonemgr_free(dns_zonemgr_t *zmgr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerzone_get_from_db(dns_db_t *db, dns_name_t *origin, unsigned int *nscount,
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer unsigned int *soacount, isc_uint32_t *serial,
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer isc_uint32_t *expire, isc_uint32_t *minimum);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic void zone_freedbargs(dns_zone_t *zone);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerstatic void forward_callback(isc_task_t *task, isc_event_t *event);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#define ZONE_LOG(x,y) zone_log(zone, me, ISC_LOG_DEBUG(x), y)
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#define DNS_ENTER zone_log(zone, me, ISC_LOG_DEBUG(1), "enter")
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#define DNS_LEAVE zone_log(zone, me, ISC_LOG_DEBUG(1), "leave")
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer *** Public functions.
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerdns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer "isc_mutex_init() failed: %s",
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer /* XXX MPA check that all elements are initialised */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#endif /* NOMINUM_PUBLIC */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#endif /* NOMINUM_PUBLIC */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#endif /* NOMINUM_PUBLIC */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer /* Must be after magic is set. */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_zone_setdbtype(zone, dbargc_default, dbargv_default);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer ISC_EVENT_INIT(&zone->ctlevent, sizeof(zone->ctlevent), 0, NULL,
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer DNS_EVENT_ZONECONTROL, zone_shutdown, zone, zone,
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer * Free a zone. Because we require that there be no more
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer * outstanding events or references, no locking is necessary.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Managed objects. Order is important.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_request_destroy(&zone->request); /* XXXMPA */
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer /* Unmanaged objects */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_zone_setmasterswithkeys(zone, NULL, NULL, 0);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#else /* NOMINUM_PUBLIC */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer#endif /* NOMINUM_PUBLIC */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer#endif /* NOMINUM_PUBLIC */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer /* last stuff */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer * Single shot.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerdns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass) {
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer * Test and set.
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer REQUIRE(zone->rdclass == dns_rdataclass_none ||
d821f1cd7e97552401296e880e7518c98c9ebea1Michael Sawyerdns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype) {
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Single shot.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerdns_zone_settype(dns_zone_t *zone, dns_zonetype_t type) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Test and set.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer REQUIRE(zone->type == dns_zone_none || zone->type == type);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int i;
d821f1cd7e97552401296e880e7518c98c9ebea1Michael Sawyer /* Free the old database argument list. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int dbargc, const char * const *dbargv) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer unsigned int i;
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer /* Set up a new database argument list. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer new = isc_mem_get(zone->mctx, dbargc * sizeof *new);
d821f1cd7e97552401296e880e7518c98c9ebea1Michael Sawyer for (i = 0; i < dbargc; i++)
f8fec75ee8f429821137aee090f56ab678404a56Michael Sawyer for (i = 0; i < dbargc; i++) {
6c6a62933dda281cb9193de1d54d4c9e74515f5aMichael Sawyer new[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer /* Free the old list. */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer for (i = 0; i < dbargc; i++) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerdns_zone_setview(dns_zone_t *zone, dns_view_t *view) {
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerdns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin) {
9fe3676b8490319aa65182f2072cbf5086097979Michael Sawyer result = dns_name_dup(origin, zone->mctx, &zone->origin);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerdns_zone_setdatabase(dns_zone_t *zone, const char *dbname) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer zone->dbname = isc_mem_strdup(zone->mctx, dbname);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer len = strlen(zone->dbname) + sizeof ".jnl"; /* includes '\0' */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer zone->journal = isc_mem_allocate(zone->mctx, len);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyerdns_zone_setjournal(dns_zone_t *zone, const char *journal) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer zone->journal = isc_mem_strdup(zone->mctx, journal);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * The zone has no master file (maybe it is the built-in
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * version.bind. CH zone). Do nothing.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer zone_log(zone, me, ISC_LOG_DEBUG(1), "start");
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Don't do the load if the file that stores the zone is older
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * than the last time the zone was loaded. If the zone has not
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * been loaded yet, zone->loadtime will be the epoch.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = isc_file_getmodtime(zone->dbname, &filetime);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer if (result == ISC_R_SUCCESS && ! isc_time_isepoch(&zone->loadtime) &&
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer isc_time_compare(&filetime, &zone->loadtime) < 0) {
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer "skipping: database file older than last load");
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * Store the current time before the zone is loaded, so that if the
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * file changes between the time of the load and the time that
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * zone->loadtime is set, then the file will still be reloaded
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer * the next time dns_zone_load is called.
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_db_create(zone->mctx, zone->db_argv[0],
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer &zone->origin, (zone->type == dns_zone_stub) ?
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer result = zone_postload(zone, db, loadtime, result);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerzone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
6c6a62933dda281cb9193de1d54d4c9e74515f5aMichael Sawyer if (zone->view != NULL && zone->view->loadmgr != NULL &&
ad7bb5bff3e796f5648835bf87a203d23d8319e4David Lawrence load = isc_mem_get(zone->mctx, sizeof(*load));
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_db_beginload(db, &load->callbacks.add,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_master_loadfilequota(zone->dbname,
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer if (result != DNS_R_CONTINUE && result != ISC_R_SUCCESS) {
db8b100cae62de849ecf4ba9ad3be811fb375b53Michael Sawyer isc_mem_put(zone->mctx, load, sizeof(*load));
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerzone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
unsigned int soacount = 0;
unsigned int nscount = 0;
goto cleanup;
goto cleanup;
goto cleanup;
nscount = 0;
soacount = 0;
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
goto cleanup;
if (nscount == 0)
isc_time_t t;
goto cleanup;
zone,
sizeof(isc_event_t));
goto cleanup;
return (result);
static isc_result_t
unsigned int *nscount)
unsigned int count;
*nscount = 0;
goto invalidate_rdataset;
goto invalidate_rdataset;
count = 0;
count++;
return (result);
static isc_result_t
unsigned int *soacount,
unsigned int count;
goto invalidate_rdataset;
count = 0;
count++;
if (count > 0) {
return (result);
static isc_result_t
goto closeversion;
minimum);
return (answer);
if (free_now)
if (value)
if (value)
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
goto unlock;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
return (result);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
sizeof(dns_name_t));
if (count == 0)
goto unlock;
goto unlock;
#ifndef NOMINUM_PUBLIC
goto unlock;
for (i = 0; i < count; i++)
for (i = 0; i < count; i++) {
sizeof(dns_name_t));
goto allocfail;
newname[i]);
for (i = 0; i < count; i++)
newname[i],
goto unlock;
return (result);
return (result);
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_master:
case dns_zone_master:
case dns_zone_slave:
return (result);
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
return (result);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
static isc_boolean_t
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (ISC_R_NOMEMORY);
#ifndef NOMINUM_PUBLIC
return (ISC_R_SUCCESS);
goto detach;
goto detach;
unsigned int options;
goto destroy;
goto destroy;
goto detach;
goto detach;
static isc_result_t
isc_event_t *e;
if (e == NULL)
return (ISC_R_NOMEMORY);
isc_event_free(&e);
return (result);
goto cleanup;
goto cleanup;
#ifdef NOMINUM_PUBLIC
goto cleanup;
goto cleanup;
goto cleanup;
#ifndef NOMINUM_PUBLIC
goto cleanup1;
goto cleanup2;
goto cleanup3;
goto cleanup3;
if (isqueued) {
static inline isc_result_t
goto fail;
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto same_master;
goto next_master;
if (cnamecnt != 0) {
goto next_master;
if (nscnt == 0) {
goto next_master;
goto next_master;
goto free_stub;
goto free_stub;
goto free_stub;
goto detach;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
master);
goto tcp_transfer;
master);
goto next_master;
goto same_master;
goto next_master;
if (cnamecnt != 0) {
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
isc_time_t t;
goto next_master;
goto next_master;
isc_event_t *e;
if (e == NULL) {
isc_event_free(&e);
static inline isc_result_t
&message);
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
goto cleanup;
DNS_REQUESTOPT_TCP : 0;
goto cleanup;
goto cleanup;
goto cleanup;
&node);
goto cleanup;
goto cleanup;
goto cleanup;
static isc_result_t
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
if (next == 0) {
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
#ifdef NOMINUM_PUBLIC
isc_region_t r;
&message);
return (result);
goto cleanup;
goto cleanup;
#ifndef NOMINUM_PUBLIC
goto done;
goto done;
goto soa_cleanup;
goto soa_cleanup;
goto soa_cleanup;
goto soa_cleanup;
goto soa_cleanup;
NULL);
goto soa_cleanup;
goto soa_cleanup;
goto soa_cleanup;
isc_buffer_usedregion(b, &r);
goto soa_cleanup;
goto soa_cleanup;
done:
return (ISC_R_SUCCESS);
return (result);
#ifndef NOMINUM_PUBLIC
int match = 0;
return (DNS_R_FORMERR);
return (DNS_R_NOTIMP);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
return (DNS_R_REFUSED);
&rdataset);
fromtext);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
if (forward) {
return (ISC_R_SUCCESS);
fromtext);
return (ISC_R_SUCCESS);
fromtext);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
int count = 0;
count++;
return (count);
if (idlein == 0)
if (idleout == 0)
ISC_TRUE);
return (result);
static isc_result_t
goto fail;
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
unsigned int soacount;
unsigned int nscount;
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_UPTODATE:
isc_time_t t;
nscount = 0;
soacount = 0;
if (nscount == 0)
#ifndef NOMINUM_PUBLIC
case DNS_R_ZONETOOLARGE:
goto cleanup;
#ifndef NOMINUM_PUBLIC
static isc_result_t
return (ISC_R_NOMORE);
return (result);
goto next_master;
goto next_master;
goto next_master;
case dns_rcode_noerror:
case dns_rcode_yxdomain:
case dns_rcode_yxrrset:
case dns_rcode_nxrrset:
case dns_rcode_refused:
case dns_rcode_nxdomain:
case dns_rcode_notzone:
case dns_rcode_notauth: {
goto next_master;
case dns_rcode_formerr:
case dns_rcode_servfail:
case dns_rcode_notimp:
case dns_rcode_badvers:
goto next_master;
return (ISC_R_NOMEMORY);
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
return (ISC_R_NOMEMORY);
goto free_mem;
goto free_rwlock;
goto free_conflock;
goto free_taskpool;
goto free_task;
return (ISC_R_SUCCESS);
return (result);
goto cleanup_task;
goto unlock;
return (result);
if (free_now)
if (free_now)
dns_zone_t *p;
p != NULL;
return (ISC_R_SUCCESS);
static isc_result_t
dns_zone_t *x;
isc_event_t *e;
x != NULL;
nxfrsin++;
nxfrsperns++;
return (ISC_R_QUOTA);
return (ISC_R_QUOTA);
sizeof(isc_event_t));
if (e == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);