]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add an option to respect whatever the server says for the hostname.
authorRoy Marples <roy@marples.name>
Sun, 28 Jul 2013 10:22:18 +0000 (10:22 +0000)
committerRoy Marples <roy@marples.name>
Sun, 28 Jul 2013 10:22:18 +0000 (10:22 +0000)
Change the default back to FQDN as per RFC4702 section 3.1.

dhcpcd-hooks/30-hostname
dhcpcd.conf.5.in

index a2c22f63152d89e8aaeaf8c4d49fe61b328cf2fe..cff397ae03516eefa7d160a296fd48f3a0af78bf 100644 (file)
@@ -1,9 +1,19 @@
 # Set the hostname from DHCP data if required
 
-# Set one of the below to override the DHCP supplied hostname information
-# to be either a short hostname or a FQDN.
-#hostname_fqdn=false
-#hostname_fqdn=true
+# A hostname can either be a short hostname or a FQDN.
+# hostname_fqdn=true
+# hostname_fqdn=false
+# hostname_fqdn=server
+
+# A value of server means just what the server says, don't manipulate it.
+# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+# DHCPv6 has no hostname option.
+# RFC4702 section 3.1 says FQDN should be prefered over hostname.
+#
+# As such, the default is hostname_fqdn=true so that a consistent hostname
+# is always assigned.
+: ${hostname_fqdn:=true}
 
 # Some systems don't have hostname(1)
 _hostname()
@@ -56,7 +66,7 @@ need_hostname()
        
        case "$hostname_fqdn" in
        [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)        hfqdn=true;;
-       "")                                     ;;
+       [Ss][Ee][Rr][Vv][Ee][Rr])               ;;
        *)                                      hshort=true;;
        esac
 
index cd14d3d94e85936c5abf39d04e4faa0022e53241..24e833cfdaa3f0c92c44f005e7071aff7d14d28e 100644 (file)
@@ -98,6 +98,20 @@ to the environment for use in
 For example, you can force the hostname hook to always set the hostname with
 .Ic env
 .Va force_hostname=YES .
+.Pp
+If the hostname is set, will be will set to the FQDN if possible as per
+RFC 4702 section 3.1.
+If the FQDN option is missing,
+.Nm dhcpcd
+will still try and set a FQDN from the hostname and domain options for
+consistency.
+To override this, set
+.Ic env
+.Va hostname_fqdn=[YES|NO|SERVER] .
+A value of server means just what the server says, don't manipulate it.
+This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+DHCPv6 has no hostname option.
 .It Ic clientid Ar string
 Send the
 .Ar clientid .
@@ -137,6 +151,10 @@ is a FQDN (ie, contains a .) then it will be encoded as such.
 Sends the short hostname to the DHCP server instead of the FQDN.
 This is useful because DHCP servers will not register the FQDN in their
 DNS if the domain part does not match theirs.
+.Pp
+Also, see the
+.Ic env
+option above to control how the hostname is set on the host.
 .It Ic ia_na Op Ar iaid
 Request a DHCPv6 Normal Address for
 .Ar iaid .