rc.d/hostname dependency on netif backwards?

Garrett Cooper yanegomi at gmail.com
Tue Nov 16 03:27:34 UTC 2010


    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 :).
    I have a lame patch attached (it hasn't worked so far with 7.x
from boot, but it works after the network's up and happy, etc; it
might work with CURRENT with the network state wait change), but I'm
wondering who sets hostname (etc/rc.d/hostname?) s.t. the SERVFAIL
check can be removed.
Thanks!
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etc-rc.d-hostname-hack.patch
Type: text/x-patch
Size: 769 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20101116/8dfa90f4/etc-rc.d-hostname-hack.bin


More information about the freebsd-rc mailing list