From owner-cvs-all@FreeBSD.ORG Tue Feb 13 07:04:41 2007 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 158C016A409; Tue, 13 Feb 2007 07:04:41 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 314D913C4AC; Tue, 13 Feb 2007 07:04:39 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id l1D74baX062304; Tue, 13 Feb 2007 10:04:37 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id l1D74bAV062303; Tue, 13 Feb 2007 10:04:37 +0300 (MSK) (envelope-from yar) Date: Tue, 13 Feb 2007 10:04:36 +0300 From: Yar Tikhiy To: Brooks Davis Message-ID: <20070213070436.GD58225@comp.chem.msu.su> References: <200702101313.l1ADDX8m056868@repoman.freebsd.org> <20070210205228.GE9455@submonkey.net> <20070211085317.GF13808@comp.chem.msu.su> <20070212034438.GA42410@lor.one-eyed-alien.net> <20070212120908.GN13808@comp.chem.msu.su> <20070212150333.GB50299@lor.one-eyed-alien.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070212150333.GB50299@lor.one-eyed-alien.net> User-Agent: Mutt/1.5.9i Cc: cvs-src@FreeBSD.org, Ceri Davies , cvs-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/etc/rc.d hostname X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2007 07:04:41 -0000 On Mon, Feb 12, 2007 at 09:03:33AM -0600, Brooks Davis wrote: > On Mon, Feb 12, 2007 at 03:09:09PM +0300, Yar Tikhiy wrote: > > On Sun, Feb 11, 2007 at 09:44:38PM -0600, Brooks Davis wrote: > > > On Sun, Feb 11, 2007 at 11:53:17AM +0300, Yar Tikhiy wrote: > > > > On Sat, Feb 10, 2007 at 08:52:28PM +0000, Ceri Davies wrote: > > > > > On Sat, Feb 10, 2007 at 01:13:33PM +0000, Yar Tikhiy wrote: > > > > > > yar 2007-02-10 13:13:33 UTC > > > > > > > > > > > > FreeBSD src repository > > > > > > > > > > > > Modified files: > > > > > > etc/rc.d hostname > > > > > > Log: > > > > > > Handle the case when the admin forgot to set $hostname, > > > > > > which can happen in new installations: advise to set the > > > > > > variable and refer to rc.conf(5). > > > > > > > > > > Isn't it possible for the hostname to come via DHCP? How does this > > > > > behave in that case (or rather, I can see how it behaves; is that the > > > > > right thing)? > > > > > > > > I've never played with setting the hostname via DHCP. In my change, > > > > I just tried not to break the existing code related to DHCP. Perhaps > > > > someone using DHCP to get the hostname could shed light on the topic. > > > > > > This appears mostly harmless for systems that get their hostname via > > > DHCP. They will get a warning, but it will otherwise work. > > > > Now I see. The code getting $hostname via kenv from dhcp.host-name > > is for the case when the host was booted via PXE. OTOH, a usual > > DHCP client will run dhclient when it comes to setting up network > > interfaces, i.e., after /etc/rc.d/hostname. Perhaps we need > > a way to indicate that the hostname will be assigned automatically > > and the nagging message shouldn't be emitted. E.g., in rc.conf: > > > > hostname="DHCP" > > > > I have no idea how many Unix hosts allow their hostname to be set > > via DHCP. I prefer to think that a Unix host is like a good ship: > > it never changes its name while furrowing the network seas. A DHCP > > assigned hostname better fits crippled hosts such as diskless > > stations etc. > > I wrote patches many years ago that added a "default_hostname" variable > which acted like hostname except that dhclient-script knew about it and > would change the host name to one it was give. This is the right thing > to do IMO because many applications break horribly if hostname is not > set. OTOH, booting a DHCP-configured laptop without a network connection can result in its not having the hostname set at all. This can warrant making $hostname a mandatory variable even for DHCP clients. dhclient will change the hostname if it gets a new value from the server. Changing the default hostname to a DHCP value isn't worse than changing the null hostname, so the former shouldn't break any apps not broken yet. I mean that dhclient may do the change a bit too late into the boot sequence if the DHCP server doesn't respond instantly. -- Yar