]> granicus.if.org Git - pdns/commit
rec: Only check the netmask for subnet specific cache entries
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 12 May 2017 12:12:10 +0000 (14:12 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 12 May 2017 12:12:10 +0000 (14:12 +0200)
commit65fdd185f4930f685b87340d29535f40d8b52fb3
tree782d6d10e48943a82aeaa46b3212021c2a119e3e
parentd72fcb8ce1ef3ddf0a57153c54d94f729342adc2
rec: Only check the netmask for subnet specific cache entries

We used to check the netmask for all entries for a qname
if at least one of them was a subnet specific one. Since an empty
`Netmask` doesn't match anything, we would effectively ignore every
non subnet specific entries if we had at least one subnet specific
one.
This caused a very hard to reproduce issue with for example
f.root-servers.net that includes an EDNS Client Subnet option in its
answer for `NS .` if the query has an EDNS Client Subnet option.
This caused the recursor to cache a subnet specific entry for `NS .`.
When that entry expired, we retrieved and cached a non subnet specific
one, but that new one was ignored as long as the subnet specific
was not expunged from the cache.
Under certain circumstances that could cause a root refresh loop
using a lot of stack memory.
pdns/recursor_cache.cc