40 #include <sys/types.h> 44 static const char* tools_str =
"tools";
54 ods_status status = ODS_STATUS_OK;
58 ods_log_assert(zone->
name);
60 if (status == ODS_STATUS_OK) {
61 ods_log_assert(new_signconf);
75 ods_log_debug(
"[%s] zone %s switch to new signconf", tools_str,
80 }
else if (status != ODS_STATUS_UNCHANGED) {
81 ods_log_error(
"[%s] unable to load signconf for zone %s: %s",
82 tools_str, zone->
name, ods_status2str(status));
95 ods_status status = ODS_STATUS_OK;
100 ods_log_assert(zone->
name);
105 if (status != ODS_STATUS_OK) {
106 ods_log_error(
"[%s] unable to read zone %s: failed to " 107 "publish dnskeys (%s)", tools_str, zone->
name,
108 ods_status2str(status));
117 if (status != ODS_STATUS_OK) {
118 ods_log_error(
"[%s] unable to read zone %s: failed to " 119 "publish nsec3param (%s)", tools_str, zone->
name,
120 ods_status2str(status));
137 if (status != ODS_STATUS_OK && status != ODS_STATUS_UNCHANGED) {
138 if (status == ODS_STATUS_XFRINCOMPLETE) {
139 ods_log_info(
"[%s] read zone %s: xfr in progress",
140 tools_str, zone->name);
142 ods_log_error(
"[%s] unable to read zone %s: adapter failed (%s)",
143 tools_str, zone->name, ods_status2str(status));
150 if ((status == ODS_STATUS_OK || status == ODS_STATUS_UNCHANGED)
152 pthread_mutex_lock(&zone->stats->stats_lock);
153 zone->stats->start_time = start;
154 zone->stats->sort_time = (end-start);
155 zone->stats->sort_done = 1;
156 pthread_mutex_unlock(&zone->stats->stats_lock);
169 int fdlimit = sysconf(_SC_OPEN_MAX);
170 while (fd < fdlimit) {
183 ods_status status = ODS_STATUS_OK;
184 ods_log_assert(engine);
185 ods_log_assert(engine->
config);
186 ods_log_assert(zone);
187 ods_log_assert(zone->
db);
188 ods_log_assert(zone->
name);
196 ods_log_verbose(
"[%s] skip write zone %s serial %u (zone not " 197 "changed)", tools_str, zone->
name?zone->
name:
"(null)",
203 return ODS_STATUS_OK;
209 if (status != ODS_STATUS_OK) {
210 ods_log_error(
"[%s] unable to write zone %s: adapter failed (%s)",
211 tools_str, zone->name, ods_status2str(status));
214 zone->db->outserial = zone->db->intserial;
215 zone->db->is_initialized = 1;
216 zone->db->have_serial = 1;
217 pthread_mutex_lock(&zone->ixfr->ixfr_lock);
219 pthread_mutex_unlock(&zone->ixfr->ixfr_lock);
221 if (zone->notify_ns) {
224 ods_log_verbose(
"[%s] notify nameserver: %s", tools_str,
227 switch ((pid = fork())) {
229 ods_log_error(
"[%s] notify nameserver failed: unable to fork " 230 "(%s)", tools_str, strerror(errno));
231 return ODS_STATUS_FORK_ERR;
236 execvp(zone->notify_ns, zone->notify_args);
238 ods_log_error(
"[%s] notify nameserver failed: execv() failed " 239 "(%s)", tools_str, strerror(errno));
243 ods_log_debug(
"[%s] notify nameserver process forked",
246 while((wpid = waitpid(pid, &pid_status, 0)) <= 0) {
247 if (errno != EINTR) {
252 ods_log_error(
"[%s] notify nameserver failed: waitpid() " 253 "failed (%s)", tools_str, strerror(errno));
254 }
else if (!WIFEXITED(pid_status)) {
255 ods_log_error(
"[%s] notify nameserver failed: notify " 256 "command did not terminate normally", tools_str);
258 ods_log_verbose(
"[%s] notify nameserver ok", tools_str);
265 pthread_mutex_lock(&zone->stats->stats_lock);
266 zone->stats->end_time = time(NULL);
267 ods_log_debug(
"[%s] log stats for zone %s serial %u", tools_str,
268 zone->name?zone->name:
"(null)", (
unsigned) zone->db->outserial);
269 stats_log(zone->stats, zone->name, zone->db->outserial,
270 zone->signconf->nsec_type);
272 pthread_mutex_unlock(&zone->stats->stats_lock);
275 ods_log_debug(
"[%s] forward a notify", tools_str);
277 strlen(ODS_SE_NOTIFY_CMD));
void namedb_cleanup_denials(namedb_type *db)
#define ODS_SE_NOTIFY_CMD
task_id signconf_compare_denial(signconf_type *a, signconf_type *b)
void signconf_cleanup(signconf_type *sc)
void namedb_init_denials(namedb_type *db)
adapter_type * adoutbound
ods_status zone_publish_nsec3param(zone_type *zone)
void stats_log(stats_type *stats, const char *name, uint32_t serial, ldns_rr_type nsec_type)
engineconfig_type * config
void namedb_rollback(namedb_type *db, unsigned keepsc)
ods_status adapter_write(zone_type *zone)
void zone_rollback_dnskeys(zone_type *zone)
void zone_rollback_nsec3param(zone_type *zone)
ods_status zone_publish_dnskeys(zone_type *zone, int skip_hsm_access)
void signconf_log(signconf_type *sc, const char *name)
void ixfr_purge(ixfr_type *ixfr, char const *zonename)
pthread_mutex_t stats_lock
ods_status zone_load_signconf(zone_type *zone, signconf_type **new_signconf)
ods_status adapter_read(zone_type *zone)
void dnshandler_fwd_notify(dnshandler_type *dnshandler, uint8_t *pkt, size_t len)
void namedb_wipe_denial(namedb_type *db)
dnshandler_type * dnshandler
void stats_clear(stats_type *stats)