From owner-freebsd-bugs Wed Jan 30 14: 6:17 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from relay3-gui.server.ntli.net (relay3-gui.server.ntli.net [194.168.4.200]) by hub.freebsd.org (Postfix) with ESMTP id 72A1F37B400 for ; Wed, 30 Jan 2002 14:06:12 -0800 (PST) Received: from pc4-card4-0-cust162.cdf.cable.ntl.com ([80.4.14.162] helo=rhadamanth.private.submonkey.net ident=mailnull) by relay3-gui.server.ntli.net with esmtp (Exim 3.03 #2) id 16W2rp-0003Od-00; Wed, 30 Jan 2002 22:06:09 +0000 Received: from setantae by rhadamanth.private.submonkey.net with local (Exim 3.34 #1) id 16W2rk-0000OT-00; Wed, 30 Jan 2002 22:06:04 +0000 Date: Wed, 30 Jan 2002 22:06:04 +0000 From: Ceri To: "brian j. peterson" Cc: freebsd-bugs@FreeBSD.org Subject: Re: misc/34455: [PATCH] /sbin/dhclient-script overwrites /etc/resolv.conf without any relevant information Message-ID: <20020130220604.GA1174@rhadamanth> References: <200201302110.g0ULA2394068@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200201302110.g0ULA2394068@freefall.freebsd.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Jan 30, 2002 at 01:10:02PM -0800, brian j. peterson wrote: > > On Wed, Jan 30, 2002 at 06:28:07PM +0000, Ceri wrote: > > Strikes me as pilot error to be honest. > > If the DCHP server doesn't provide nameservers, and you're not overriding them, > > then you'll end up with nothing there. > > > > If you wish to insert some information into /etc/resolv.conf, > > that's what the supersede statement in dhclient.conf is for, viz. > > > > # cat /etc/dhclient.conf > > interface "ed0" { > > supersede domain-name "private.submonkey.net"; > > prepend domain-name-servers 192.168.10.1; > > } > > admittedly, there are ways around this problem, but the fact is that > dhclient-script is overwriting /etc/resolv.conf regardless of whether > or not it has useful data to write to it. I can't think of one, but it's feasible that administrators would want this to happen in certain situations. DHCP could be used as a method of rolling out changes, and while I can't think why anybody would want to do this, that doesn't mean that nobody does. > my trivial patch solves this > problem by not writing to /etc/resolv.conf if there's no reason to. No, it doesn't write to /etc/resolv.conf if there are no nameservers. That's not quite the same thing. > i prefer, at this point, to create my own /etc/resolv.conf, and since i'm > not requesting any domain-name or domaina-name-servers information, If your machine needs DNS servers to function on the network, then you should probably request them, or use the supersede modifier. > i > don't think dhclient-script has any business overwriting /etc/resolv.conf > with "search \n". > > am i wrong to expect this script to not clobber important files with > useless information? I don't know. I think a modification like this should really be done locally in /etc/dhclient-enter-hooks, as per dhclient-script.5 : When it starts, the client script first defines a shell function, make_resolv_conf , which is later used to create the /etc/resolv.conf file. To override the default behaviour, redefine this function in the enter hook script. This opinion is mainly formed due to the difference in our perceptions of what the patch actually does. It suits your position, but it's not friendly to anyone who might want to roll out empty /etc/resolv.conf's for whatever reason. Ceri -- keep a mild groove on To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message