Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Feb 2007 09:29:23 -0600
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Yar Tikhiy <yar@comp.chem.msu.su>
Cc:        Ceri Davies <ceri@submonkey.net>, cvs-src@FreeBSD.org, Brooks Davis <brooks@FreeBSD.org>, cvs-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: cvs commit: src/etc/rc.d hostname
Message-ID:  <20070215152923.GA97047@lor.one-eyed-alien.net>
In-Reply-To: <20070215065743.GB20957@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> <20070213070436.GD58225@comp.chem.msu.su> <20070213161927.GC57543@lor.one-eyed-alien.net> <20070215065743.GB20957@comp.chem.msu.su>

next in thread | previous in thread | raw e-mail | index | archive | help

--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 15, 2007 at 09:57:43AM +0300, Yar Tikhiy wrote:
> On Tue, Feb 13, 2007 at 10:19:27AM -0600, Brooks Davis wrote:
> > On Tue, Feb 13, 2007 at 10:04:36AM +0300, Yar Tikhiy wrote:
> > > 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
> > > > > > > > >=20
> > > > > > > > >   FreeBSD src repository
> > > > > > > > >=20
> > > > > > > > >   Modified files:
> > > > > > > > >     etc/rc.d             hostname=20
> > > > > > > > >   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).
> > > > > > > >=20
> > > > > > > > Isn't it possible for the hostname to come via DHCP?  How d=
oes this
> > > > > > > > behave in that case (or rather, I can see how it behaves; i=
s that the
> > > > > > > > right thing)?
> > > > > > >=20
> > > > > > > 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 th=
e topic.
> > > > > >=20
> > > > > > This appears mostly harmless for systems that get their hostnam=
e via
> > > > > > DHCP.  They will get a warning, but it will otherwise work.
> > > > >=20
> > > > > Now I see.  The code getting $hostname via kenv from dhcp.host-na=
me
> > > > > 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:
> > > > >=20
> > > > > hostname=3D"DHCP"
> > > > >=20
> > > > > 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 DH=
CP
> > > > > assigned hostname better fits crippled hosts such as diskless
> > > > > stations etc.
> > > >=20
> > > > I wrote patches many years ago that added a "default_hostname" vari=
able
> > > > 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 t=
hing
> > > > to do IMO because many applications break horribly if hostname is n=
ot
> > > > set.
> > >=20
> > > 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.
> >=20
> > dhclient will not change the hostname if it is set and this is probably
> > the right behavior for most people.  If we're going to make hostname
> > manditory, we need to provide an option to that dhclient can override
> > the hostname if that's what the administrator prefers.
>=20
> For now, I've just taught /etc/rc.d/hostname not to emit the warning
> if DHCP is used on any interface.

This seems like a reasonable compromise.

-- Brooks


--5vNYLRcllDrimb99
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQFF1HxTXY6L6fI4GtQRAsWYAJoDHH6FRhbAUyxGA9VRHIhV/7yzcQCgnzxE
7LNbcK76EbeUhaI3PAOEkCk=
=ClcR
-----END PGP SIGNATURE-----

--5vNYLRcllDrimb99--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070215152923.GA97047>