Date: Thu, 9 Apr 2009 23:45:29 +0400 From: Eygene Ryabinkin <rea-fbsd@codelabs.ru> To: Doug Barton <dougb@FreeBSD.org> Cc: freebsd-current@freebsd.org Subject: Re: New rc.d/named features for testing: auto-forwarding and wait on boot Message-ID: <cBYPtnscDZjIqgW//IlCSa8FAag@7qgLKkvX/1U6eu9avhKQpU/1pEI> In-Reply-To: <49D1B261.6010406@FreeBSD.org> References: <49D1B261.6010406@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Doug, everyone, good day. Mon, Mar 30, 2009 at 11:04:17PM -0700, Doug Barton wrote: > For a long time now there has also been discussion about configuring > the local resolver to automatically forward to those name servers in > /etc/resolv.conf. This bit is a lot trickier, primarily because it > involves writing to /etc/namedb/ at boot time. However, the default is > to chroot the named process to /var/named/ so this should be > relatively safe. > > The patch has an implementation of the feature that works for the few > networks I've tested it on. I feel that it is still a bit rough, but > it's ready for wider review. The basic idea is that we parse > /etc/resolv.conf for lines that begin with "nameserver" and try to > make use of the information. It writes a temp file to > /var/run/auto_forward.conf, then when it's done it compares the result > to what's in [/var/named]/etc/namedb/auto_forward.conf. If it's > different, the new one replaces the old. While it's being parsed, if > the local named is not the first nameserver line in /etc/resolv.conf > that is added, and if the new file differs from the existing one it > will be replaced too. This uses roughly the same logic as is used in > /sbin/dhclient-script. Just for the record: once upon a time, http://lists.freebsd.org/pipermail/freebsd-current/2008-April/084847.html I had posted patches that were doing the similar job, but they were mainly focused on the dhclient part. Though, I had implemented creation of /etc/resolv.conf inside /etc/rc.d/resolv in a number of ways: - by using DHCP kenv variables; - by using /etc/rc.conf variables; - by using command-line options to /etc/rc.d/resolv. And that was complemented with the automated creation of the forwarders file for named that is very similar to what you did. There is a hanging PR about this: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/123015 May be my old patches (that are working on my laptop and some workstations almost for a year) will worth review/integration. Archive with patches could be downloaded from http://codelabs.ru/fbsd/patches/resolv/resolv.named.forwarders.tar.bz2 Comments are reviews are welcome. Thanks! -- Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook {_.-``-' {_/ #
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cBYPtnscDZjIqgW//IlCSa8FAag>