Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 2010 15:28:41 -0800
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        rc@freebsd.org
Subject:   Re: rc.d/hostname dependency on netif backwards?
Message-ID:  <AANLkTinmMZ3Km5iZit_4deSLFgJRuz3gdhUtfU_cqfwX@mail.gmail.com>
In-Reply-To: <20101118224727.GB95648@stack.nl>
References:  <AANLkTikaT0fhNn79pJn5fUM-MSvz_%2BJviRvTma9eq1t4@mail.gmail.com> <20101118224727.GB95648@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 18, 2010 at 2:47 PM, Jilles Tjoelker <jilles@stack.nl> wrote:
> On Mon, Nov 15, 2010 at 07:27:32PM -0800, Garrett Cooper wrote:
>> =A0 =A0 It looks like existing code for rc.d/hostname might be backwards=
:
>
>> %/etc/rc.d/hostname restart
>> + /sbin/sysctl -n security.jail.jailed
>> + [ 0 -eq 1 ]
>> + /bin/hostname -s
>> + hostname_s=3D2(SERVFAIL)
>> + [ -n 2(SERVFAIL) ]
>> + return
>> + _return=3D0
>> + [ 0 -ne 0 ]
>> + return 0
>> + _run_rc_postcmd
>> + [ -n =A0]
>> + return 0
>> + return 0
>> %sysctl -a | grep hostname
>> kern.hostname: 2(SERVFAIL)
>> security.jail.set_hostname_allowed: 1
>
>> =A0 =A0 Why is it trying to resolve a hostname (hostname -s) before the
>> network's up? I could understand if this was a statically defined
>> hostname, but all of my hostnames are derived from pxebooting ala
>> dhcpd / named, not a static value :).
>
> /bin/hostname is just a wrapper around gethostname()/sethostname(). It
> does not use DNS (some versions of GNU hostname do).

Sure.

> You should try to find what is setting the hostname to 2(SERVFAIL). A

This is actually a gai_strerror.

> cause could be not checking host(1)'s exit status -- it prints any error
> message to stdout.

Yeah... that's a bit annoying -- it should go to stderr.

> Neither /etc/rc.d/hostname nor /sbin/dhclient-script appear to do anythin=
g like that.

Yeah... it's kind of weird.

On the bright side it doesn't happen with (relatively) vanilla
CURRENT. I'm not sure what IronPort changes have been made to our
FreeBSD 7.1 image that might have broken this (if 7.1 didn't work
already this way), but I'm not going to concern myself too much about
it now. The workaround is trivial...

Thanks,
-Garrett



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