NLnetLabs / nsd

The NLnet Labs Name Server Daemon (NSD) is an authoritative, RFC compliant DNS nameserver.
https://nlnetlabs.nl/nsd
BSD 3-Clause "New" or "Revised" License
449 stars 102 forks source link

Default $TTL not working correctly on nsd >= 4.10.0 #375

Closed dfxbb closed 1 month ago

dfxbb commented 1 month ago

While parsing the zonefile, default $TTL is not used on all RRs with TTL omitted. Instead, it seems that the TTL of the previous record is used.

For example, with this zonefile:

$TTL 300
@               IN      SOA     dns.example.com. hostmaster.example.com. (11111 10800 3600 604800 3600)
@       86400   IN      NS      ns.example.com.
ns              IN      A       1.1.1.1
www             IN      A       2.2.2.2

On nsd <= 4.9.1, TTL of the last two A records (ns and www) is 300, as I am expecting. output of nsd-checkzone -p example.com /root/example.zone:

$ORIGIN com.
example 300     IN      SOA     dns.example.com. hostmaster.example.com. (
                11111 10800 3600 604800 3600 )
        86400   IN      NS      ns.example.com.
$ORIGIN example.com.
ns      300     IN      A       1.1.1.1
www     300     IN      A       2.2.2.2
; zone example.com is ok

But on nsd >= 4.10.0 (test on 4.10.0 and 4.10.1), it became 86400.

$ORIGIN com.
example 300     IN      SOA     dns.example.com. hostmaster.example.com. (
                11111 10800 3600 604800 3600 )
        86400   IN      NS      ns.example.com.
$ORIGIN example.com.
ns      86400   IN      A       1.1.1.1
www     86400   IN      A       2.2.2.2
; zone example.com is ok
k0ekk0ek commented 1 month ago

Thanks for reporting @dfxbb! I'll have a look.

k0ekk0ek commented 1 month ago

@dfxbb, NLnetLabs/simdzone#228 fixes this issue, so it's fixed in the next release. Thanks for reporting!

dfxbb commented 1 month ago

@k0ekk0ek Thanks for the timely fix! 👍