Bug 252855 - nscd(8) does not cache DNS
Summary: nscd(8) does not cache DNS
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-20 09:48 UTC by Greg Rivers
Modified: 2021-01-23 00:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Rivers 2021-01-20 09:48:53 UTC
With this configuration:

$ fgrep hosts /etc/nsswitch.conf /etc/nscd.conf
/etc/nsswitch.conf:hosts: cache files dns
/etc/nscd.conf:enable-cache hosts yes
/etc/nscd.conf:positive-time-to-live hosts 60
/etc/nscd.conf:positive-policy hosts lfu
/etc/nscd.conf:negative-time-to-live hosts 60
/etc/nscd.conf:negative-policy hosts lfu
/etc/nscd.conf:negative-confidence-threshold hosts 3

nscd does not seem to cache DNS answers. Testing with getaddrinfo(1), every query hits the wire, bound for the resolver defined in /etc/resolv.conf.

I can't tell if this is a bug, or if I've misconfigured something. (Yes, nscd is enabled in rc.conf and running).
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2021-01-22 14:25:56 UTC
https://svnweb.freebsd.org/base?view=revision&revision=364199

https://forums.freebsd.org/threads/nscd-and-nsswitch-doesnt-seem-to-be-working-together.74789/

It seems to be fixed in 12.2, but also seems to be removed in 13-CURRENT, so you might want to look at migrating to another solution.
Comment 2 Greg Rivers 2021-01-23 00:37:58 UTC
(In reply to Conrad Meyer from comment #1)
Is there another solution? The requirement is to have the OS stub resolver cache DNS answers system wide. I don't know how to do that without nsswitch/nscd. Shouldn't nsswitch/nscd be fixed?