Subject: Re: re-reading /etc/resolv.conf on change
To: Manuel Bouyer <firstname.lastname@example.org>
From: Perry E. Metzger <email@example.com>
Date: 12/29/2003 16:53:38
Manuel Bouyer <firstname.lastname@example.org> writes:
> On Sun, Dec 28, 2003 at 03:51:38PM -0500, Perry E. Metzger wrote:
>> Manuel Bouyer <email@example.com> writes:
>> > What I did is unconditionally call res_init() from other resolver
>> > functions.
>> > In res_init(), I use kqueue to monitor changes to /etc/resolv.conf
>> > (or to /etc/. if /etc/resolv.conf doens't exists). Every call to a resolver
>> > function will call res_init(), which will check the kevent queue.
>> > This adds a little overhead to the resolver functions (a function call,
>> > and a system call), but I think it's worth it.
>> One point -- I think that this is a great idea, but that we should
>> really be updating our resolver to the one from Bind 9
>> *before* we hack on it any further, or we will make it even harder to
>> import a new version.
> I don't think that these few lines would make the work really harder.
> I'll be happy to redo this work for bind9 if needed (but maybe bind9
> already solves this problem).
One thing you could do to speed this up would be to help do the bind 9
resolver work. :)
> And it doen't look like the switch to the bind9 resolved will happen any
> time soon.
It would have happened a while ago, actually, but for the difficulty
of dealing with our customized resolver...
> open() will follow the symlink, so the kevent filter will watch the target of
> the symlink, not the symlink itself. I can see 2 ways to loose with this:
> - if the symlink doens't point to a real file, and points outside of /etc/
> in this case, open() will fail, and the kevent will be set on /etc.
> Then we can recreate a file as the symlink's target, but the resolver won't
> notice it.
> - if we change the symlink to point to another file.
> I don't know how to deal properly with the first case. The second could
> be dealt with a kevent on the symlink itself, but I'm not sure it's worth
> the extra complexity (BTW how to we get a file descriptor to a symlink,
> instead of the target of a symlink).
> Note that if we move /etc as a whole, we loose too.
Yuck, yuck, and yuck.
Perry E. Metzger firstname.lastname@example.org