Skip to content
Snippets Groups Projects
Commit 4614ddbd authored by Daniel Salzman's avatar Daniel Salzman
Browse files

zone: don't log serial 0 if no zone available

parent 3726b26c
No related branches found
No related tags found
No related merge requests found
......@@ -356,6 +356,7 @@ int event_load(conf_t *conf, zone_t *zone)
zone->zonefile_mtime = mtime;
zone_contents_t *old = zone_switch_contents(zone, contents);
zone->flags &= ~ZONE_EXPIRED;
bool old_contents = (old != NULL);
uint32_t old_serial = zone_contents_serial(old);
if (old != NULL) {
synchronize_rcu();
......@@ -385,8 +386,12 @@ int event_load(conf_t *conf, zone_t *zone)
}
uint32_t current_serial = zone_contents_serial(zone->contents);
log_zone_info(zone->name, "loaded, serial %u -> %u",
old_serial, current_serial);
if (old_contents) {
log_zone_info(zone->name, "loaded, serial %u -> %u",
old_serial, current_serial);
} else {
log_zone_info(zone->name, "loaded, serial %u", current_serial);
}
return KNOT_EOK;
......@@ -718,4 +723,3 @@ uint32_t bootstrap_next(uint32_t timer)
}
return timer;
}
......@@ -79,8 +79,8 @@ static zone_status_t zone_file_status(conf_t *conf, const zone_t *old_zone,
/*!
* \brief Log message about loaded zone (name and status).
*
* \param zone Zone structure.
* \param status Zone file status.
* \param zone Zone structure.
* \param status Zone file status.
*/
static void log_zone_load_info(const zone_t *zone, zone_status_t status)
{
......@@ -97,14 +97,14 @@ static void log_zone_load_info(const zone_t *zone, zone_status_t status)
}
assert(action);
uint32_t serial = 0;
if (zone->contents && zone->contents->apex) {
const knot_rdataset_t *soa = node_rdataset(zone->contents->apex,
KNOT_RRTYPE_SOA);
serial = knot_soa_serial(soa);
uint32_t serial = knot_soa_serial(soa);
log_zone_info(zone->name, "zone %s, serial %u", action, serial);
} else {
log_zone_info(zone->name, "zone %s", action);
}
log_zone_info(zone->name, "zone %s, serial %u", action, serial);
}
static zone_t *create_zone_from(const knot_dname_t *name, server_t *server)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment