Date: Thu, 18 Nov 2010 23:47:27 +0100 From: Jilles Tjoelker <jilles@stack.nl> To: Garrett Cooper <yanegomi@gmail.com> Cc: rc@freebsd.org Subject: Re: rc.d/hostname dependency on netif backwards? Message-ID: <20101118224727.GB95648@stack.nl> In-Reply-To: <AANLkTikaT0fhNn79pJn5fUM-MSvz_%2BJviRvTma9eq1t4@mail.gmail.com> References: <AANLkTikaT0fhNn79pJn5fUM-MSvz_%2BJviRvTma9eq1t4@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 15, 2010 at 07:27:32PM -0800, Garrett Cooper wrote: > 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=2(SERVFAIL) > + [ -n 2(SERVFAIL) ] > + return > + _return=0 > + [ 0 -ne 0 ] > + return 0 > + _run_rc_postcmd > + [ -n ] > + return 0 > + return 0 > %sysctl -a | grep hostname > kern.hostname: 2(SERVFAIL) > security.jail.set_hostname_allowed: 1 > 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). You should try to find what is setting the hostname to 2(SERVFAIL). A cause could be not checking host(1)'s exit status -- it prints any error message to stdout. Neither /etc/rc.d/hostname nor /sbin/dhclient-script appear to do anything like that. -- Jilles Tjoelker
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101118224727.GB95648>