summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/difffile.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2015-02-03 10:40:03 +0000
committerBrad Smith <brad@cvs.openbsd.org>2015-02-03 10:40:03 +0000
commitcf1cc724ae7fd001273261628347cd83ead24a70 (patch)
tree4558cb97e5ad53f58852f7de92d61dd974dfeb4b /usr.sbin/nsd/difffile.c
parent7d5f380457844eff99cd814a991194c91434ff50 (diff)
merge conflicts
Diffstat (limited to 'usr.sbin/nsd/difffile.c')
-rw-r--r--usr.sbin/nsd/difffile.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/usr.sbin/nsd/difffile.c b/usr.sbin/nsd/difffile.c
index c9c8026369e..490dd0f043d 100644
--- a/usr.sbin/nsd/difffile.c
+++ b/usr.sbin/nsd/difffile.c
@@ -1624,7 +1624,7 @@ void* task_new_stat_info(udb_base* udb, udb_ptr* last, struct nsdst* stat,
void
task_new_add_zone(udb_base* udb, udb_ptr* last, const char* zone,
- const char* pattern)
+ const char* pattern, unsigned zonestatid)
{
size_t zlen = strlen(zone);
size_t plen = strlen(pattern);
@@ -1637,6 +1637,7 @@ task_new_add_zone(udb_base* udb, udb_ptr* last, const char* zone,
return;
}
TASKLIST(&e)->task_type = task_add_zone;
+ TASKLIST(&e)->yesno = zonestatid;
p = TASKLIST(&e)->zname;
memcpy(p, zone, zlen+1);
memmove(p+zlen+1, pattern, plen+1);
@@ -1755,6 +1756,22 @@ void task_new_opt_change(udb_base* udb, udb_ptr* last, nsd_options_t* opt)
udb_ptr_unlink(&e, udb);
}
+void task_new_zonestat_inc(udb_base* udb, udb_ptr* last, unsigned sz)
+{
+ udb_ptr e;
+ DEBUG(DEBUG_IPC,1, (LOG_INFO, "add task zonestat_inc"));
+ if(sz == 0)
+ return; /* no need to decrease to 0 */
+ if(!task_create_new_elem(udb, last, &e, sizeof(struct task_list_d),
+ NULL)) {
+ log_msg(LOG_ERR, "tasklist: out of space, cannot add z_i");
+ return;
+ }
+ TASKLIST(&e)->task_type = task_zonestat_inc;
+ TASKLIST(&e)->oldserial = (uint32_t)sz;
+ udb_ptr_unlink(&e, udb);
+}
+
int
task_new_apply_xfr(udb_base* udb, udb_ptr* last, const dname_type* dname,
uint32_t old_serial, uint32_t new_serial, uint64_t filenumber)
@@ -1858,6 +1875,7 @@ task_process_add_zone(struct nsd* nsd, udb_base* udb, udb_ptr* last_task,
log_msg(LOG_ERR, "can not add zone %s %s", zname, pname);
return;
}
+ z->zonestatid = (unsigned)task->yesno;
/* if zone is empty, attempt to read the zonefile from disk (if any) */
if(!z->soa_rrset && z->opts->pattern->zonefile) {
namedb_read_zonefile(nsd, z, udb, last_task);
@@ -1956,6 +1974,18 @@ task_process_opt_change(struct nsd* nsd, struct task_list_d* task)
#endif
}
+#ifdef USE_ZONE_STATS
+static void
+task_process_zonestat_inc(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
+ struct task_list_d* task)
+{
+ DEBUG(DEBUG_IPC,1, (LOG_INFO, "zonestat_inc task %u", (unsigned)task->oldserial));
+ nsd->zonestatdesired = (unsigned)task->oldserial;
+ /* send echo to xfrd to increment on its end */
+ task_new_zonestat_inc(udb, last_task, nsd->zonestatdesired);
+}
+#endif
+
static void
task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
udb_ptr* task)
@@ -2032,6 +2062,11 @@ void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
case task_opt_change:
task_process_opt_change(nsd, TASKLIST(task));
break;
+#ifdef USE_ZONE_STATS
+ case task_zonestat_inc:
+ task_process_zonestat_inc(nsd, udb, last_task, TASKLIST(task));
+ break;
+#endif
case task_apply_xfr:
task_process_apply_xfr(nsd, udb, last_task, task);
break;