diff options
author | 2019-07-04 06:56:37 +0100 | |
---|---|---|
committer | 2019-07-04 13:56:37 +0800 | |
commit | 18304ce9b75a401ed510d270c013dc4fe6480420 (patch) | |
tree | 089fc37b837831cd06c8012d922b94033ce21d64 /plugin/file/file.go | |
parent | f9fb9db1715e074c7549548e72f1d29d5ddc268f (diff) | |
download | coredns-18304ce9b75a401ed510d270c013dc4fe6480420.tar.gz coredns-18304ce9b75a401ed510d270c013dc4fe6480420.tar.zst coredns-18304ce9b75a401ed510d270c013dc4fe6480420.zip |
plugin/file: make non-existent file non-fatal (#2955)
* plugin/file: make non-existent file non-fatal
If the zone file being loaded doesn't exist *and* reload is enabled,
just wait the file to pop up in the normal Reload routine.
If reload is set to 0s; we keep this a fatal error on startup. Aslo fix
the ticker in z.Reload(): remove the per second ticks and just use the
reload interval for the ticker.
Brush up the documentation a bit as well.
Fixes: #2951
Signed-off-by: Miek Gieben <miek@miek.nl>
* Stickler and test compile
Signed-off-by: Miek Gieben <miek@miek.nl>
* Remove there too
Signed-off-by: Miek Gieben <miek@miek.nl>
* Cant README test these because zone files dont exist
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/file/file.go')
-rw-r--r-- | plugin/file/file.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugin/file/file.go b/plugin/file/file.go index 2fe4b1644..bc582cfaa 100644 --- a/plugin/file/file.go +++ b/plugin/file/file.go @@ -129,12 +129,15 @@ func Parse(f io.Reader, origin, fileName string, serial int64) (*Zone, error) { return nil, err } - if !seenSOA && serial >= 0 { + if !seenSOA { if s, ok := rr.(*dns.SOA); ok { - if s.Serial == uint32(serial) { // same serial + seenSOA = true + + // -1 is valid serial is we failed to load the file on startup. + + if serial >= 0 && s.Serial == uint32(serial) { // same serial return nil, &serialErr{err: "no change in SOA serial", origin: origin, zone: fileName, serial: serial} } - seenSOA = true } } |