On Sun, Apr 29, 2018 at 2:56 PM, Florian Weimer <f...@deneb.enyo.de> wrote:
> * Harald Dunkel: > > > I am using both systemd and sysvinit-core, but I am not sure which one > > was active when I ran into this problem. > > > > Consider a split DNS setup for a remote network. I had started an IPsec > > connection to the remote side. /etc/resolv.conf was changed to include > > the new internal DNServer on the remote side, but a host lookup gave me > > still the old external address. Stopping nscd did not help, AFAIR. > > That's arguably a bug in nscd. It should flush the cache each time it > detects a change in /etc/resolv.conf (or /etc/gai.conf, for that > matter). > And it does, this is what define_traced_file/init_traced_file do in nss/nss_files/files-init.c. Then via the nscd callback nscd_init_cb, we call register_traced_file for each loaded database. Then each registered file, like /etc/resolv.conf, is watched via inotify for any changes, and if a change is detected and finfo->call_res_init was true (and it's true only for resolv.conf) then we call res_init(). We do not handle anything for changes in gai.conf, we would have to add that. Cheers, Carlos.