From owner-freebsd-arch@FreeBSD.ORG Thu Sep 8 18:10:53 2005 Return-Path: X-Original-To: arch@FreeBSD.ORG Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F32516A41F; Thu, 8 Sep 2005 18:10:53 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8A3443D49; Thu, 8 Sep 2005 18:10:52 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j88IAqoG002058; Thu, 8 Sep 2005 11:10:52 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j88IAq2N002057; Thu, 8 Sep 2005 11:10:52 -0700 Date: Thu, 8 Sep 2005 11:10:52 -0700 From: Brooks Davis To: "Matthew N. Dodd" Message-ID: <20050908181052.GH31354@odin.ac.hmc.edu> References: <20050826202713.X1915@sasami.jurai.net> <20050827014153.GA14720@odin.ac.hmc.edu> <20050826221016.B1915@sasami.jurai.net> <20050827170600.GB14720@odin.ac.hmc.edu> <20050828022351.F63789@sasami.jurai.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fd5uyaI9j6xoeUBo" Content-Disposition: inline In-Reply-To: <20050828022351.F63789@sasami.jurai.net> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=LINES_OF_YELLING autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: arch@FreeBSD.ORG Subject: Re: [CFR] reflect resolv.conf update to running application X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 18:10:53 -0000 --fd5uyaI9j6xoeUBo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 28, 2005 at 02:25:05AM -0400, Matthew N. Dodd wrote: > On Sat, 27 Aug 2005, Brooks Davis wrote: > >I'd like to see dhclient-script pull in /etc/rc.conf. >=20 > Attached. I've looked this over and while I like the concept, I think the implementation could be improved. First, it looks like named.conf has an include directive what is conveniently undocumented in the manpage, but in the BIND 9 Administrator Reference Manual at: http://www.bind9.net/manual/bind/9.3.1/Bv9ARM.ch06.html#AEN1534 so if it actually works, we should use that instead of rebuiling the config file each time. Second, the forwarders file should default to living in the /var/run of the named chroot since we default to chrooted operation these day. Third, I think we need to kick the server with "rndc reconfig" once the file is updated. Thanks, Brooks > --=20 > 10 40 80 C0 00 FF FF FF FF C0 00 00 00 00 10 AA AA 03 00 00 00 08 00 > Index: sbin/dhclient/dhclient-script > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/cvs/src/sbin/dhclient/dhclient-script,v > retrieving revision 1.8 > diff -u -u -r1.8 dhclient-script > --- sbin/dhclient/dhclient-script 26 Aug 2005 20:31:04 -0000 1.8 > +++ sbin/dhclient/dhclient-script 28 Aug 2005 06:02:16 -0000 > @@ -19,6 +19,9 @@ > # > # > =20 > +. /etc/rc.subr > +load_rc_config dhclient-script > + > NETSTAT=3D/usr/bin/netstat > AWK=3D/usr/bin/awk > HOSTNAME=3D/bin/hostname > @@ -127,6 +130,23 @@ > fi > } > =20 > +make_named_forwarders() { > + if [ -z "$new_domain_name_servers" ]; then > + return 1 > + fi > + > + rm -f /var/run/named.forwarders > + echo " forwarders {" > /var/run/named.forwarders > + for nameserver in $new_domain_name_servers; do > + echo " $nameserver;" >> /var/run/named.forwarders > + done > + echo " };" >> /var/run/named.forwarders > + > + cd /etc/namedb && make -f make-named.conf > + > + return 0 > +} > + > add_new_resolv_conf() { > # XXX Old code did not create/update resolv.conf unless both > # $new_domain_name and $new_domain_name_servers were provided. PR > @@ -238,7 +258,12 @@ > if [ "$new_ip_address" !=3D "$alias_ip_address" ]; then > add_new_alias > fi > - add_new_resolv_conf > + if checkyesno dhclient_script_resolv_conf; then > + add_new_resolv_conf > + fi > + if checkyesno dhclient_script_named_forwarders; then > + make_named_forwarders > + fi > ;; > =20 > EXPIRE|FAIL) > @@ -266,8 +291,13 @@ > add_new_alias > fi > add_new_routes > - if add_new_resolv_conf; then > - exit_with_hooks 0 > + if checkyesno dhclient_script_named_forwarders; then > + make_named_forwarders > + fi > + if checkyesno dhclient_script_resolv_conf; then > + if add_new_resolv_conf; then > + exit_with_hooks 0 > + fi > fi > fi > fi > Index: etc/defaults/rc.conf > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/cvs/src/etc/defaults/rc.conf,v > retrieving revision 1.259 > diff -u -u -r1.259 rc.conf > --- etc/defaults/rc.conf 24 Aug 2005 16:25:47 -0000 1.259 > +++ etc/defaults/rc.conf 28 Aug 2005 05:46:18 -0000 > @@ -93,6 +93,9 @@ > nisdomainname=3D"NO" # Set to NIS domain if using NIS (or NO). > dhclient_program=3D"/sbin/dhclient" # Path to dhcp client program. > dhclient_flags=3D"" # Additional flags to pass to dhcp client. > +dhclient_script_resolv_conf=3D"YES" # Update /etc/resolv.conf > +dhclient_script_named_forwarders=3D"NO" # Update /var/run/named.forwarde= rs and > + # rebuild /etc/namedb/named.conf > background_dhclient=3D"NO" # Start dhcp client in the background. > firewall_enable=3D"NO" # Set to YES to enable firewall functionality > firewall_script=3D"/etc/rc.firewall" # Which script to run to set up the= firewall > Index: etc/namedb/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/cvs/src/etc/namedb/Makefile,v > retrieving revision 1.4 > diff -u -u -r1.4 Makefile > --- etc/namedb/Makefile 21 Dec 2004 08:46:50 -0000 1.4 > +++ etc/namedb/Makefile 28 Aug 2005 06:14:50 -0000 > @@ -1,7 +1,7 @@ > -# $FreeBSD$ > +# $FreeBSD: src/etc/namedb/Makefile,v 1.4 2004/12/21 08:46:50 ru Exp $ > =20 > FILES=3D PROTO.localhost.rev PROTO.localhost-v6.rev named.conf named.roo= t \ > - make-localhost > + make-localhost make-named.conf > NO_OBJ=3D > FILESDIR=3D /etc/namedb > FILESMODE=3D 644 > Index: etc/namedb/make-named.conf > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: etc/namedb/make-named.conf > diff -N etc/namedb/make-named.conf > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ etc/namedb/make-named.conf 28 Aug 2005 05:59:12 -0000 > @@ -0,0 +1,17 @@ > +# $FreeBSD$ > +# > + > +# > +# Move /etc/named.conf to /etc/named.conf.in and add the following > +# lines to the options section. > +# > +# forward only; > +# #include "/var/run/named.forwarders" > +# > + > +named.conf: named.conf.in /var/run/named.forwarders > + cpp -P -C named.conf.in > $@ > + /etc/rc.d/named restart > + > +/var/run/named.forwarders: > + @touch /var/run/named.forwarders --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --fd5uyaI9j6xoeUBo Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD4DBQFDIH6rXY6L6fI4GtQRAppOAJjyEPWVxH8ysVq8yLZP+8Y7cGn9AJ4gapj4 +JZryv5l/keB/pAUYknnfA== =2PMp -----END PGP SIGNATURE----- --fd5uyaI9j6xoeUBo--