HomeFreeBSD

Fix non-recoverable name resolution failures due to negative cache

Description

Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

  1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

positive-time-to-live hosts 30
negative-time-to-live hosts 1

  1. Ensure that nsswitch.conf hosts line contains something like:

hosts: files cache dns

Note that cache must be specified before dns.

  1. Start nscd.
  1. Run the following command:

while true; do nc -z -w 3 www.google.com 80; sleep 5; done

  1. While running the command, remove or comment out all nameserver statements in /etc/resolv.conf. After a short while you will notice non-recoverable name rsolution failures.
  1. Uncomment or replace all nameserver statements back into /etc/resolv.conf. Take note that name resolution never recovers. To recover nscd must be restarted. This patch fixes this.

PR: 207804
Submitted by: Jov <amutu@amutu.com>
MFC after: 1 week

Details

Provenance
cyAuthored on
Parents
rS318577: Improve time-since-last-scrub calculation.
Branches
Unknown
Tags
Unknown