From owner-freebsd-current@FreeBSD.ORG Thu Apr 9 20:02:09 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DEC3106566B; Thu, 9 Apr 2009 20:02:09 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 392DB8FC18; Thu, 9 Apr 2009 20:02:09 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=PlEcatHFNFMtZYdKjWCpnoQBgBojx7Ta5EpTSScW4e2v7AjOdu1/AIvFpLzRW+BpQuQkLEQQtfS4q2H9ImwHReg/8i7X20BGxAM6b6H2TaAFQQ3VHa6HDxhn89q9gPeFxKnqEnq5ukb4kYd061oSN3HUrrSUM++8FwUvXiTlHUU=; Received: from amnesiac.at.no.dns ([91.78.249.107]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1Ls0Br-000AnO-HM; Thu, 09 Apr 2009 23:45:35 +0400 Date: Thu, 9 Apr 2009 23:45:29 +0400 From: Eygene Ryabinkin To: Doug Barton Message-ID: References: <49D1B261.6010406@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49D1B261.6010406@FreeBSD.org> Sender: rea-fbsd@codelabs.ru Cc: freebsd-current@freebsd.org Subject: Re: New rc.d/named features for testing: auto-forwarding and wait on boot X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2009 20:02:09 -0000 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 {_.-``-' {_/ #