NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FQDNs for netbooted hosts via DHCP?



On 15/07/2018 03:37, Robert Elz wrote:
As with most client/server systems, there are two separate things that need
to be made to work - the server has to send the data that you want it to
send (which might mean altering what the client requests, or server config,
or ...) and then the client needs to "do the right thing" with the data that is
returned.

Lastly, for this, I wonder if perhaps that final "false" in need_hostname
(in dhcpcd-hooks/30-hostname) might instead be something more like

	${hfqdn} && [  "${hostname}" = "${hostname#*.}" ]

If we're going to test that, then we need to check the converse for ${hsort} && [ "$hostname" = "${hostname%%.*}" ]

The actual change required is a bit more invasive than that line change though, but it suffices for this discussion.

so that (If I got that correct) if we want a FQDN as the hostname, and
what has been set (by something else) is not a FQDN but just a short
name, then we allow dhcpcd to set the FQDN (overriding whatever was
set before).   If it had been this way, the force_hostname stuff would not
have been needed.

If that change is mde though it would  need to be made clear that
(as the default is to set a FQDN) that simply setting a short hostname
in rc.conf would not be effective, dhcpcd.conf would also need to be
modified to allow short names if the DHCP server returns names.

The only other concern I have with this is that if we have two interfaces and dhcpcd receives the same short hostname on both but only a domain on one of them, then the hostname will flip-flop between short and long hostnames.

This is probably unlikely, but is worth pointing out.

Roy: I'd also suggest getting rid of the '-a' operator in test arg lists,
while it is probably OK in all systems as used, it is not really
safe - test with more than 4 args (not counting the ']' when present)
produces unspecified results.  Use && instead.   There are two of
them in that script (well, the same one, more or less, in
need_hostname() and set_hostname())

You're referring to this?
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

>4 arguments:
    The results are unspecified.

Well, Today I Learned something new I guess.
I suppose my only concern is speed ... that would not produce any more subshells on NetBSD or any modern shell would it? Guess I should do some testing around that.

Roy


Home | Main Index | Thread Index | Old Index