Bug 552 - Zonefile not loaded on "nsd-control reconfig"
Zonefile not loaded on "nsd-control reconfig"
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
4.0.x
All All
: P5 normal
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-07 17:10 CET by lukas
Modified: 2014-02-10 15:04 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lukas 2014-02-07 17:10:29 CET
When switching a zone to a differently named zonefile in the configuration and issuing "nsd-control reconfig", if that zonefile's mtime is older than the previously used zonefile's mtime, the zonefile is not loaded and the zone is served with the wrong contents (those of the previously used zonefile).

In dbaccess.c, line 495:

                /* check the mtime */
                if(udb_zone_get_mtime(nsd->db->udb, dname_name(domain_dname(
                        zone->apex)), domain_dname(zone->apex)->name_size)
                        >= (uint64_t)mtime) {
                        VERBOSITY(3, (LOG_INFO, "zonefile %s is not modified",
                                fname));
                        return;
                }

One way to fix this would be to amend the if-condition with a check for a  filename change. (Skip mtime check if filename has changed.)
Comment 1 Wouter Wijngaards 2014-02-10 15:04:02 CET
Hi Lukas,

Thanks for the report, this was simply not considered when I wrote that.  I have fixed it so that the file name is stored under which it has read the file and then compared if this is still the same, before checking the mtime.  Note that for zonetransfers, if the most recent zone transfer is more recent than the (newly named) file, then then zone transfer is still considered a better 'source' (when the operator renames zone files for slave zones).

Best regards,
   Wouter