Date: Thu, 8 Sep 2005 11:10:52 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: "Matthew N. Dodd" <mdodd@FreeBSD.ORG> Cc: arch@FreeBSD.ORG Subject: Re: [CFR] reflect resolv.conf update to running application Message-ID: <20050908181052.GH31354@odin.ac.hmc.edu> In-Reply-To: <20050828022351.F63789@sasami.jurai.net> References: <ygefyt4yiaz.wl%ume@mahoroba.org> <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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050908181052.GH31354>