Skip to content
Snippets Groups Projects
Commit 1fe09f62 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

fix inifinite loop after failed bootstrap

The `zone_expire()` will return `false` if we don't know when the zone
expires. This is tricky when used as `!zone_expire()`. We have to check
explicitly if the SOA expire value is know.
parent 2ae1d41f
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ int event_expire(conf_t *conf, zone_t *zone)
zone->zonefile.exists = false;
mem_trim();
// NOTE: must preserve zone->timers.soa_expire
zone->timers.next_refresh = time(NULL);
replan_from_timers(conf, zone);
......
......@@ -74,6 +74,11 @@ static void replan_dnssec(conf_t *conf, zone_t *zone)
}
}
static bool can_expire(const zone_t *zone)
{
return zone->timers.soa_expire > 0 && !zone_expired(zone);
}
/*!
* \brief Replan events that depend on zone timers (REFRESH, EXPIRE, FLUSH).
*/
......@@ -90,12 +95,12 @@ void replan_from_timers(conf_t *conf, zone_t *zone)
}
time_t expire = 0;
if (zone_is_slave(conf, zone) && !zone_expired(zone)) {
if (zone_is_slave(conf, zone) && can_expire(zone)) {
expire = zone->timers.last_refresh + zone->timers.soa_expire;
}
time_t flush = 0;
if (!zone_expired(zone)) {
if (!zone_is_slave(conf, zone) || can_expire(zone)) {
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
int64_t sync_timeout = conf_int(&val);
if (sync_timeout > 0) {
......
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