zone.c revision 3d509f54ac6bbcc19de5aa6d1ce37e001821dc7b
1b5a34533410ff4eaff0e5b5b110221a97e29cfcAutomatic Updater * Copyright (C) 1999, 2000 Internet Software Consortium.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * copyright notice and this permission notice appear in all copies.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews/* $Id: zone.c,v 1.279 2000/12/13 07:18:44 tale Exp $ */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define ZONEMGR_MAGIC 0x5a6d6772U /* Zmgr */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define LOAD_MAGIC ISC_MAGIC('L','o','a','d')
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define FORWARD_MAGIC ISC_MAGIC('F','o','r','w')
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define RANGE(a, b, c) (((a) < (b)) ? (b) : ((a) < (c) ? (a) : (c)))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Default values.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#define DNS_DEFAULT_IDLEIN 3600 /* 1 hour */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#define DNS_DEFAULT_IDLEOUT 3600 /* 1 hour */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington do { (z)->locked = ISC_FALSE; UNLOCK(&(z)->lock); } while (0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Unlocked */
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews unsigned int magic;
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington ISC_LINK(dns_zone_t) link; /* Used by zmgr. */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington /* Access Control Lists */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Zones in certain states such as "waiting for zone transfer"
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * or "zone transfer in progress" are kept on per-state linked lists
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * in the zone manager using the 'statelink' field. The 'statelist'
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * field points at the list the zone is currently on. It the zone
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * is not on any such list, statelist is NULL.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Optional per-zone statistics counters (NULL if not present).
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ZONE_FLAG(z,f) (ISC_TF(((z)->flags & (f)) != 0))
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONE_SETFLAG(z,f) do { \
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington (z)->flags |= (f); \
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington#define DNS_ZONE_CLRFLAG(z,f) do { \
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington (z)->flags &= ~(f); \
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington /* XXX MPA these may need to go back into zone.h */
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington#define DNS_ZONEFLG_REFRESH 0x00000001U /* refresh check in progress */
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington#define DNS_ZONEFLG_NEEDDUMP 0x00000002U /* zone need consolidation */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ZONEFLG_USEVC 0x00000004U /* use tcp for refresh query */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_DUMPING 0x00000008U /* a dump is in progress */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_HASINCLUDE 0x00000010U /* $INCLUDE in zone file */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_LOADED 0x00000020U /* database has loaded */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_EXITING 0x00000040U /* zone is being destroyed */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_EXPIRED 0x00000080U /* zone has expired */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_NEEDREFRESH 0x00000100U /* refresh check needed */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_UPTODATE 0x00000200U /* zone contents are
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * uptodate */
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONEFLG_NEEDNOTIFY 0x00000400U /* need to send out notify
18d0b5e54be891a1aa938c165b6d439859121ec8Mark Andrews * messages */
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONEFLG_DIFFONRELOAD 0x00000800U /* generate a journal diff on
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ZONEFLG_NOMASTERS 0x00001000U /* an attempt to refresh a
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * zone with no masters
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONEFLG_LOADING 0x00002000U /* load from disk in progress*/
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONEFLG_HAVETIMERS 0x00004000U /* timer values have been set
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * from SOA (if not set, we
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * are still using
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * default timer values) */
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONEFLG_FORCEXFER 0x00008000U /* Force a zone xfer */
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#define DNS_ZONE_OPTION(z,o) (((z)->options & (o)) != 0)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington /* Locked by rwlock. */
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington /* Locked by conflock. */
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews /* Locked by iolock */
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson * Hold notify state.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * dns_stub holds state while performing a 'stub' transfer.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * 'db' is the zone's 'db' or a new one if this is the initial
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Hold load state.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Hold forward state.
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson * Hold IO request state.
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_settimer(dns_zone_t *, isc_stdtime_t);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_log(dns_zone_t *zone, const char *, int, const char *msg,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void notify_log(dns_zone_t *zone, int level, const char *fmt, ...);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void queue_xfrin(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_unload(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_expire(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_iattach(dns_zone_t *source, dns_zone_t **target);
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrewsstatic isc_result_t zone_replacedb(dns_zone_t *zone, dns_db_t *db,
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrewsstatic isc_result_t default_journal(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_xfrdone(dns_zone_t *zone, isc_result_t result);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic isc_result_t zone_postload(dns_zone_t *zone, dns_db_t *db,
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellingtonstatic void zone_needdump(dns_zone_t *zone, unsigned int delay);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellingtonstatic void zone_shutdown(isc_task_t *, isc_event_t *);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellingtonstatic void zone_loaddone(void *arg, isc_result_t result);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellingtonstatic isc_result_t zone_startload(dns_db_t *db, dns_zone_t *zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington/* ondestroy example */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void dns_zonemgr_dbdestroyed(isc_task_t *task, isc_event_t *event);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void refresh_callback(isc_task_t *, isc_event_t *);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void stub_callback(isc_task_t *, isc_event_t *);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void queue_soa_query(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void soa_query(isc_task_t *, isc_event_t *);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic int message_count(dns_message_t *msg, dns_section_t section,
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrewsstatic void notify_find_address(dns_notify_t *notify);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void notify_send(dns_notify_t *notify);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic isc_result_t notify_createmessage(dns_zone_t *zone,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_notifyforward(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#endif /* NOMINUM_PUBLIC */
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void notify_done(isc_task_t *task, isc_event_t *event);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void notify_send_toaddr(isc_task_t *task, isc_event_t *event);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void got_transfer_quota(isc_task_t *task, isc_event_t *event);
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellingtonstatic isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zmgr_resume_xfrs(dns_zonemgr_t *zmgr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zonemgr_free(dns_zonemgr_t *zmgr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrewsstatic isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonzone_get_from_db(dns_db_t *db, dns_name_t *origin, unsigned int *nscount,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington unsigned int *soacount, isc_uint32_t *serial,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_uint32_t *refresh, isc_uint32_t *retry,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_uint32_t *expire, isc_uint32_t *minimum);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void zone_freedbargs(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void forward_callback(isc_task_t *task, isc_event_t *event);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_saveunique(dns_zone_t *zone, const char *path,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void zone_maintenance(dns_zone_t *zone);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void zone_notify(dns_zone_t *zone);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define ZONE_LOG(x,y) zone_log(zone, me, ISC_LOG_DEBUG(x), y)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ENTER zone_log(zone, me, ISC_LOG_DEBUG(1), "enter")
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_LEAVE zone_log(zone, me, ISC_LOG_DEBUG(1), "leave")
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington *** Public functions.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington "isc_mutex_init() failed: %s",
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington /* XXX MPA check that all elements are initialised */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone->sigvalidityinterval = 30 * 24 * 3600;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Must be after magic is set. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_setdbtype(zone, dbargc_default, dbargv_default);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_EVENT_INIT(&zone->ctlevent, sizeof(zone->ctlevent), 0, NULL,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_EVENT_ZONECONTROL, zone_shutdown, zone, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Free a zone. Because we require that there be no more
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * outstanding events or references, no locking is necessary.
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington * Managed objects. Order is important.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_request_destroy(&zone->request); /* XXXMPA */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Unmanaged objects */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_mem_free(zone->mctx, zone->masterfile);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_stats_freecounters(zone->mctx, &zone->counters);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setmasterswithkeys(zone, NULL, NULL, 0);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* last stuff */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Single shot.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Test and set.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington REQUIRE(zone->rdclass == dns_rdataclass_none ||
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Single shot.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zone_settype(dns_zone_t *zone, dns_zonetype_t type) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Test and set.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington REQUIRE(zone->type == dns_zone_none || zone->type == type);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington unsigned int i;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Free the old database argument list. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_mem_free(zone->mctx, zone->db_argv[i]);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington unsigned int dbargc, const char * const *dbargv) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington unsigned int i;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Set up a new database argument list. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington new = isc_mem_get(zone->mctx, dbargc * sizeof *new);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington for (i = 0; i < dbargc; i++)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington for (i = 0; i < dbargc; i++) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington new[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington /* Free the old list. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington for (i = 0; i < dbargc; i++) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zone_setview(dns_zone_t *zone, dns_view_t *view) {
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellingtondns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin) {
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington result = dns_name_dup(origin, zone->mctx, &zone->origin);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zone_setstring(dns_zone_t *zone, char **field, const char *value) {
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellingtondns_zone_setfile(dns_zone_t *zone, const char *file) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_setstring(zone, &zone->masterfile, file);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* Calculate string length including '\0'. */
7a6f285bc933d08353d2f18290c85def575b6e57Andreas Gustafsson int len = strlen(zone->masterfile) + sizeof ".jnl";
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington journal = isc_mem_allocate(zone->mctx, len);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_setstring(zone, &zone->journal, journal);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zone_setjournal(dns_zone_t *zone, const char *journal) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_setstring(zone, &zone->journal, journal);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Return true iff the zone is "dynamic", in the sense that the zone's
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * master file (if any) is written by the server, rather than being
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * updated manually and read by the server.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * This is true for slave zones, stub zones, and zones that allow
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * dynamic updates either by having an update policy ("ssutable")
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * or an "allow-update" ACL with a value other than exactly "{ none; }".
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (ISC_TF(zone->type == dns_zone_slave ||
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone->update_acl->elements[0].negative == ISC_TRUE
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (zone->db != NULL && zone->masterfile == NULL) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * The zone has no master file configured, but it already
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * has a database. It could be the built-in
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * version.bind. CH zone, a zone with a persistent
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * database being reloaded, or maybe a zone that
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * used to have a master file but whose configuration
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * was changed so that it no longer has one. Do nothing.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (zone->db != NULL && zone_isdynamic(zone)) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * This is a slave, stub, or dynamically updated
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * zone being reloaded. Do nothing - the database
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * we already have is guaranteed to be up-to-date.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_log(zone, me, ISC_LOG_DEBUG(1), "start");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Don't do the load if the file that stores the zone is older
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * than the last time the zone was loaded. If the zone has not
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * been loaded yet, zone->loadtime will be the epoch.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ! DNS_ZONE_FLAG(zone, DNS_ZONEFLG_HASINCLUDE)) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = isc_file_getmodtime(zone->masterfile, &filetime);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_time_compare(&filetime, &zone->loadtime) < 0) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "skipping: master file older"
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington " than last load");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Store the current time before the zone is loaded, so that if the
b7cd261f2fca2c7138cdc6ae8ee434e9c0031303Brian Wellington * file changes between the time of the load and the time that
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * zone->loadtime is set, then the file will still be reloaded
cfcb0881d12db2b7cb33475b7d20ac6c9015203bMark Andrews * the next time dns_zone_load is called.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_db_create(zone->mctx, zone->db_argv[0],
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington &zone->origin, (zone->type == dns_zone_stub) ?
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "creating database: %s", isc_result_totext(result));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = zone_startload(db, zone, loadtime);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "no master file configured");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADING);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = zone_postload(zone, db, loadtime, result);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonzone_gotreadhandle(isc_task_t *task, isc_event_t *event) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if ((event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_master_loadfileinc(load->zone->masterfile,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && result != DNS_R_CONTINUE &&
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonzone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (zone->zmgr != NULL && zone->db != NULL && zone->task != NULL) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington load = isc_mem_get(zone->mctx, sizeof(*load));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_db_beginload(db, &load->callbacks.add,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = zonemgr_getio(zone->zmgr, ISC_TRUE, zone->task,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_db_load(db, zone->masterfile);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington isc_mem_put(zone->mctx, load, sizeof(*load));
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonzone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington unsigned int soacount = 0;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington unsigned int nscount = 0;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington isc_uint32_t serial, refresh, retry, expire, minimum;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Initiate zone transfer? We may need a error code that
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * indicates that the "permanent" form does not exist.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * XXX better error feedback to log.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "no master file");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "loading master file %s: %s",
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews "loading master file %s: %s",
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone->masterfile, dns_result_totext(result));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "number of nodes in database: %u",
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_log(zone, me, ISC_LOG_DEBUG(1), "loaded");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HASINCLUDE);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_HASINCLUDE);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Apply update log, if any.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_journal_rollforward(zone->mctx, db,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND &&
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result != DNS_R_UPTODATE && result != DNS_R_NOJOURNAL &&
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "dns_journal_rollforward returned: %s",
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result == ISC_R_NOTFOUND || result == ISC_R_RANGE) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "journal out of sync with zone");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "dns_journal_rollforward: %s",
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Obtain ns and soa counts for top of zone.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = zone_get_from_db(db, &zone->origin, &nscount,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "could not find NS and/or SOA records");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Master / Slave / Stub zones require both NS and SOA records at
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * the top of the zone.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_log(zone, me, ISC_LOG_ERROR, "no NS records");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (!isc_serial_ge(serial, zone->serial)) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "zone serial has gone backwards");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone->expire = RANGE(expire, zone->refresh + zone->retry,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = isc_file_getmodtime(zone->masterfile, &t);
a03848252fa85734ca75beae3d0b01bb503c0a8bMark Andrews /* destroy notification example. */
a03848252fa85734ca75beae3d0b01bb503c0a8bMark Andrews isc_event_t *e = isc_event_allocate(zone->mctx, NULL,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = zone_replacedb(zone, db, ISC_FALSE);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DNS_ZONEFLG_LOADED|DNS_ZONEFLG_NEEDNOTIFY);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_saveunique(zone, zone->journal, "jn-XXXXXXXX");
a03848252fa85734ca75beae3d0b01bb503c0a8bMark Andrews zone_saveunique(zone, zone->masterfile, "db-XXXXXXXX");
a56f5ada432128085e4a06815328023ee0c9610dMark Andrews /* Mark the zone for immediate refresh. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) &&
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * DNS_ZONEFLG_EXITING can only be set if erefs == 0.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonzone_count_ns_rr(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington unsigned int *nscount)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_db_findrdataset(db, node, version, dns_rdatatype_ns,
34f991028382079af7c2b53bac6768803ff28f8cBrian Wellingtonzone_load_soa_rr(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington unsigned int *soacount,
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington isc_uint32_t *serial, isc_uint32_t *refresh,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_db_findrdataset(db, node, version, dns_rdatatype_soa,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * zone must be locked.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonzone_get_from_db(dns_db_t *db, dns_name_t *origin, unsigned int *nscount,
a012d6dbfb100390efa7d0d4be64ada0210b09ddBrian Wellington unsigned int *soacount, isc_uint32_t *serial,
a012d6dbfb100390efa7d0d4be64ada0210b09ddBrian Wellington result = dns_db_findnode(db, origin, ISC_FALSE, &node);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = zone_count_ns_rr(db, node, version, nscount);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (soacount != NULL || serial != NULL || refresh != NULL
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington || retry != NULL || expire != NULL || minimum != NULL) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = zone_load_soa_rr(db, node, version, soacount,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_db_closeversion(db, &version, ISC_FALSE);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_attach(dns_zone_t *source, dns_zone_t **target) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington REQUIRE(target != NULL && *target == NULL);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington zone_log(source, "dns_zone_attach", ISC_LOG_DEBUG(10),
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington "eref = %d, irefs = %d", source->erefs, source->irefs);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * We just detached the last external reference.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * This zone is being managed. Post
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * its control event and let it clean
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * up synchronously in the context of
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * This zone is not being managed; it has
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * no task and can have no outstanding
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * events. Free it immediately.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * Unmanaged zones should not have non-null views;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * we have no way of detaching from the view here
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * without causing deadlock because this code is called
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * with the view already locked.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington zone_log(zone, "dns_zone_detach", ISC_LOG_DEBUG(10),
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington "eref = %d, irefs = %d", zone->erefs, zone->irefs);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_iattach(dns_zone_t *source, dns_zone_t **target) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington REQUIRE(target != NULL && *target == NULL);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonzone_iattach(dns_zone_t *source, dns_zone_t **target) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * 'source' locked by caller.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington REQUIRE(target != NULL && *target == NULL);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington zone_log(source, "zone_iattach", ISC_LOG_DEBUG(10),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "eref = %d, irefs = %d", source->erefs, source->irefs);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * 'zone' locked by caller.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_log(zone, "zone_idetach", ISC_LOG_DEBUG(10),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "eref = %d, irefs = %d", zone->erefs, zone->irefs);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington zone_log(zone, "dns_zone_idetach", ISC_LOG_DEBUG(10),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington "eref = %d, irefs = %d", zone->erefs, zone->irefs);
if (value)
if (value)
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
goto unlock;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (result);
sizeof(dns_name_t));
if (count == 0)
goto unlock;
goto unlock;
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_slave:
case dns_zone_master:
case dns_zone_slave:
return (result);
return (result);
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
return (result);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
if (!locked)
if (!locked)
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
unsigned int options;
goto destroy;
goto destroy;
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;
goto cleanup;
addrbuf);
case PF_INET:
case PF_INET6:
goto cleanup;
&new);
goto cleanup;
goto cleanup;
#ifndef NOMINUM_PUBLIC
unsigned int flags = 0;
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 done;
done:
goto same_master;
master);
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;
goto detach;
goto detach;
goto detach;
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;
case PF_INET:
case PF_INET6:
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
&node);
goto cleanup;
goto cleanup;
case PF_INET:
case PF_INET6:
goto cleanup;
goto cleanup;
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
if (next == 0) {
static isc_result_t
isc_region_t r;
&message);
return (result);
goto cleanup;
goto cleanup;
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);
int match = 0;
#ifndef NOMINUM_PUBLIC
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);
return (ISC_R_SUCCESS);
int count = 0;
count++;
return (count);
if (idlein == 0)
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:
goto same_master;
isc_time_t t;
nscount = 0;
soacount = 0;
if (nscount == 0)
goto cleanup;
static isc_result_t
return (ISC_R_NOMORE);
case PF_INET:
case PF_INET6:
goto unlock;
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_NOMORE);
return (ISC_R_SUCCESS);
return (ISC_R_NOMORE);
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
goto free_mem;
goto free_rwlock;
goto free_conflock;
goto free_taskpool;
goto free_task;
goto free_rl;
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);
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
if (queue) {
if (!queue) {
return (ISC_R_SUCCESS);
if (send_event) {
char *buf;
int buflen;
goto cleanup;
goto cleanup;
if (on) {
goto done;
goto done;
done:
return (result);
switch (dialup) {
case dns_dialuptype_no:
case dns_dialuptype_yes:
case dns_dialuptype_notify:
case dns_dialuptype_refresh:
case dns_dialuptype_passive:
INSIST(0);