Commit 79ce8609 authored by Witold Krecicki's avatar Witold Krecicki
Browse files

rndc reconfig should not touch already loaded zones, some refactoring of...

rndc reconfig should not touch already loaded zones, some refactoring of dns_{zone,view,zt}_{async,}load
parent c268c47c
...@@ -691,7 +691,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename, ...@@ -691,7 +691,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
if (dochecksrv) if (dochecksrv)
dns_zone_setchecksrv(zone, checksrv); dns_zone_setchecksrv(zone, checksrv);
CHECK(dns_zone_load(zone)); CHECK(dns_zone_load(zone, false));
/* /*
* When loading map files we can't catch oversize TTLs during * When loading map files we can't catch oversize TTLs during
......
...@@ -2608,12 +2608,12 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { ...@@ -2608,12 +2608,12 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
* Load the zone from the master file. If this fails, we'll * Load the zone from the master file. If this fails, we'll
* need to undo the configuration we've done already. * need to undo the configuration we've done already.
*/ */
result = dns_zone_loadnew(zone); result = dns_zone_load(zone, true);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
dns_db_t *dbp = NULL; dns_db_t *dbp = NULL;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"catz: dns_zone_loadnew() failed " "catz: dns_zone_load() failed "
"with %s; reverting.", "with %s; reverting.",
isc_result_totext(result)); isc_result_totext(result));
...@@ -9209,14 +9209,14 @@ load_zones(named_server_t *server, bool init, bool reconfig) { ...@@ -9209,14 +9209,14 @@ load_zones(named_server_t *server, bool init, bool reconfig) {
view = ISC_LIST_NEXT(view, link)) view = ISC_LIST_NEXT(view, link))
{ {
if (view->managed_keys != NULL) { if (view->managed_keys != NULL) {
result = dns_zone_load(view->managed_keys); result = dns_zone_load(view->managed_keys, false);
if (result != ISC_R_SUCCESS && if (result != ISC_R_SUCCESS &&
result != DNS_R_UPTODATE && result != DNS_R_UPTODATE &&
result != DNS_R_CONTINUE) result != DNS_R_CONTINUE)
goto cleanup; goto cleanup;
} }
if (view->redirect != NULL) { if (view->redirect != NULL) {
result = dns_zone_load(view->redirect); result = dns_zone_load(view->redirect, false);
if (result != ISC_R_SUCCESS && if (result != ISC_R_SUCCESS &&
result != DNS_R_UPTODATE && result != DNS_R_UPTODATE &&
result != DNS_R_CONTINUE) result != DNS_R_CONTINUE)
...@@ -9228,7 +9228,7 @@ load_zones(named_server_t *server, bool init, bool reconfig) { ...@@ -9228,7 +9228,7 @@ load_zones(named_server_t *server, bool init, bool reconfig) {
* zones. * zones.
*/ */
isc_refcount_increment(&zl->refs); isc_refcount_increment(&zl->refs);
CHECK(dns_view_asyncload(view, view_loaded, zl)); CHECK(dns_view_asyncload(view, reconfig, view_loaded, zl));
} }
cleanup: cleanup:
...@@ -10124,7 +10124,7 @@ named_server_reloadcommand(named_server_t *server, isc_lex_t *lex, ...@@ -10124,7 +10124,7 @@ named_server_reloadcommand(named_server_t *server, isc_lex_t *lex,
dns_zone_detach(&zone); dns_zone_detach(&zone);
msg = "zone refresh queued"; msg = "zone refresh queued";
} else { } else {
result = dns_zone_load(zone); result = dns_zone_load(zone, false);
dns_zone_detach(&zone); dns_zone_detach(&zone);
switch (result) { switch (result) {
case ISC_R_SUCCESS: case ISC_R_SUCCESS:
...@@ -12778,7 +12778,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, ...@@ -12778,7 +12778,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
* Load the zone from the master file. If this fails, we'll * Load the zone from the master file. If this fails, we'll
* need to undo the configuration we've done already. * need to undo the configuration we've done already.
*/ */
result = dns_zone_loadnew(zone); result = dns_zone_load(zone, true);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
dns_db_t *dbp = NULL; dns_db_t *dbp = NULL;
...@@ -12968,7 +12968,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, ...@@ -12968,7 +12968,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
} }
/* Load the zone from the master file if it needs reloading. */ /* Load the zone from the master file if it needs reloading. */
result = dns_zone_loadnew(zone); result = dns_zone_load(zone, true);
/* /*
* Dynamic zones need no reloading, so we can pass this result. * Dynamic zones need no reloading, so we can pass this result.
......
...@@ -122,7 +122,7 @@ setup(const char *zonename, const char *filename, const char *classname) { ...@@ -122,7 +122,7 @@ setup(const char *zonename, const char *filename, const char *classname) {
if (zonetype == dns_zone_slave) if (zonetype == dns_zone_slave)
dns_zone_setmasters(zone, &addr, 1); dns_zone_setmasters(zone, &addr, 1);
result = dns_zone_load(zone); result = dns_zone_load(zone, false);
ERRRET(result, "dns_zone_load"); ERRRET(result, "dns_zone_load");
result = dns_zonemgr_managezone(zonemgr, zone); result = dns_zonemgr_managezone(zonemgr, zone);
......
...@@ -151,7 +151,7 @@ load_zone(dns_zone_t *zone) { ...@@ -151,7 +151,7 @@ load_zone(dns_zone_t *zone) {
bool zone_dynamic; bool zone_dynamic;
uint32_t serial; uint32_t serial;
result = dns_zone_load(zone); result = dns_zone_load(zone, false);
if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE
&& result != DNS_R_DYNAMIC && result != DNS_R_CONTINUE) && result != DNS_R_DYNAMIC && result != DNS_R_CONTINUE)
goto cleanup; goto cleanup;
......
...@@ -798,18 +798,15 @@ dns_view_findzone(dns_view_t *view, const dns_name_t *name, ...@@ -798,18 +798,15 @@ dns_view_findzone(dns_view_t *view, const dns_name_t *name,
*/ */
isc_result_t isc_result_t
dns_view_load(dns_view_t *view, bool stop); dns_view_load(dns_view_t *view, bool stop, bool newonly);
isc_result_t isc_result_t
dns_view_loadnew(dns_view_t *view, bool stop); dns_view_asyncload(dns_view_t *view, bool newonly, dns_zt_allloaded_t callback,
void *arg);
isc_result_t
dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg);
/*%< /*%<
* Load zones attached to this view. dns_view_load() loads * Load zones attached to this view. dns_view_load() loads
* all zones whose master file has changed since the last * all zones whose master file has changed since the last
* load; dns_view_loadnew() loads only zones that have never * load
* been loaded.
* *
* dns_view_asyncload() loads zones asynchronously. When all zones * dns_view_asyncload() loads zones asynchronously. When all zones
* in the view have finished loading, 'callback' is called with argument * in the view have finished loading, 'callback' is called with argument
...@@ -818,6 +815,8 @@ dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg); ...@@ -818,6 +815,8 @@ dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg);
* If 'stop' is true, stop on the first error and return it. * If 'stop' is true, stop on the first error and return it.
* If 'stop' is false (or we are loading asynchronously), ignore errors. * If 'stop' is false (or we are loading asynchronously), ignore errors.
* *
* If 'newonly' is true load only zones that were never loaded.
*
* Requires: * Requires:
* *
*\li 'view' is valid. *\li 'view' is valid.
......
...@@ -338,10 +338,7 @@ dns_zone_getmaxttl(dns_zone_t *zone); ...@@ -338,10 +338,7 @@ dns_zone_getmaxttl(dns_zone_t *zone);
*/ */
isc_result_t isc_result_t
dns_zone_load(dns_zone_t *zone); dns_zone_load(dns_zone_t *zone, bool newonly);
isc_result_t
dns_zone_loadnew(dns_zone_t *zone);
isc_result_t isc_result_t
dns_zone_loadandthaw(dns_zone_t *zone); dns_zone_loadandthaw(dns_zone_t *zone);
...@@ -351,9 +348,7 @@ dns_zone_loadandthaw(dns_zone_t *zone); ...@@ -351,9 +348,7 @@ dns_zone_loadandthaw(dns_zone_t *zone);
* Confirm that the minimum requirements for the zone type are * Confirm that the minimum requirements for the zone type are
* met, otherwise DNS_R_BADZONE is returned. * met, otherwise DNS_R_BADZONE is returned.
* *
* dns_zone_loadnew() only loads zones that are not yet loaded. * If newonly is set dns_zone_load() only loads new zones.
* dns_zone_load() also loads zones that are already loaded and
* and whose master file has changed since the last load.
* dns_zone_loadandthaw() is similar to dns_zone_load() but will * dns_zone_loadandthaw() is similar to dns_zone_load() but will
* also re-enable DNS UPDATEs when the load completes. * also re-enable DNS UPDATEs when the load completes.
* *
...@@ -371,7 +366,8 @@ dns_zone_loadandthaw(dns_zone_t *zone); ...@@ -371,7 +366,8 @@ dns_zone_loadandthaw(dns_zone_t *zone);
*/ */
isc_result_t isc_result_t
dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg); dns_zone_asyncload(dns_zone_t *zone, bool newonly,
dns_zt_zoneloaded_t done, void *arg);
/*%< /*%<
* Cause the database to be loaded from its backing store asynchronously. * Cause the database to be loaded from its backing store asynchronously.
* Other zone maintenance functions are suspended until this is complete. * Other zone maintenance functions are suspended until this is complete.
......
...@@ -141,21 +141,17 @@ dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); ...@@ -141,21 +141,17 @@ dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
*/ */
isc_result_t isc_result_t
dns_zt_load(dns_zt_t *zt, bool stop); dns_zt_load(dns_zt_t *zt, bool stop, bool newonly);
isc_result_t isc_result_t
dns_zt_loadnew(dns_zt_t *zt, bool stop); dns_zt_asyncload(dns_zt_t *zt, bool newonly, dns_zt_allloaded_t alldone,
void *arg);
isc_result_t
dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg);
/*%< /*%<
* Load all zones in the table. If 'stop' is true, * Load all zones in the table. If 'stop' is true,
* stop on the first error and return it. If 'stop' * stop on the first error and return it. If 'stop'
* is false, ignore errors. * is false, ignore errors.
* *
* dns_zt_loadnew() only loads zones that are not yet loaded. * if newonly is set only zones that were never loaded are loaded.
* dns_zt_load() also loads zones that are already loaded and
* and whose master file has changed since the last load.
* dns_zt_asyncload() loads zones asynchronously; when all * dns_zt_asyncload() loads zones asynchronously; when all
* zones in the zone table have finished loaded (or failed due * zones in the zone table have finished loaded (or failed due
* to errors), the caller is informed by calling 'alldone' * to errors), the caller is informed by calling 'alldone'
......
...@@ -593,7 +593,7 @@ get_entry(dns_rrl_t *rrl, const isc_sockaddr_t *client_addr, ...@@ -593,7 +593,7 @@ get_entry(dns_rrl_t *rrl, const isc_sockaddr_t *client_addr,
static void static void
debit_log(const dns_rrl_entry_t *e, int age, const char *action) { debit_log(const dns_rrl_entry_t *e, int age, const char *action) {
char buf[sizeof("age=12345678")]; char buf[sizeof("age=2147483647")];
const char *age_str; const char *age_str;
if (age == DNS_RRL_FOREVER) { if (age == DNS_RRL_FOREVER) {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
struct args { struct args {
void *arg1; void *arg1;
void *arg2; void *arg2;
bool arg3;
}; };
/* /*
...@@ -77,7 +78,7 @@ start_zt_asyncload(isc_task_t *task, isc_event_t *event) { ...@@ -77,7 +78,7 @@ start_zt_asyncload(isc_task_t *task, isc_event_t *event) {
UNUSED(task); UNUSED(task);
dns_zt_asyncload(args->arg1, all_done, args->arg2); dns_zt_asyncload(args->arg1, false, all_done, args->arg2);
isc_event_free(&event); isc_event_free(&event);
} }
...@@ -88,7 +89,7 @@ start_zone_asyncload(isc_task_t *task, isc_event_t *event) { ...@@ -88,7 +89,7 @@ start_zone_asyncload(isc_task_t *task, isc_event_t *event) {
UNUSED(task); UNUSED(task);
dns_zone_asyncload(args->arg1, load_done, args->arg2); dns_zone_asyncload(args->arg1, args->arg3, load_done, args->arg2);
isc_event_free(&event); isc_event_free(&event);
} }
...@@ -117,8 +118,8 @@ ATF_TC_BODY(apply, tc) { ...@@ -117,8 +118,8 @@ ATF_TC_BODY(apply, tc) {
ATF_REQUIRE(view->zonetable != NULL); ATF_REQUIRE(view->zonetable != NULL);
ATF_CHECK_EQ(0, nzones); ATF_CHECK_EQ(0, nzones);
result = dns_zt_apply(view->zonetable, false, NULL, count_zone, result = dns_zt_apply(view->zonetable, false, NULL,
&nzones); count_zone, &nzones);
ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK_EQ(1, nzones); ATF_CHECK_EQ(1, nzones);
...@@ -143,9 +144,12 @@ ATF_TC_HEAD(asyncload_zone, tc) { ...@@ -143,9 +144,12 @@ ATF_TC_HEAD(asyncload_zone, tc) {
} }
ATF_TC_BODY(asyncload_zone, tc) { ATF_TC_BODY(asyncload_zone, tc) {
isc_result_t result; isc_result_t result;
int n;
dns_zone_t *zone = NULL; dns_zone_t *zone = NULL;
dns_view_t *view = NULL; dns_view_t *view = NULL;
dns_db_t *db = NULL; dns_db_t *db = NULL;
FILE* zonefile, *origfile;
char buf[4096];
bool done = false; bool done = false;
int i = 0; int i = 0;
struct args args; struct args args;
...@@ -168,21 +172,67 @@ ATF_TC_BODY(asyncload_zone, tc) { ...@@ -168,21 +172,67 @@ ATF_TC_BODY(asyncload_zone, tc) {
ATF_CHECK(!dns__zone_loadpending(zone)); ATF_CHECK(!dns__zone_loadpending(zone));
ATF_CHECK(!done); ATF_CHECK(!done);
dns_zone_setfile(zone, "testdata/zt/zone1.db", dns_masterformat_text, zonefile = fopen("./zone.data", "wb");
&dns_master_style_default); ATF_CHECK(zonefile != NULL);
origfile = fopen("./testdata/zt/zone1.db", "r+b");
ATF_CHECK(origfile != NULL);
n = fread(buf, 1, 4096, origfile);
fwrite(buf, 1, n, zonefile);
fflush(zonefile);
dns_zone_setfile(zone, "./zone.data",
dns_masterformat_text, &dns_master_style_default);
args.arg1 = zone; args.arg1 = zone;
args.arg2 = &done; args.arg2 = &done;
args.arg3 = false;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args); isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_run(); isc_app_run();
while (dns__zone_loadpending(zone) && i++ < 5000) while (dns__zone_loadpending(zone) && i++ < 5000)
dns_test_nap(1000); dns_test_nap(1000);
ATF_CHECK(done); ATF_CHECK(done);
/* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
dns_db_detach(&db);
/*
* Add something to zone file, reload zone with newonly - it should
* not be reloaded.
*/
fprintf(zonefile, "\nb in b 1.2.3.4\n");
fflush(zonefile);
args.arg1 = zone;
args.arg2 = &done;
args.arg3 = true;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_run();
while (dns__zone_loadpending(zone) && i++ < 5000)
dns_test_nap(1000);
ATF_CHECK(done);
/* The zone should now be loaded; test it */ /* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db); result = dns_zone_getdb(zone, &db);
ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK_EQ(result, ISC_R_SUCCESS);
dns_db_detach(&db);
/* Now reload it without newonly - it should be reloaded */
args.arg1 = zone;
args.arg2 = &done;
args.arg3 = false;
isc_app_onrun(mctx, maintask, start_zone_asyncload, &args);
isc_app_run();
while (dns__zone_loadpending(zone) && i++ < 5000)
dns_test_nap(1000);
ATF_CHECK(done);
/* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(db != NULL); ATF_CHECK(db != NULL);
if (db != NULL) if (db != NULL)
dns_db_detach(&db); dns_db_detach(&db);
...@@ -204,7 +254,7 @@ ATF_TC_BODY(asyncload_zt, tc) { ...@@ -204,7 +254,7 @@ ATF_TC_BODY(asyncload_zt, tc) {
isc_result_t result; isc_result_t result;
dns_zone_t *zone1 = NULL, *zone2 = NULL, *zone3 = NULL; dns_zone_t *zone1 = NULL, *zone2 = NULL, *zone3 = NULL;
dns_view_t *view; dns_view_t *view;
dns_zt_t *zt; dns_zt_t *zt = NULL;
dns_db_t *db = NULL; dns_db_t *db = NULL;
bool done = false; bool done = false;
int i = 0; int i = 0;
......
...@@ -1520,29 +1520,21 @@ dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name, ...@@ -1520,29 +1520,21 @@ dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name,
} }
isc_result_t isc_result_t
dns_view_load(dns_view_t *view, bool stop) { dns_view_load(dns_view_t *view, bool stop, bool newonly) {
REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->zonetable != NULL); REQUIRE(view->zonetable != NULL);
return (dns_zt_load(view->zonetable, stop)); return (dns_zt_load(view->zonetable, stop, newonly));
} }
isc_result_t isc_result_t
dns_view_loadnew(dns_view_t *view, bool stop) { dns_view_asyncload(dns_view_t *view, bool newonly,
dns_zt_allloaded_t callback, void *arg) {
REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->zonetable != NULL);
return (dns_zt_loadnew(view->zonetable, stop));
}
isc_result_t
dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg) {
REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->zonetable != NULL); REQUIRE(view->zonetable != NULL);
return (dns_zt_asyncload(view->zonetable, callback, arg)); return (dns_zt_asyncload(view->zonetable, newonly, callback, arg));
} }
isc_result_t isc_result_t
......
...@@ -498,9 +498,9 @@ struct dns_zone { ...@@ -498,9 +498,9 @@ struct dns_zone {
#define DNS_ZONEKEY_OPTION(z,o) (((z)->keyopts & (o)) != 0) #define DNS_ZONEKEY_OPTION(z,o) (((z)->keyopts & (o)) != 0)
/* Flags for zone_load() */ /* Flags for zone_load() */
#define DNS_ZONELOADFLAG_NOSTAT 0x00000001U /* Do not stat() master files */ #define DNS_ZONELOADFLAG_NOSTAT 0x00000001U /* Do not stat() master files */
#define DNS_ZONELOADFLAG_THAW 0x00000002U /* Thaw the zone on successful #define DNS_ZONELOADFLAG_THAW 0x00000002U /* Thaw the zone on successful
load. */ load. */
#define UNREACH_CHACHE_SIZE 10U #define UNREACH_CHACHE_SIZE 10U
#define UNREACH_HOLD_TIME 600 /* 10 minutes */ #define UNREACH_HOLD_TIME 600 /* 10 minutes */
...@@ -701,6 +701,7 @@ struct dns_keyfetch { ...@@ -701,6 +701,7 @@ struct dns_keyfetch {
*/ */
struct dns_asyncload { struct dns_asyncload {
dns_zone_t *zone; dns_zone_t *zone;
unsigned int flags;
dns_zt_zoneloaded_t loaded; dns_zt_zoneloaded_t loaded;
void *loaded_arg; void *loaded_arg;
}; };
...@@ -2156,13 +2157,8 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) { ...@@ -2156,13 +2157,8 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
} }
isc_result_t isc_result_t
dns_zone_load(dns_zone_t *zone) { dns_zone_load(dns_zone_t *zone, bool newonly) {
return (zone_load(zone, 0, false)); return (zone_load(zone, newonly ? DNS_ZONELOADFLAG_NOSTAT : 0, false));
}
isc_result_t
dns_zone_loadnew(dns_zone_t *zone) {
return (zone_load(zone, DNS_ZONELOADFLAG_NOSTAT, false));
} }
static void static void
...@@ -2178,7 +2174,7 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) { ...@@ -2178,7 +2174,7 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event); isc_event_free(&event);
LOCK_ZONE(zone); LOCK_ZONE(zone);
result = zone_load(zone, 0, true); result = zone_load(zone, asl->flags, true);
if (result != DNS_R_CONTINUE) { if (result != DNS_R_CONTINUE) {
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADPENDING); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADPENDING);
} }
...@@ -2193,7 +2189,9 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) { ...@@ -2193,7 +2189,9 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
} }
isc_result_t isc_result_t
dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) { dns_zone_asyncload(dns_zone_t *zone, bool newonly,
dns_zt_zoneloaded_t done, void *arg)
{
isc_event_t *e; isc_event_t *e;
dns_asyncload_t *asl = NULL; dns_asyncload_t *asl = NULL;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
...@@ -2215,6 +2213,7 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) { ...@@ -2215,6 +2213,7 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) {
CHECK(ISC_R_NOMEMORY); CHECK(ISC_R_NOMEMORY);
asl->zone = NULL; asl->zone = NULL;
asl->flags = newonly ? DNS_ZONELOADFLAG_NOSTAT : 0;
asl->loaded = done; asl->loaded = done;
asl->loaded_arg = arg; asl->loaded_arg = arg;
......
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
#include <dns/zone.h> #include <dns/zone.h>
#include <dns/zt.h> #include <dns/zt.h>
struct zt_load_params {
dns_zt_zoneloaded_t dl;
bool newonly;
};
struct dns_zt { struct dns_zt {
/* Unlocked. */ /* Unlocked. */
unsigned int magic; unsigned int magic;
...@@ -41,6 +46,7 @@ struct dns_zt { ...@@ -41,6 +46,7 @@ struct dns_zt {
isc_rwlock_t rwlock; isc_rwlock_t rwlock;
dns_zt_allloaded_t loaddone; dns_zt_allloaded_t loaddone;
void * loaddone_arg; void * loaddone_arg;
struct zt_load_params *loadparams;
/* Locked by lock. */ /* Locked by lock. */
bool flush; bool flush;
uint32_t references; uint32_t references;
...@@ -51,6 +57,7 @@ struct dns_zt { ...@@ -51,6 +57,7 @@ struct dns_zt {
#define ZTMAGIC ISC_MAGIC('Z', 'T', 'b', 'l') #define ZTMAGIC ISC_MAGIC('Z', 'T', 'b', 'l')
#define VALID_ZT(zt) ISC_MAGIC_VALID(zt, ZTMAGIC) #define VALID_ZT(zt) ISC_MAGIC_VALID(zt, ZTMAGIC)