On Fri, 2003-06-06 at 08:50, Chris Adams wrote:
<stab type=wild>The behaviour is that running programs continue to use to previous contents of /etc/resolv.conf. This can be a real problem, as that includes things like syslogd (some versions basically hang when they can't resolve IPs, and that can cause all kinds of other programs to hang when they try to log something).
How about a means of catching a sighup and rereading resolv.conf?
</stab>
Missed. The signal handler would have to do in glibc and it would play havoc with any process that wants to install its own handler. Or indeed anything that wants to ignore SIGHUP. And you'd have to arrange for SIGHUP to be delivered to everything when you swap interfaces. And anything that was running on the old glibc that didn't have a handler would just exit. Not pretty.
Don't forget that even things like mozilla don't do so many calls to the resolver that adding in an extra chceck for /etc/resolv.conf is not going to make a noticable difference. Not to mention the fact that checking a local file which is going to be in the buffer cache is several orders of magnitude faster than the look up itself is going to be ...
I took my own suggestion though -- when I switch IP addresses (flipping between work and home), I now also restart nscd and pretty well everything continues to run just fine. The only remaining problem is that my home mail server's IP address gets cached. That wouldn't be a problem except that its 192.168.0.2 from inside the house and 212.something.or.other to the outside world :-)
jch